// -*- C++ -*- #ifndef __index_info_h__ #define __index_info_h__ #include #include #include #include #include "vindex_base.h" #include "index_type.h" namespace MultiArrayTools { class IndexInfo; class IndexInfo { public: IndexInfo(IndexInfo&& in) = default; IndexInfo& operator=(IndexInfo&& in) = default; //IndexInfo(const IndexInfo& in) = default; //IndexInfo& operator=(const IndexInfo& in) = default; template IndexInfo(const IndexClass& ind, size_t stepSize = 1); template IndexInfo& reassign(const IndexClass& ind, size_t stepSize = 1); bool operator==(const IndexInfo& in) const; bool operator!=(const IndexInfo& in) const; bool operator<=(const IndexInfo& in) const; bool operator<(const IndexInfo& in) const; bool operator>(const IndexInfo& in) const; bool operator>=(const IndexInfo& in) const; const IndexInfo* getPtr(size_t inum) const; std::intptr_t getPtrNum() const; size_t dim() const; size_t max() const; size_t getStepSize(size_t inum) const; size_t getStepSize() const; IndexType type() const; private: IndexInfo() = default; std::vector mNext; std::intptr_t mPtrNum; size_t mDim; size_t mMax; size_t mStepSize; IndexType mType; }; template IndexInfo::IndexInfo(const IndexClass& ind, size_t stepSize) : mNext(ind.infoVec()), mPtrNum( reinterpret_cast( &ind ) ), mDim(ind.vrange()->dim()), mMax(ind.max()), mStepSize(stepSize), mType(ind.type()) {} template IndexInfo& IndexInfo::reassign(const IndexClass& ind, size_t stepSize) { IndexInfo ii(ind, stepSize); (*this) = std::move(ii); return *this; } } // end namespace MultiArrayTools #endif