@@ -45,6 +45,7 @@ class CompressedStack: public Stack<T,D>{
4545 Block<T,D> getFirstPartial (int lvl);
4646 Block<T,D> getCompressed ();
4747 ExplicitPointer<T,D> getFirstExplicit ();
48+ std::shared_ptr<Data<T,D>> getExplicitData (int k);
4849
4950 // IO
5051 std::string toString ();
@@ -58,6 +59,7 @@ class CompressedStack: public Stack<T,D>{
5859 void resetBlock (Signature<T,D> sign, int lvl);
5960
6061 // Pop Internals
62+ void popBuffer ();
6163 void reconstruct (Problem<T,D> &problem);
6264 void reconstruct (Problem<T,D> &problem,const Signature<T,D> &sign, int lvl);
6365 void popFirst ();
@@ -143,6 +145,15 @@ ExplicitPointer<T,D> CompressedStack<T,D>::getFirstExplicit(){
143145 return mFirst .mExplicit ;
144146}
145147
148+ template <class T , class D >
149+ std::shared_ptr<Data<T,D>> CompressedStack<T,D>::getExplicitData(int k){
150+ if (k <= (int ) mFirst .mExplicit .size ()) {
151+ return mFirst .mExplicit [k-1 ];
152+ } else {
153+ return mFirst .mSign .mBuffer .getPointer (k - 1 - mFirst .mExplicit .size ());
154+ }
155+ }
156+
146157/* ==============================================================================
147158 IO : toString
148159==============================================================================*/
@@ -424,8 +435,15 @@ void CompressedStack<T,D>::reconstruct(Problem<T,D> &problem, const Signature<T,
424435 mSecond .mExplicit = (*auxStack).getFirstExplicit ();
425436}
426437
438+ template <class T , class D >
439+ void CompressedStack<T,D>::popBuffer(){
440+ std::shared_ptr<Data<T,D>> elt = getExplicitData (mBuffer .mSize );
441+ mBuffer .pop (elt);
442+ }
443+
427444template <class T , class D >
428445Data<T,D> CompressedStack<T,D>::pop(Problem<T,D> &problem){
446+ popBuffer ();
429447 std::shared_ptr<Data<T,D>> elt;
430448 if (mFirst .mExplicit .empty ()) {
431449 if (mSecond .mExplicit .empty ()) {
0 commit comments