From 50985caf6228c8bf2e10584ffb67eca8dd47877c Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Mon, 13 Mar 2017 11:06:44 +0100 Subject: [PATCH] some changes reg index org --- src/index_base.cc | 10 ++++++---- src/index_base.h | 14 ++++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/index_base.cc b/src/index_base.cc index ad85584..6877dff 100644 --- a/src/index_base.cc +++ b/src/index_base.cc @@ -66,11 +66,11 @@ namespace MultiArrayTools void IndefinitIndexBase::freeLinked() { if(mLinked != nullptr){ - mLinked->freeLinked(); + //mLinked->freeLinked(); mLinked = nullptr; } if(mSoftLinked != nullptr){ - mSoftLinked->freeLinked(); + //mSoftLinked->freeLinked(); mSoftLinked = nullptr; } } @@ -104,11 +104,12 @@ namespace MultiArrayTools return true; } - void IndefinitIndexBase::evalMajor() + void IndefinitIndexBase::evalMajor(size_t stepSize, int num) { //assert(not virt()); if(not master()){ - mMajor->eval(); + //mMajor->eval(); + mMajor->setPos(static_cast( mMajor->pos() ) + num, this) } } @@ -122,6 +123,7 @@ namespace MultiArrayTools { //assert(not virt()); mMajor = major; + mMajorStepSize = mMajor->giveSubStepSize(this); } /************** diff --git a/src/index_base.h b/src/index_base.h index f230d83..9655d5d 100644 --- a/src/index_base.h +++ b/src/index_base.h @@ -45,27 +45,33 @@ namespace MultiArrayTools virtual void linkTo(IndefinitIndexBase* target) = 0; //virtual IndefinitIndexBase* getLinked(const std::string& name) = 0; - + + // include sub-index update routine virtual void setPos(size_t pos); + // does NOT include sub-index update routine !! + virtual void setPos(size_t pos, IndefinitIndexBase* subIndex) = 0; + virtual size_t max() const = 0; virtual size_t outOfRange() const; virtual bool toNull() const; virtual void eval() = 0; - virtual void evalMajor(); + virtual void evalMajor(size_t stepSize, int num); virtual bool master(); virtual void subOrd(IndefinitIndexBase* major); - + virtual size_t giveSubStepSize(IndefinitIndexBase* subIndex) = 0; + //virtual bool virt() const { return true; } protected: std::string mName; size_t mPos; - + size_t mMajorStep; + IndefinitIndexBase* mLinked = nullptr; IndefinitIndexBase* mMajor = nullptr; IndefinitIndexBase* mSoftLinked = nullptr;