CNORXZ
Container with Native Operation Routines and Expressions
Loading...
Searching...
No Matches
dindex.h
Go to the documentation of this file.
1// -*- C++ -*-
12#ifndef __cxz_dindex_h__
13#define __cxz_dindex_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{
25 class DIndex : public IndexInterface<DIndex,DType>
26 {
27 public:
29 typedef DType MetaType;
31
37 DIndex(const DIndex& i);
38
42 DIndex(DIndex&& i);
43
47 DIndex& operator=(const DIndex& i);
48
53
57 DIndex(const XIndexPtr& i);
58
63 DIndex(const RangePtr& r, SizeT lexpos = 0);
64
68 template <class Index, typename Meta>
70
73
76
79
81 DIndex operator+(Int n) const;
82
84 DIndex operator-(Int n) const;
85
87 SizeT operator-(const DIndex& i) const;
88
91
94
96 SizeT lex() const;
97
99 UPos pmax() const;
100
102 UPos lmax() const;
103
105 IndexId<0> id() const;
106
108 DType operator*() const;
109
111 SizeT dim() const;
112
114 RangePtr range() const;
115
117 UPos stepSize(const IndexId<0>& id) const;
118
120 String stringMeta() const;
121
123 DType meta() const;
124
126 DIndex& at(const DType& meta);
127
129 RangePtr prange(const DIndex& end) const;
130
133
135 Vector<SizeT> deepMax() const;
136
138 DIndex& reformat(const Vector<SizeT>& f, const Vector<SizeT>& s);
139
141 template <class Xpr, class F>
142 decltype(auto) ifor(const Xpr& xpr, F&& f) const;
143
145 bool formatIsTrivial() const;
146
150 const XIndexPtr& xptr() const;
151
152 private:
153 XIndexPtr mI;
154 };
155
160 template <class I>
161 decltype(auto) operator*(const Sptr<DIndex>& a, const Sptr<I>& b);
162
166 template <>
168 { static constexpr bool value = true; };
169
178 template <class I>
179 I indexAs(const DIndex& i);
180}
181
182#endif
basic headers
String stringMeta() const
Definition dindex.cc:163
Vector< SizeT > deepFormat() const
Definition dindex.cc:185
DIndex & at(const DType &meta)
Definition dindex.cc:173
IndexId< 0 > id() const
Definition dindex.cc:122
DIndex & operator=(const DIndex &i)
Definition dindex.cc:28
RangeBase RangeType
Definition dindex.h:30
DIndex & operator--()
Definition dindex.cc:71
RangePtr range() const
Definition dindex.cc:137
SizeT dim() const
Definition dindex.cc:132
UPos pmax() const
Definition dindex.cc:112
const XIndexPtr & xptr() const
Definition dindex.cc:206
bool formatIsTrivial() const
Definition dindex.cc:201
RangePtr prange(const DIndex &end) const
Definition dindex.cc:180
DIndex(const DIndex &i)
Definition dindex.cc:16
DType meta() const
Definition dindex.cc:168
DIndex & operator++()
Definition dindex.cc:64
UPos stepSize(const IndexId< 0 > &id) const
Definition dindex.cc:142
DIndex & operator-=(Int n)
Definition dindex.cc:100
DType operator*() const
Definition dindex.cc:127
IndexInterface< DIndex, DType > IB
Definition dindex.h:28
DIndex operator-(Int n) const
Definition dindex.cc:83
DIndex & operator+=(Int n)
Definition dindex.cc:93
DType MetaType
Definition dindex.h:29
Vector< SizeT > deepMax() const
Definition dindex.cc:190
UPos lmax() const
Definition dindex.cc:117
SizeT lex() const
Definition dindex.cc:107
DEFAULT_C(DIndex)
DIndex operator+(Int n) const
Definition dindex.cc:78
DIndex & reformat(const Vector< SizeT > &f, const Vector< SizeT > &s)
Definition dindex.cc:195
decltype(auto) ifor(const Xpr &xpr, F &&f) const
Definition dindex.cc.h:26
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
I indexAs(const DIndex &i)
Definition dindex.cc.h:49
int32_t Int
Definition types.h:36
decltype(auto) xpr(const Sptr< I > &i)
Sptr< Range > rangeCast(const RangePtr r)
std::shared_ptr< T > Sptr
Definition types.h:48
RangeBase declaration.
static constexpr bool value
Xpression main header.