#ifndef __rpack_num_h__ #define __rpack_num_h__ #include #include #include #include "ranges/rbase_def.h" #include "ranges/index_base.h" #include "ranges/x_to_string.h" namespace MultiArrayHelper { using namespace MultiArrayTools; template size_t mkTotalDim(); template size_t mkTotalDim(); template struct SubProp { static constexpr size_t ISSTATIC = RangeType::ISSTATIC & SubProp::ISSTATIC; static constexpr size_t SIZE = RangeType::SIZE * SubProp::SIZE; }; template <> struct SubProp { static constexpr size_t ISSTATIC = 1; static constexpr size_t SIZE = 1; }; template inline size_t getStepSize(const Index& ii, std::intptr_t j); template inline void resolveSetRange(std::shared_ptr& rp, const vector >& orig, size_t origpos, size_t size); template inline void setRangeToVec(vector >& v, std::shared_ptr r); template struct RPackNum { template static void initBlockSizes(std::array& bs, std::tuple...>& ip); template static inline void pp(std::tuple...>& ip); template static inline int pp(std::tuple...>& ip, std::array& bs, std::intptr_t idxPtrNum); template static inline void mm(std::tuple...>& ip); // !!!! template static inline int mm(std::tuple...>& ip, std::array& bs, std::intptr_t idxPtrNum); template static size_t getSize(const RangeTuple& rt); template static void getMetaPos(MetaType& target, const IndexPack& source); template static void setMeta(IndexPack& target, const MetaType& source); template inline static std::shared_ptr getSub(const SpaceClass& space, size_t num); template static void setIndexPack(IndexPack& iPack, size_t pos); template static void construct(std::tuple...>& ip, const MRange& range); template static void copyInst(std::tuple...>& ip, const IndexType& ind); template static void copyIndex(std::tuple...>& ip, const IndexType& ind); template static inline size_t makePos(const std::tuple...>& iPtrTup); template static inline size_t makePos(const std::tuple...>& iPtrTup, const std::array& blockSize); template static void swapIndices(Pack& ipack, const std::shared_ptr& nind, const std::shared_ptr&... ninds); template static void swapIndices(Pack& ipack, const std::tuple...>& ninds); template static size_t blockSize(const std::tuple...>& pack); template static inline void RangesToVec(const std::tuple...>& rst, vector >& v); template static inline void RangesToVec(const std::tuple...>& rst, vector& v); template static void printIndex(const std::tuple...>& ip, size_t offset); template static void checkDefaultable(); template static auto mkFor(size_t step, const IndexPack& ipack, const BlockArray& ba, Exprs exs) -> decltype(std::get::value-N-1>(ipack) ->ifor( 0, RPackNum::mkFor(step, ipack, ba, exs) ) ); template static auto mkForh(size_t step, const IndexPack& ipack, const BlockArray& ba, Exprs exs) -> decltype(std::get::value-N-1>(ipack) ->iforh( 0, RPackNum::mkForh(step, ipack, ba, exs) ) ); template static auto mkPFor(size_t step, const IndexPack& ipack, const BlockArray& ba, Exprs exs) -> decltype(std::get::value-N-1>(ipack) ->pifor( 0, RPackNum::mkFor(step, ipack, ba, exs) ) ); template static inline void getStepSizeX(const Index& ii, std::intptr_t j, size_t& ss, size_t& sx); template static inline void resolveRangeType(const vector >& orig, RangeTuple& rtp, size_t off, size_t size, SIZET... sizes); template static inline bool checkIfCreated(const std::tuple...>& p, const vector& a); template static inline std::string getStringMeta(const MIndex& mi); template static inline void fillRangeDataVec(vector& out, const std::tuple...>& tp); template static inline bool compareSpaceTypes(const vector >& rbvec); template static inline void setSpace(const vector >& rbvec, std::tuple...>& stp); template static inline size_t getCMeta(MetaType* xtarget, size_t pos, const std::tuple...>& stp, size_t off); template static inline size_t getCMetaSize(const std::tuple...>& stp); template static inline void getTypeNum(vector& res, const std::tuple...>& stp); }; template<> struct RPackNum<0> { template static void initBlockSizes(std::array& bs, std::tuple...>& ip); template static inline void pp(std::tuple...>& ip); template static inline int pp(std::tuple...>& ip, std::array& bs, std::intptr_t idxPtrNum); template static inline void mm(std::tuple...>& ip); template static inline int mm(std::tuple...>& ip, std::array& bs, std::intptr_t idxPtrNum); template static size_t getSize(const RangeTuple& rt); template static void getMetaPos(MetaType& target, const IndexPack& source); template static void setMeta(IndexPack& target, const MetaType& source); template inline static std::shared_ptr getSub(const SpaceClass& space, size_t num); template static void setIndexPack(IndexPack& iPack, size_t pos); template static void construct(std::tuple...>& ip, const MRange& range); template static void copyInst(std::tuple...>& ip, const IndexType& ind); template static void copyIndex(std::tuple...>& ip, const IndexType& ind); template static inline size_t makePos(const std::tuple...>& iPtrTup); template static inline size_t makePos(const std::tuple...>& iPtrTup, const std::array& blockSize); template static void swapIndices(Pack& ipack, const std::shared_ptr& nind); template static void swapIndices(Pack& ipack, const std::tuple...>& ninds); template static size_t blockSize(const std::tuple...>& pack); template static inline void RangesToVec(const std::tuple...>& rst, vector& v); template static inline void RangesToVec(const std::tuple...>& rst, vector >& v); template static void printIndex(const std::tuple...>& ip, size_t offset); template static void checkDefaultable(); template static auto mkFor(size_t step, const IndexPack& ipack, const BlockArray& ba, Exprs exs) -> decltype(std::get::value-1>(ipack) ->ifor(0,exs) ); template static auto mkForh(size_t step, const IndexPack& ipack, const BlockArray& ba, Exprs exs) -> decltype(std::get::value-1>(ipack) ->iforh(0,exs) ); template static auto mkPFor(size_t step, const IndexPack& ipack, const BlockArray& ba, Exprs exs) -> decltype(std::get::value-1>(ipack) ->pifor(0,exs) ); template static inline void getStepSizeX(const Index& ii, std::intptr_t j, size_t& ss, size_t& sx); template static inline void resolveRangeType(const vector >& orig, RangeTuple& rtp, size_t off, size_t size); template static inline bool checkIfCreated(const std::tuple...>& p, const vector& a); template static inline std::string getStringMeta(const MIndex& mi); template static inline void fillRangeDataVec(vector& out, const std::tuple...>& tp); template static inline bool compareSpaceTypes(const vector >& rbvec); template static inline void setSpace(const vector >& rbvec, std::tuple...>& stp); template static inline size_t getCMeta(MetaType* xtarget, size_t pos, const std::tuple...>& stp, size_t off); template static inline size_t getCMetaSize(const std::tuple...>& stp); template static inline void getTypeNum(vector& res, const std::tuple...>& stp); }; template struct SSG { template static inline size_t getStepSize(const Index& ii, std::intptr_t j); }; template <> struct SSG { template static inline size_t getStepSize(const Index& ii, std::intptr_t j); }; } // end namespace MultiArrayHelper //#include "rpack_num.cc.h" #endif