Skip to content

Commit dcf7c5e

Browse files
committed
Merge with master
2 parents b9b4f2d + d216f73 commit dcf7c5e

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

include/data.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ template <class T, class D> class Data {
3232
public:
3333
// IO
3434
std::string toString();
35-
D getData();
3635

36+
// Getters
37+
D getData();
3738

3839
private:
3940
// Constructor
@@ -105,6 +106,9 @@ std::string explicitPointerToString(ExplicitPointer<T, D> xpointer) {
105106
return str;
106107
}
107108

109+
/*==============================================================================
110+
Getters : getData
111+
==============================================================================*/
108112
template <class T, class D> D Data<T, D>::getData() {
109113
return mData;
110114
}

include/problem.hpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ 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);
4243
void push(Data<T, D> elt);
4344
Data<T, D> pop();
4445
Data<T, D> top(int k);
@@ -227,7 +228,7 @@ template <class T, class D> void Problem<T, D>::readPush(int iter) {
227228

228229

229230
/*==============================================================================
230-
Stack Functions: run, push, pop, top
231+
Stack Functions: run, push, pop, top, readPush
231232
==============================================================================*/
232233
template <class T, class D> void Problem<T, D>::run() {
233234
initStackIntern();
@@ -275,6 +276,19 @@ template <class T, class D> void Problem<T, D>::run(int limit) {
275276
}
276277
}
277278

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+
278292
template <class T, class D> void Problem<T, D>::push(Data<T, D> elt) {
279293
std::cout << " goinbg to push "<<elt.getData() << std::endl;
280294

0 commit comments

Comments
 (0)