30 template <u
int32_t noOfDims,
typename ElementType>
45 template <u
int32_t noOfDims,
typename ElementType>
58 template <u
int32_t noOfDims,
typename ElementType>
73 template <u
int32_t noOfDims,
typename ElementType>
76 assert(uIndex<m_pDimensions[0]);
78 SubArray<noOfDims-1, ElementType>(&m_pElements[uIndex*m_pOffsets[0]],
79 m_pDimensions+1, m_pOffsets+1);
91 template <u
int32_t noOfDims,
typename ElementType>
94 assert(uIndex<m_pDimensions[0]);
96 SubArray<noOfDims-1, ElementType>(&m_pElements[uIndex*m_pOffsets[0]],
97 m_pDimensions+1, m_pOffsets+1);
104 template <u
int32_t noOfDims,
typename ElementType>
107 return m_uNoOfElements;
118 template <u
int32_t noOfDims,
typename ElementType>
130 template <u
int32_t noOfDims,
typename ElementType>
135 m_pDimensions =
new uint32_t[noOfDims];
136 m_pOffsets =
new uint32_t[noOfDims];
140 for (uint32_t i = 0; i<noOfDims; i++)
142 assert(pDimensions[i] != 0);
144 m_uNoOfElements *= pDimensions[i];
145 m_pDimensions[i] = pDimensions[i];
147 for (uint32_t k=noOfDims-1; k>i; k--)
149 m_pOffsets[i] *= pDimensions[k];
153 m_pElements =
new ElementType[m_uNoOfElements];
162 template <u
int32_t noOfDims,
typename ElementType>
167 uint32_t* m_pTempDimensions = m_pDimensions;
168 uint32_t* m_pTempOffsets = m_pOffsets;
169 uint32_t m_uTempNoOfElements = m_uNoOfElements;
170 ElementType* m_pTempElements = m_pElements;
172 m_pDimensions = rhs.m_pDimensions;
173 m_pOffsets = rhs.m_pOffsets;
174 m_uNoOfElements = rhs.m_uNoOfElements;
175 m_pElements = rhs.m_pElements;
177 rhs.m_pDimensions = m_pTempDimensions;
178 rhs.m_pOffsets = m_pTempOffsets;
179 rhs.m_uNoOfElements = m_uTempNoOfElements;
180 rhs.m_pElements = m_pTempElements;
186 template <u
int32_t noOfDims,
typename ElementType>
189 assert(uDimension < noOfDims);
190 return m_pDimensions[uDimension];
193 template <u
int32_t noOfDims,
typename ElementType>
204 template <u
int32_t noOfDims,
typename ElementType>
205 Array<noOfDims, ElementType>& Array<noOfDims, ElementType>::operator=(
const Array<noOfDims, ElementType>& rhs)
213 template <u
int32_t noOfDims,
typename ElementType>
214 void Array<noOfDims, ElementType>::deallocate(
void)
216 delete[] m_pDimensions;
220 delete[] m_pElements;
230 template <
typename ElementType>
237 template <
typename ElementType>
245 template <
typename ElementType>
251 template <
typename ElementType>
254 assert(uIndex<m_pDimensions[0]);
255 return m_pElements[uIndex];
258 template <
typename ElementType>
261 assert(uIndex<m_pDimensions[0]);
262 return m_pElements[uIndex];
265 template <
typename ElementType>
268 return m_pDimensions[0];
271 template <
typename ElementType>
277 template <
typename ElementType>
282 m_pDimensions =
new uint32_t[1];
283 m_pDimensions[0] = pDimensions[0];
286 m_pElements =
new ElementType[m_pDimensions[0]];
289 template <
typename ElementType>
294 uint32_t* m_pTempDimensions = m_pDimensions;
295 ElementType* m_pTempElements = m_pElements;
297 m_pDimensions = rhs.m_pDimensions;
298 m_pElements = rhs.m_pElements;
300 rhs.m_pDimensions = m_pTempDimensions;
301 rhs.m_pElements = m_pTempElements;
304 template <
typename ElementType>
313 template <
typename ElementType>
314 Array<1, ElementType>& Array<1, ElementType>::operator=(
const Array<1, ElementType>& rhs)
322 template <
typename ElementType>
323 void Array<1, ElementType>::deallocate(
void)
325 delete[] m_pDimensions;
327 delete[] m_pElements;