CNORXZ
Container with Native Operation Routines and Expressions
Loading...
Searching...
No Matches
xindex.h
Go to the documentation of this file.
1// -*- C++ -*-
12#ifndef __cxz_xindex_h__
13#define __cxz_xindex_h__
14
15#include "base/base.h"
16#include "range_base.h"
17#include "index_base.h"
18#include "xpr/xpr.h"
19
20namespace CNORXZ
21{
29 {
30 public:
31
35 virtual ~XIndexBase() = default;
36
40 virtual XIndexPtr copy() const = 0;
41
45 virtual SizeT pos() const = 0;
46
49
51 virtual XIndexBase& operator++() = 0;
52
54 virtual XIndexBase& operator--() = 0;
55
57 virtual XIndexPtr operator+(Int n) const = 0;
58
60 virtual XIndexPtr operator-(Int n) const = 0;
61
63 virtual SizeT operator-(const XIndexBase& i) const = 0;
64
66 virtual XIndexBase& operator+=(Int n) = 0;
67
69 virtual XIndexBase& operator-=(Int n) = 0;
70
72 virtual SizeT lex() const = 0;
73
75 virtual UPos pmax() const = 0;
76
78 virtual UPos lmax() const = 0;
79
81 virtual IndexId<0> id() const = 0;
82
84 virtual DType operator*() const = 0;
85
87 virtual SizeT dim() const = 0;
88
90 virtual RangePtr range() const = 0;
91
93 virtual UPos stepSize(const IndexId<0>& id) const = 0;
94
96 virtual String stringMeta() const = 0;
97
99 virtual DType meta() const = 0;
100
102 virtual XIndexBase& at(const DType& meta) = 0;
103
105 virtual RangePtr prange(const XIndexPtr& last) const = 0;
106
108 virtual Vector<SizeT> deepFormat() const = 0;
109
111 virtual Vector<SizeT> deepMax() const = 0;
112
114 virtual XIndexBase& reformat(const Vector<SizeT>& f, const Vector<SizeT>& s) = 0;
115
117 virtual DXpr<None> ifor(const DXpr<None>& xpr, NoF&& f) const = 0;
118
120 virtual bool formatIsTrivial() const = 0;
121 };
122
128 template <class Index, typename Meta>
129 class XIndex : public XIndexBase
130 {
131 public:
132
138 XIndex(const XIndex& i);
139
143
148
152
157
162
165
174
179
181
194
198 Index& get();
199
203 const Index& get() const;
204
205 private:
206 IndexPtr<Index,Meta> mI;
207
208 };
209
215 template <>
217 { static constexpr bool value = true; };
218
223 template <class Index>
224 inline XIndexPtr xindexPtr(const Sptr<Index>& i);
225
232 template <>
234
235}
236
237#endif
basic headers
virtual XIndexPtr operator-(Int n) const =0
virtual String stringMeta() const =0
DEFAULT_MEMBERS(XIndexBase)
virtual UPos lmax() const =0
virtual XIndexBase & reformat(const Vector< SizeT > &f, const Vector< SizeT > &s)=0
virtual SizeT dim() const =0
virtual IndexId< 0 > id() const =0
virtual XIndexBase & operator--()=0
virtual Vector< SizeT > deepFormat() const =0
virtual RangePtr range() const =0
virtual SizeT lex() const =0
virtual Vector< SizeT > deepMax() const =0
virtual XIndexBase & operator++()=0
virtual XIndexBase & operator+=(Int n)=0
virtual bool formatIsTrivial() const =0
virtual XIndexPtr operator+(Int n) const =0
virtual DType operator*() const =0
virtual XIndexBase & operator-=(Int n)=0
virtual DXpr< None > ifor(const DXpr< None > &xpr, NoF &&f) const =0
virtual RangePtr prange(const XIndexPtr &last) const =0
virtual XIndexBase & operator=(SizeT lexpos)=0
virtual XIndexPtr copy() const =0
virtual SizeT operator-(const XIndexBase &i) const =0
virtual DType meta() const =0
virtual XIndexBase & at(const DType &meta)=0
virtual SizeT pos() const =0
virtual ~XIndexBase()=default
virtual UPos stepSize(const IndexId< 0 > &id) const =0
virtual UPos pmax() const =0
virtual UPos pmax() const override final
Definition xindex.cc.h:107
virtual UPos stepSize(const IndexId< 0 > &id) const override final
Definition xindex.cc.h:143
Index & get()
Definition xindex.cc.h:205
virtual UPos lmax() const override final
Definition xindex.cc.h:113
virtual DType meta() const override final
Definition xindex.cc.h:180
virtual SizeT lex() const override final
Definition xindex.cc.h:101
virtual String stringMeta() const override final
Definition xindex.cc.h:174
virtual Vector< SizeT > deepMax() const override final
Definition xindex.cc.h:161
XIndex & operator=(const XIndex &i)
virtual DXpr< None > ifor(const DXpr< None > &xpr, NoF &&f) const override final
Definition xindex.cc.h:193
virtual RangePtr prange(const XIndexPtr &last) const override final
Definition xindex.cc.h:149
virtual SizeT pos() const override final
Definition xindex.cc.h:39
virtual XIndex & reformat(const Vector< SizeT > &f, const Vector< SizeT > &s) override final
Definition xindex.cc.h:167
virtual SizeT dim() const override final
Definition xindex.cc.h:131
virtual XIndexPtr copy() const override final
Definition xindex.cc.h:33
XIndex(const XIndex &i)
DEFAULT_C(XIndex)
virtual XIndexBase & at(const DType &meta) override final
Definition xindex.cc.h:186
virtual RangePtr range() const override final
Definition xindex.cc.h:137
virtual bool formatIsTrivial() const override final
Definition xindex.cc.h:199
XIndex(XIndex &&i)
virtual Vector< SizeT > deepFormat() const override final
Definition xindex.cc.h:155
XIndex & operator=(XIndex &&i)
Index base declaration.
std::string String
Definition types.h:42
uint64_t SizeT
Definition types.h:38
Sptr< RangeBase > RangePtr
Definition types.h:157
Sptr< XIndexBase > XIndexPtr
Definition types.h:216
std::vector< T, Allocator< T > > Vector
Definition types.h:310
int32_t Int
Definition types.h:36
decltype(auto) xpr(const Sptr< I > &i)
Sptr< Range > rangeCast(const RangePtr r)
XIndexPtr xindexPtr(const Sptr< Index > &i)
Definition xindex.cc.h:217
XIndexPtr xindexPtr< XIndexBase >(const Sptr< XIndexBase > &i)
Definition xindex.cc.h:225
Sptr< IndexInterface< I, MetaType > > IndexPtr
Definition types.h:164
std::shared_ptr< T > Sptr
Definition types.h:48
RangeBase declaration.
Xpression main header.