CNORXZ
Container with Native Operation Routines and Expressions
Loading...
Searching...
No Matches
slice.cc.h
Go to the documentation of this file.
1// -*- C++ -*-
12#ifndef __cxz_slice_cc_h__
13#define __cxz_slice_cc_h__
14
15#include "slice.h"
16
17namespace CNORXZ
18{
19 /*========================================================+
20 | Implementation of public CSlice member functions |
21 +========================================================*/
22
23 template <typename T>
24 CSlice<T>::CSlice(const RangePtr& range, const CArrayBase<T>* parent,
25 const YFormat& blockSizes, SizeT off) :
26 CArrayBase<T>(range),
27 mCParent(parent),
28 mBlockSizes(blockSizes),
29 mOff(off)
30 {}
31
32 template <typename T>
33 const T* CSlice<T>::data() const
34 {
35 return mCParent->data() + mOff;
36 }
37
38 template <typename T>
40 {
41 return const_iterator(data(),YIndex(AB::mRange, mBlockSizes, 0));
42 }
43
44 template <typename T>
46 {
47 return const_iterator(data(),YIndex(AB::mRange, mBlockSizes, AB::mRange->size()));
48 }
49
50 template <typename T>
51 bool CSlice<T>::isView() const
52 {
53 return true;
54 }
55
56 /*===========================================================+
57 | Implementation of protected CSlice member functions |
58 +===========================================================*/
59
60 template <typename T>
62 {
63 return cbegin().formatIsTrivial();
64 }
65
66 /*=======================================================+
67 | Implementation of public Slice member functions |
68 +=======================================================*/
69
70 template <typename T>
71 Slice<T>::Slice(const RangePtr& range, ArrayBase<T>* parent,
72 const YFormat& blockSizes, SizeT off) :
73 ArrayBase<T>(range),
74 mParent(parent),
75 mBlockSizes(blockSizes),
76 mOff(off)
77 {}
78
79 template <typename T>
81 {
82 return mParent->data() + mOff;
83 }
84
85 template <typename T>
86 const T* Slice<T>::data() const
87 {
88 return mParent->data() + mOff;
89 }
90
91 template <typename T>
93 {
94 return const_iterator(data(),YIndex(AB::mRange, mBlockSizes, 0));
95 }
96
97 template <typename T>
99 {
100 return const_iterator(data(),YIndex(AB::mRange, mBlockSizes, AB::mRange->size()));
101 }
102
103 template <typename T>
104 bool Slice<T>::isView() const
105 {
106 return true;
107 }
108
109 /*==========================================================+
110 | Implementation of protected Slice member functions |
111 +==========================================================*/
112
113 template <typename T>
115 {
116 return cbegin().formatIsTrivial();
117 }
118}
119
120#endif
virtual T * data()=0
virtual const T * data() const =0
virtual const T * data() const override
Definition slice.cc.h:33
virtual bool formatIsTrivial() const override final
Definition slice.cc.h:61
CSlice(const RangePtr &range, const CArrayBase< T > *parent, const YFormat &blockSizes, SizeT off)
Definition slice.cc.h:24
virtual const_iterator cbegin() const override
Definition slice.cc.h:39
virtual const_iterator cend() const override
Definition slice.cc.h:45
virtual bool isView() const override final
Definition slice.cc.h:51
virtual bool isView() const override final
Definition slice.cc.h:104
virtual const_iterator cbegin() const override
Definition slice.cc.h:92
virtual const T * data() const override
Definition slice.cc.h:86
virtual bool formatIsTrivial() const override final
Definition slice.cc.h:114
virtual const_iterator cend() const override
Definition slice.cc.h:98
Slice(const RangePtr &range, ArrayBase< T > *parent, const YFormat &blockSizes, SizeT off)
Definition slice.cc.h:71
uint64_t SizeT
Definition types.h:38
Sptr< RangeBase > RangePtr
Definition types.h:157
Sptr< Range > rangeCast(const RangePtr r)
Slice declarations.