@@ -39,7 +39,6 @@ template <class T, class D> class Problem {
3939 // Running the stack
4040 void run ();
4141 void run (int limit);
42- void readPush (int iter = 1 );
4342 void push (Data<T, D> elt);
4443 Data<T, D> pop ();
4544 Data<T, D> top (int k);
@@ -109,13 +108,9 @@ Problem<T, D>::Problem(std::string fileName) : mIndex(0), mContext(nullptr) {
109108 if (parameters[i].compare (" b" ) == 0 ) {
110109 foundBuffer = true ;
111110 b = stoi (parameters[i + 1 ]);
112- // std::cout<<"found buffer "<<b<<std::endl;
113111 }
114112 }
115113
116- // std::cout << "reading all shit n,p,b,foundP,foundBuffer "<<n<<" "<<p<<"
117- // "<<b<<" "<<foundP<<" "<<foundBuffer<<std::endl;
118-
119114 if (foundBuffer && !foundP)
120115 throw (" Problem<T,D>::Problem(std::string fileName), wrong header format " );
121116 if (!foundP)
@@ -130,31 +125,12 @@ Problem<T, D>::Problem(std::string fileName) : mIndex(0), mContext(nullptr) {
130125 }
131126}
132127
133- /* template <class T, class D>
134- Problem<T,D>::Problem(std::string fileName, int size)
135- : mIndex(0)
136- , mContext(nullptr)
137- , mStack(new NormalStack<T,D> (size)){
138- mInput.open(fileName, std::ifstream::in);
139- }
140-
141- template <class T, class D>
142- Problem<T,D>::Problem(std::string fileName, int size, int space, int buffer)
143- : mIndex(0)
144- , mContext(nullptr){
145- mInput.open(fileName, std::ifstream::in);
146- std::streampos position = mInput.tellg();
147- mStack = std::shared_ptr<Stack<T,D>> (new CompressedStack<T,D> (size, space,
148- buffer, mContext));
149-
150- }*/
151-
152128/* ==============================================================================
153129 IO : toString, print, println
154130==============================================================================*/
155131template <class T , class D > std::string Problem<T, D>::toString() {
156132 std::string str;
157- str = " Problem with an actual index of " + std::to_string (mIndex );
133+ str = " Instance with an actual index of " + std::to_string (mIndex );
158134 str += " , with a stack of type\n " ;
159135 str += mStack ->toString ();
160136 return str;
@@ -206,30 +182,23 @@ std::vector<std::string> Problem<T, D>::readHeader() {
206182}
207183
208184template <class T , class D > void Problem<T, D>::readPush(int iter) {
209- std::cout << " read push start " << std::endl;
210-
211185 for (int i = 0 ; i < iter; i++) {
212186 std::streampos position = mInput .tellg ();
213187 (*mStack ).setPosition (position);
214188 std::vector<std::string> line = readLine ();
215189 D data = readInput (line);
216190 mIndex ++;
217- std::cout << " read push read " <<data << std::endl;
218-
219191 Data<T, D> elt (mIndex , data);
220192 pushAction (elt);
221193 push (elt);
222- std::cout << " pushed read " <<data << std::endl;
223-
224194 }
225- std::cout << " read push end " << std::endl;
226-
227195}
228196
229197
230198/* ==============================================================================
231199 Stack Functions: run, push, pop, top, readPush
232200==============================================================================*/
201+ // TODO: Make popLoop, pushStep and so on functions
233202template <class T , class D > void Problem<T, D>::run() {
234203 initStackIntern ();
235204 while (mInput .good ()) {
@@ -240,8 +209,7 @@ template <class T, class D> void Problem<T, D>::run() {
240209 break ;
241210 }
242211 D data = readInput (line);
243- mIndex ++; // Might have to move
244- std::cout << " Starting loop for " <<data << std::endl;
212+ mIndex ++;
245213 while ((!emptystack ()) && (popCondition (data))) {
246214 Data<T, D> elt = pop ();
247215 popAction (elt);
@@ -262,7 +230,7 @@ template <class T, class D> void Problem<T, D>::run(int limit) {
262230 std::vector<std::string> line = readLine ();
263231
264232 D data = readInput (line);
265- mIndex ++; // Might have to move
233+ mIndex ++;
266234
267235 while ((!emptystack ()) && (popCondition (data))) {
268236 Data<T, D> elt = pop ();
@@ -276,25 +244,8 @@ template <class T, class D> void Problem<T, D>::run(int limit) {
276244 }
277245}
278246
279- template <class T , class D > void Problem<T, D>::readPush(int iter) {
280- for (int i = 0 ; i < iter; i++) {
281- std::streampos position = mInput .tellg ();
282- (*mStack ).setPosition (position);
283- std::vector<std::string> line = readLine ();
284- D data = readInput (line);
285- mIndex ++;
286- Data<T, D> elt (mIndex , data);
287- pushAction (elt);
288- push (elt);
289- }
290- }
291-
292247template <class T , class D > void Problem<T, D>::push(Data<T, D> elt) {
293- std::cout << " goinbg to push " <<elt.getData () << std::endl;
294-
295248 mStack ->push (elt);
296- std::cout << " pushed " <<elt.getData () << std::endl;
297-
298249}
299250template <class T , class D > Data<T, D> Problem<T, D>::pop() {
300251 return mStack ->pop (*this );
0 commit comments