some changes reg index org

This commit is contained in:
Christian Zimmermann 2017-03-13 11:06:44 +01:00
parent d3dbdbb865
commit 50985caf62
2 changed files with 16 additions and 8 deletions

View file

@ -66,11 +66,11 @@ namespace MultiArrayTools
void IndefinitIndexBase::freeLinked() void IndefinitIndexBase::freeLinked()
{ {
if(mLinked != nullptr){ if(mLinked != nullptr){
mLinked->freeLinked(); //mLinked->freeLinked();
mLinked = nullptr; mLinked = nullptr;
} }
if(mSoftLinked != nullptr){ if(mSoftLinked != nullptr){
mSoftLinked->freeLinked(); //mSoftLinked->freeLinked();
mSoftLinked = nullptr; mSoftLinked = nullptr;
} }
} }
@ -104,11 +104,12 @@ namespace MultiArrayTools
return true; return true;
} }
void IndefinitIndexBase::evalMajor() void IndefinitIndexBase::evalMajor(size_t stepSize, int num)
{ {
//assert(not virt()); //assert(not virt());
if(not master()){ if(not master()){
mMajor->eval(); //mMajor->eval();
mMajor->setPos(static_cast<int>( mMajor->pos() ) + num, this)
} }
} }
@ -122,6 +123,7 @@ namespace MultiArrayTools
{ {
//assert(not virt()); //assert(not virt());
mMajor = major; mMajor = major;
mMajorStepSize = mMajor->giveSubStepSize(this);
} }
/************** /**************

View file

@ -45,27 +45,33 @@ namespace MultiArrayTools
virtual void linkTo(IndefinitIndexBase* target) = 0; virtual void linkTo(IndefinitIndexBase* target) = 0;
//virtual IndefinitIndexBase* getLinked(const std::string& name) = 0; //virtual IndefinitIndexBase* getLinked(const std::string& name) = 0;
// include sub-index update routine
virtual void setPos(size_t pos); 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 max() const = 0;
virtual size_t outOfRange() const; virtual size_t outOfRange() const;
virtual bool toNull() const; virtual bool toNull() const;
virtual void eval() = 0; virtual void eval() = 0;
virtual void evalMajor(); virtual void evalMajor(size_t stepSize, int num);
virtual bool master(); virtual bool master();
virtual void subOrd(IndefinitIndexBase* major); virtual void subOrd(IndefinitIndexBase* major);
virtual size_t giveSubStepSize(IndefinitIndexBase* subIndex) = 0;
//virtual bool virt() const { return true; } //virtual bool virt() const { return true; }
protected: protected:
std::string mName; std::string mName;
size_t mPos; size_t mPos;
size_t mMajorStep;
IndefinitIndexBase* mLinked = nullptr; IndefinitIndexBase* mLinked = nullptr;
IndefinitIndexBase* mMajor = nullptr; IndefinitIndexBase* mMajor = nullptr;
IndefinitIndexBase* mSoftLinked = nullptr; IndefinitIndexBase* mSoftLinked = nullptr;