// -*- C++ -*- #ifndef __cxz_mrange_h__ #define __cxz_mrange_h__ #include "base/base.h" #include "range_base.h" #include "index_base.h" #include "xpr/xpr.h" namespace CNORXZ { template class MIndex : public IndexInterface, Tuple > { public: typedef IndexInterface, Tuple > IB; typedef Tuple...> IndexPack; typedef Tuple MetaType; typedef MRange RangeType; // NO DEFAULT HERE !!! // ( have to assign sub-indices (ptr!) correctly ) MIndex(const MIndex& i); MIndex(MIndex&& i); MIndex& operator=(const MIndex& i); MIndex& operator=(MIndex&& i); MIndex(const RangePtr& range, SizeT pos = 0); // replace sub-index instances; only use if you know what you are doing! MIndex& operator()(Sptr&... indices); MIndex& operator()(const MIndex& indices); const IndexPack& pack() const { return mIPack; } const auto& getBlockSizes() const { return mBlockSizes; } MIndex& operator=(SizeT pos); MIndex& operator++(); MIndex& operator--(); MIndex operator+(Int n) const; MIndex operator-(Int n) const; MIndex& operator+=(Int n); MIndex& operator-=(Int n); SizeT max() const; decltype(auto) id() const; SizeT operator*() const; SizeT operator->() const; int pp(PtrId idxPtrNum); int mm(PtrId idxPtrNum); SizeT dim(); Sptr range(); template decltype(auto) stepSize(const IndexId& id) const; String stringMeta() const; MetaType meta() const; MIndex& at(const MetaType& metaPos); template auto ifor(const PosT& step, const Xpr& xpr) const; private: MIndex() = default; IndexPack mIPack; Arr mBlockSizes; Sptr mRange; }; // NOT THREAD SAVE template class MRangeFactory : public RangeFactoryBase { public: MRangeFactory() = delete; MRangeFactory(const Sptr&... rs); MRangeFactory(const Tuple...>& rs); private: virtual void make() override final; Tuple...> mRs; }; template class MRange : public RangeInterface > { public: typedef RangeBase RB; typedef MIndex IndexType; typedef Tuple MetaType; const Space& space() const; SizeT getMeta(const MetaType& metaPos) const; virtual Sptr sub(SizeT num) const override; virtual SizeT dim() const final; virtual SizeT size() const final; virtual String stringMeta(SizeT pos) const final; friend MRangeFactory; protected: MRange() = delete; MRange(const MRange& in) = delete; MRange& operator=(const MRange& in) = delete; Tuple...> mRs; }; } #endif