#ifndef __cxz_array_base_h__ #define __cxz_array_base_h__ #include #include #include #include #include "base/base.h" #include "aindex.h" #include "operation/op_types.h" namespace CNORXZ { template class CArrayBase { public: typedef AIndex const_iterator; protected: RangePtr mRange; template YIndex mkSliceIndex(const YIndex& yi, const Index& i) const; template XIndexPtr mkSliceIndex(const XIndexPtr& xi, const Sptr& i) const; public: CArrayBase(const RangePtr& range); DEFAULT_MEMBERS(CArrayBase); virtual ~CArrayBase() = default; template const T& operator[](const IndexInterface& i) const; template const T& at(const IndexInterface& i) const; template Sptr> sl(const IndexInterface& i) const; virtual const T* data() const = 0; virtual SizeT 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; template COpRoot operator()(const IndexPtr& i) const; template COpRoot operator()(const LIndex& i) const; template COpRoot op(const IndexPtr& i) const; template COpRoot op(const LIndex& i) const; }; template class ArrayBase : public CArrayBase { public: typedef CArrayBase CAB; typedef typename CAB::const_iterator const_iterator; typedef BIndex iterator; using CAB::operator[]; using CAB::at; using CAB::data; using CAB::begin; using CAB::end; using CAB::cbegin; using CAB::cend; //using CAB::operator(); ArrayBase(const RangePtr& range); DEFAULT_MEMBERS(ArrayBase); template T& operator[](const IndexInterface& i); template T& at(const IndexInterface& i); template Sptr> sl(const IndexInterface& i); virtual T* data() = 0; virtual iterator begin(); virtual iterator end(); template OpRoot operator()(const IndexPtr& i) const; template OpRoot operator()(const LIndex& i) const; template OpRoot op(const IndexPtr& i) const; template OpRoot op(const LIndex& i) const; }; } #endif