// -*- C++ -*- #ifndef __range_base_h__ #define __range_base_h__ #include #include #include #include "base_def.h" namespace MultiArrayTools { enum class RangeType { NIL = 0, ANY = 1, SPACE = 2, MOMENTUM = 3, LORENTZ = 4, SPIN = 5, ENSEMBLE = 6, VALUE_ERROR = 7, DISTANCE = 8 }; class MultiRangeType { public: DEFAULT_MEMBERS(MultiRangeType); MultiRangeType(const RangeType& type); MultiRangeType(const std::vector& multiType); ~MultiRangeType(); MultiRangeType& operator=(const RangeType& type); MultiRangeType& operator=(const std::vector& multiType); MultiRangeType& operator[](size_t num); const MultiRangeType& operator[](size_t num) const; bool multi() const; bool operator==(const MultiRangeType& in) const; bool operator!=(const MultiRangeType& in) const; private: void setType(RangeType type); void setMultiType(const std::vector& multiType); RangeType mType; std::vector* mMultiType; }; class IndefinitRangeBase { public: virtual ~IndefinitRangeBase() = default; virtual size_t size() const = 0; virtual bool isSubRange() const = 0; virtual MultiRangeType type() const = 0; virtual std::shared_ptr indexInstance() const = 0; protected: DEFAULT_MEMBERS(RangeBase); }; template class RangeBase : public IndefinitRangeBase { public: typedef Index IndexType; virtual Index begin() const = 0; virtual Index end() const = 0; virtual RangeBase* base(); virtual bool isSubRange() const override; protected: DEFAULT_MEMBERS(RangeBase); }; //template //auto cross(const Range& r1, const Range& r2) -> /**/; //template //auto cross(const Range1& r1, const Range2& r2) -> /**/; template class SubRangeBase : public RangeBase { public: virtual bool isSubRange() const override; protected: DEFAULT_MEMBERS(SubRangeBase); RangeBase* mBase; std::vector mOccupation; }; } #include "range_base.cc" #endif