CNORXZ
Container with Native Operation Routines and Expressions
Loading...
Searching...
No Matches
crange.h
Go to the documentation of this file.
1// -*- C++ -*-
12#ifndef __cxz_crange_h__
13#define __cxz_crange_h__
14
15#include "base/base.h"
16#include "ranges/index_base.h"
17#include "ranges/range_base.h"
18#include "xpr/xpr.h"
19
20namespace CNORXZ
21{
25 class CIndex : public IndexInterface<CIndex,SizeT>
26 {
27 public:
28
31 typedef SizeT MetaType;
32
40 CIndex(const RangePtr& range, SizeT pos = 0);
41
44
47
50
52 CIndex operator+(Int n) const;
53
55 CIndex operator-(Int n) const;
56
58 SizeT operator-(const CIndex& i) const;
59
62
65
67 SizeT lex() const;
68
70 UPos pmax() const;
71
73 UPos lmax() const;
74
76 IndexId<0> id() const;
77
79 SizeT operator*() const;
80
82 SizeT dim() const;
83
85 Sptr<RangeType> range() const;
86
88 template <SizeT I>
89 decltype(auto) stepSize(const IndexId<I>& id) const;
90
92 String stringMeta() const;
93
95 SizeT meta() const;
96
98 CIndex& at(const SizeT& metaPos);
99
101 RangePtr prange(const CIndex& last) const;
102
104 SizeT deepFormat() const;
105
107 SizeT deepMax() const;
108
110 CIndex& reformat(const Vector<SizeT>& f, const Vector<SizeT>& s);
111
113 template <class Xpr, class F = NoF>
114 decltype(auto) ifor(const Xpr& xpr, F&& f) const;
115
117 bool formatIsTrivial() const;
118
121
122 private:
123 Sptr<RangeType> mRangePtr;
124 };
125
130 template <class I>
131 decltype(auto) operator*(const Sptr<CIndex>& a, const Sptr<I>& b);
132
137 {
138 public:
139 typedef CRange oType;
140
144 CRangeFactory(SizeT size);
145
151
152 protected:
153 virtual void make() override;
154
155 private:
156 SizeT mSize;
157 RangePtr mRef;
158 };
159
211
216 template <>
218 {
220 static Sptr<CRange> func(const RangePtr& r);
221 };
222
227 template <>
229 {
230 static constexpr bool value = true;
231 };
232}
233
234#endif
basic headers
decltype(auto) ifor(const Xpr &xpr, F &&f) const
Definition crange.cc.h:32
CIndex & operator=(SizeT lexpos)
Definition crange.cc:26
COpRoot< SizeT, CIndex > xpr(const Sptr< CIndex > &_this) const
Definition crange.cc:122
CIndex & operator+=(Int n)
Definition crange.cc:59
CIndex & reformat(const Vector< SizeT > &f, const Vector< SizeT > &s)
Definition crange.cc:157
CIndex & operator++()
Definition crange.cc:32
SizeT MetaType
Definition crange.h:31
SizeT meta() const
Definition crange.cc:111
CIndex & operator-=(Int n)
Definition crange.cc:65
SizeT deepMax() const
Definition crange.cc:152
SizeT lex() const
Definition crange.cc:71
SizeT dim() const
Definition crange.cc:96
INDEX_RANDOM_ACCESS_ITERATOR_DEFS(MetaType)
CIndex operator-(Int n) const
Definition crange.cc:49
IndexId< 0 > id() const
Definition crange.cc:86
IndexInterface< CIndex, SizeT > IB
Definition crange.h:29
RangePtr prange(const CIndex &last) const
Definition crange.cc:135
CIndex operator+(Int n) const
Definition crange.cc:44
bool formatIsTrivial() const
Definition crange.cc:166
CIndex & operator--()
Definition crange.cc:38
decltype(auto) stepSize(const IndexId< I > &id) const
Definition crange.cc.h:21
Sptr< RangeType > range() const
Definition crange.cc:101
String stringMeta() const
Definition crange.cc:106
UPos pmax() const
Definition crange.cc:81
CIndex & at(const SizeT &metaPos)
Definition crange.cc:116
CIndex(const RangePtr &range, SizeT pos=0)
Definition crange.cc:22
CRange RangeType
Definition crange.h:30
SizeT operator*() const
Definition crange.cc:91
UPos lmax() const
Definition crange.cc:76
SizeT deepFormat() const
Definition crange.cc:147
DEFAULT_MEMBERS(CIndex)
CRangeFactory(SizeT size)
Definition crange.cc:175
virtual void make() override
Definition crange.cc:181
CRangeFactory FType
Definition crange.h:172
SizeT get(SizeT pos) const
Definition crange.cc:200
SizeT mSize
Definition crange.h:207
virtual const TypeInfo & type() const override final
Definition crange.cc:225
virtual RangePtr extend(const RangePtr &r) const override final
Definition crange.cc:235
SizeT MetaType
Definition crange.h:171
virtual Vector< Uuid > key() const override final
Definition crange.cc:241
virtual const TypeInfo & metaType() const override final
Definition crange.cc:230
SERIALIZATION_FUNCTIONS_NOPUB
Definition crange.h:209
virtual String stringMeta(SizeT pos) const override final
Definition crange.cc:220
virtual SizeT dim() const override final
Definition crange.cc:215
CIndex IndexType
Definition crange.h:170
virtual SizeT size() const override final
Definition crange.cc:210
RangeBase RB
Definition crange.h:169
friend CRangeFactory
Definition crange.h:174
SizeT getMeta(SizeT metaPos) const
Definition crange.cc:205
Index base declaration.
std::string String
Definition types.h:42
std::type_info TypeInfo
Definition types.h:71
uint64_t SizeT
Definition types.h:38
Sptr< RangeBase > RangePtr
Definition types.h:157
std::vector< T, Allocator< T > > Vector
Definition types.h:310
int32_t Int
Definition types.h:36
Sptr< Range > rangeCast(const RangePtr r)
std::shared_ptr< T > Sptr
Definition types.h:48
RangeBase declaration.
Xpression main header.