#ifndef __cxz_darray_base_h__ #define __cxz_darray_base_h__ #include #include #include #include #include "base_def.h" #include "mbase_def.h" #include "ranges/rheader.h" namespace CNORXZ { template class DArrayBase { public: typedef T value_type; typedef DConstContainerIndex const_iterator; protected: RangePtr mRange; const_iterator mIt; bool mInit = false; public: DArrayBase(const RangePtr& range); DEFAULT_MEMBERS(DArrayBase); virtual ~DArrayBase() = default; template const value_type& operator[](const IndexInterface& i) const; template const value_type& at(const IndexInterface& i) const; template DArrayBase sl(const IndexInterface& i) const; virtual const T* data() const = 0; virtual size_t size() const; virtual RangePtr range() const; virtual const_iterator begin() const; virtual const_iterator end() const; virtual const_iterator cbegin() const = 0; virtual const_iterator cend() const = 0; virtual bool isView() const = 0; virtual bool isInit() const; template ConstOperationRoot operator()(const IndexPtr& i) const; }; template class MDArrayBase : public DArrayBase { public: typedef DArrayBase DAB; typedef DAB::value_type value_type; typedef DAB::const_iterator const_iterator; typedef DContainerIndex iterator; using DAB::operator[]; using DAB::at; using DAB::data; using DAB::begin; using DAB::end; using DAB::cbegin; using DAB::cend; using DAB::operator(); MDArrayBase(const RangePtr& range); DEFAULT_MEMBERS(MDArrayBase); template value_type& operator[](const IndexInterface& i); template value_type& at(const IndexInterface& i); template DArrayBase sl(const IndexInterface& i); virtual T* data() = 0; virtual iterator begin(); virtual iterator end(); template OperationRoot operator()(const IndexPtr& i); }; } #endif