cisst-saw
Loading...
Searching...
No Matches
vctDynamicConstMatrixRef.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3
4/*
5
6 Author(s): Ofri Sadowsky, Anton Deguet
7 Created on: 2004-07-01
8
9 (C) Copyright 2004-2007 Johns Hopkins University (JHU), All Rights
10 Reserved.
11
12--- begin cisst license - do not edit ---
13
14This software is provided "as is" under an open source license, with
15no warranty. The complete license can be found in license.txt and
16http://www.cisst.org/cisst/license.txt.
17
18--- end cisst license ---
19*/
20
21#pragma once
22#ifndef _vctDynamicConstMatrixRef_h
23#define _vctDynamicConstMatrixRef_h
24
29
32
78template <class _elementType>
80 public vctDynamicConstMatrixBase<vctDynamicMatrixRefOwner<_elementType>, _elementType>
81{
82public:
84 enum {DIMENSION = 2};
86
94
95
97 SetRef(0, 0, 1, 1, static_cast<pointer>(0));
98 }
99
102 BaseType()
103 {
104 SetRef(other.sizes(), other.strides(), other.Pointer());
105 }
106
112 vctDynamicConstMatrixRef(size_type rows, size_type cols,
113 stride_type rowStride, stride_type colStride,
114 pointer dataPointer)
115 {
116 SetRef(rows, cols, rowStride, colStride, dataPointer);
117 }
118 vctDynamicConstMatrixRef(size_type rows, size_type cols,
119 stride_type rowStride, stride_type colStride,
120 const_pointer dataPointer)
121 {
122 SetRef(rows, cols, rowStride, colStride, dataPointer);
123 }
124
125 vctDynamicConstMatrixRef(const nsize_type & matrixSize, stride_type rowStride, stride_type colStride,
126 pointer dataPointer)
127 {
128 SetRef(matrixSize, rowStride, colStride, dataPointer);
129 }
130 vctDynamicConstMatrixRef(const nsize_type & matrixSize, stride_type rowStride, stride_type colStride,
131 const_pointer dataPointer)
132 {
133 SetRef(matrixSize, rowStride, colStride, dataPointer);
134 }
135
136 vctDynamicConstMatrixRef(const nsize_type & matrixSize, const nstride_type & matrixStride,
137 pointer dataPointer)
138 {
139 SetRef(matrixSize, matrixStride, dataPointer);
140 }
141 vctDynamicConstMatrixRef(const nsize_type & matrixSize, const nstride_type & matrixStride,
142 const_pointer dataPointer)
143 {
144 SetRef(matrixSize, matrixStride, dataPointer);
145 }
146
147
148
154 vctDynamicConstMatrixRef(size_type rows, size_type cols, pointer dataPointer,
155 bool storageOrder = VCT_DEFAULT_STORAGE)
156 {
157 SetRef(rows, cols, dataPointer, storageOrder);
158 }
159 vctDynamicConstMatrixRef(size_type rows, size_type cols, const_pointer dataPointer,
160 bool storageOrder = VCT_DEFAULT_STORAGE)
161 {
162 SetRef(rows, cols, dataPointer, storageOrder);
163 }
164
165 vctDynamicConstMatrixRef(const nsize_type & matrixSize, pointer dataPointer,
166 bool storageOrder = VCT_DEFAULT_STORAGE)
167 {
168 SetRef(matrixSize, dataPointer, storageOrder);
169 }
170 vctDynamicConstMatrixRef(const nsize_type & matrixSize, const_pointer dataPointer,
171 bool storageOrder = VCT_DEFAULT_STORAGE)
172 {
173 SetRef(matrixSize, dataPointer, storageOrder);
174 }
175
176
177
183 template <size_type __rows, size_type __cols, stride_type __rowStride, stride_type __colStride, typename __dataPtrType>
189
200 template <size_type __rows, size_type __cols, stride_type __rowStride, stride_type __colStride, typename __dataPtrType>
202 size_type startRow, size_type startCol, size_type rows, size_type cols)
203 {
204 SetRef(otherMatrix, startRow, startCol, rows, cols);
205 }
206
212 template <class __ownerType>
214 {
215 SetRef(otherMatrix);
216 }
217
229 template <class __ownerType>
231 size_type startRow, size_type startCol, size_type rows, size_type cols)
232 {
233 SetRef(otherMatrix, startRow, startCol, rows, cols);
234 }
235
236 template <class __ownerType>
238 const nsize_type & start, const nsize_type & matrixSize)
239 {
240 SetRef(otherMatrix, start, matrixSize);
241 }
242
243
248 void SetRef(size_type rows, size_type cols,
249 stride_type rowStride, stride_type colStride,
250 pointer dataPointer)
251 {
252 this->Matrix.SetRef(rows, cols, rowStride, colStride, dataPointer);
253 }
254 void SetRef(size_type rows, size_type cols,
255 stride_type rowStride, stride_type colStride,
256 const_pointer dataPointer)
257 {
258 this->Matrix.SetRef(rows, cols, rowStride, colStride, const_cast<pointer>(dataPointer));
259 }
260
261 void SetRef(const nsize_type & matrixSize,
262 stride_type rowStride, stride_type colStride,
263 pointer dataPointer) {
264 this->Matrix.SetRef(matrixSize, rowStride, colStride, dataPointer);
265 }
266 void SetRef(const nsize_type & matrixSize,
267 stride_type rowStride, stride_type colStride,
268 const_pointer dataPointer) {
269 this->Matrix.SetRef(matrixSize, rowStride, colStride, const_cast<pointer>(dataPointer));
270 }
271
272 void SetRef(const nsize_type & matrixSize,
273 const nstride_type & matrixStride,
274 pointer dataPointer) {
275 this->Matrix.SetRef(matrixSize, matrixStride, dataPointer);
276 }
277 void SetRef(const nsize_type & matrixSize,
278 const nstride_type & matrixStride,
279 const_pointer dataPointer) {
280 this->Matrix.SetRef(matrixSize, matrixStride, const_cast<pointer>(dataPointer));
281 }
282
283
284
290 void SetRef(size_type rows, size_type cols, pointer dataPointer, bool storageOrder = VCT_DEFAULT_STORAGE)
291 {
292 this->Matrix.SetRef(rows, cols, dataPointer, storageOrder);
293 }
294 void SetRef(size_type rows, size_type cols, const_pointer dataPointer, bool storageOrder = VCT_DEFAULT_STORAGE)
295 {
296 this->Matrix.SetRef(rows, cols, const_cast<pointer>(dataPointer), storageOrder);
297 }
298
299 void SetRef(const nsize_type & sizes, pointer dataPointer, bool storageOrder = VCT_DEFAULT_STORAGE)
300 {
301 this->Matrix.SetRef(sizes, dataPointer, storageOrder);
302 }
303 void SetRef(const nsize_type & sizes, const_pointer dataPointer, bool storageOrder = VCT_DEFAULT_STORAGE)
304 {
305 this->Matrix.SetRef(sizes, const_cast<pointer>(dataPointer), storageOrder);
306 }
307
308
309
313 template <size_type __rows, size_type __cols, stride_type __rowStride, stride_type __colStride, typename __dataPtrType>
315 & otherMatrix)
316 {
317 SetRef(otherMatrix.rows(), otherMatrix.cols(), otherMatrix.row_stride(), otherMatrix.col_stride(),
318 otherMatrix.Pointer());
319 }
320
321
334 template <size_type __rows, size_type __cols, stride_type __rowStride, stride_type __colStride, typename __dataPtrType>
336 size_type startRow, size_type startCol,
337 size_type rows, size_type cols)
338 {
339 if ( (startRow + rows > otherMatrix.rows()) || (startCol + cols > otherMatrix.cols()) ) {
340 cmnThrow(std::out_of_range("vctDynamicConstMatrixRef SetRef out of range"));
341 }
342 SetRef(rows, cols, otherMatrix.row_stride(), otherMatrix.col_stride(), otherMatrix.Pointer(startRow, startCol));
343 }
344
348 template <class __ownerType>
350 {
351 SetRef(otherMatrix.rows(), otherMatrix.cols(), otherMatrix.row_stride(), otherMatrix.col_stride(),
352 otherMatrix.Pointer());
353 }
354
368 template <class __ownerType>
370 size_type startRow, size_type startCol,
371 size_type rows, size_type cols)
372 {
373 if ( (startRow + rows > otherMatrix.rows()) || (startCol + cols > otherMatrix.cols()) ) {
374 cmnThrow(std::out_of_range("vctDynamicConstMatrixRef SetRef out of range"));
375 }
376 SetRef(rows, cols, otherMatrix.row_stride(), otherMatrix.col_stride(),
377 otherMatrix.Pointer(startRow, startCol));
378 }
379
380 template <class __ownerType>
382 const nsize_type & start, const nsize_type & matrixSize)
383 {
384 SetRef(otherMatrix,
385 start.Element(0), start.Element(1), matrixSize.Element(0), matrixSize.Element(1));
386 }
387
388};
389
390
391#endif // _vctDynamicConstMatrixRef_h
392
Definition vctForwardDeclarations.h:145
MatrixOwnerType::reverse_iterator reverse_iterator
Definition vctDynamicConstMatrixRef.h:92
void SetRef(size_type rows, size_type cols, const_pointer dataPointer, bool storageOrder=VCT_DEFAULT_STORAGE)
Definition vctDynamicConstMatrixRef.h:294
vctDynamicConstMatrixBase< vctDynamicMatrixRefOwner< value_type >, value_type > BaseType
Definition vctDynamicConstMatrixRef.h:89
void SetRef(const nsize_type &matrixSize, stride_type rowStride, stride_type colStride, pointer dataPointer)
Definition vctDynamicConstMatrixRef.h:261
VCT_CONTAINER_TRAITS_TYPEDEFS(_elementType)
vctDynamicConstMatrixRef(const nsize_type &matrixSize, pointer dataPointer, bool storageOrder=VCT_DEFAULT_STORAGE)
Definition vctDynamicConstMatrixRef.h:165
void SetRef(const nsize_type &sizes, const_pointer dataPointer, bool storageOrder=VCT_DEFAULT_STORAGE)
Definition vctDynamicConstMatrixRef.h:303
vctDynamicConstMatrixRef()
Definition vctDynamicConstMatrixRef.h:96
void SetRef(size_type rows, size_type cols, stride_type rowStride, stride_type colStride, pointer dataPointer)
Definition vctDynamicConstMatrixRef.h:248
vctDynamicConstMatrixRef(const vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, _elementType, __dataPtrType > &otherMatrix)
Definition vctDynamicConstMatrixRef.h:184
vctDynamicConstMatrixRef(const vctDynamicConstMatrixBase< __ownerType, _elementType > &otherMatrix)
Definition vctDynamicConstMatrixRef.h:213
vctDynamicConstMatrixRef(size_type rows, size_type cols, pointer dataPointer, bool storageOrder=VCT_DEFAULT_STORAGE)
Definition vctDynamicConstMatrixRef.h:154
vctDynamicConstMatrixRef(const vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, _elementType, __dataPtrType > &otherMatrix, size_type startRow, size_type startCol, size_type rows, size_type cols)
Definition vctDynamicConstMatrixRef.h:201
vctDynamicConstMatrixRef(size_type rows, size_type cols, stride_type rowStride, stride_type colStride, const_pointer dataPointer)
Definition vctDynamicConstMatrixRef.h:118
void SetRef(const vctDynamicConstMatrixBase< __ownerType, _elementType > &otherMatrix, size_type startRow, size_type startCol, size_type rows, size_type cols)
Definition vctDynamicConstMatrixRef.h:369
void SetRef(const vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, _elementType, __dataPtrType > &otherMatrix)
Definition vctDynamicConstMatrixRef.h:314
vctDynamicConstMatrixRef(const nsize_type &matrixSize, const_pointer dataPointer, bool storageOrder=VCT_DEFAULT_STORAGE)
Definition vctDynamicConstMatrixRef.h:170
vctDynamicMatrixRefOwner< value_type > MatrixOwnerType
Definition vctDynamicConstMatrixRef.h:88
vctDynamicConstMatrixRef(size_type rows, size_type cols, const_pointer dataPointer, bool storageOrder=VCT_DEFAULT_STORAGE)
Definition vctDynamicConstMatrixRef.h:159
VCT_NARRAY_TRAITS_TYPEDEFS(DIMENSION)
void SetRef(const nsize_type &matrixSize, const nstride_type &matrixStride, const_pointer dataPointer)
Definition vctDynamicConstMatrixRef.h:277
vctDynamicConstMatrixRef< value_type > ThisType
Definition vctDynamicConstMatrixRef.h:87
void SetRef(const nsize_type &matrixSize, const nstride_type &matrixStride, pointer dataPointer)
Definition vctDynamicConstMatrixRef.h:272
void SetRef(const nsize_type &sizes, pointer dataPointer, bool storageOrder=VCT_DEFAULT_STORAGE)
Definition vctDynamicConstMatrixRef.h:299
@ DIMENSION
Definition vctDynamicConstMatrixRef.h:84
vctDynamicConstMatrixRef(const ThisType &other)
Definition vctDynamicConstMatrixRef.h:101
void SetRef(const nsize_type &matrixSize, stride_type rowStride, stride_type colStride, const_pointer dataPointer)
Definition vctDynamicConstMatrixRef.h:266
MatrixOwnerType::const_reverse_iterator const_reverse_iterator
Definition vctDynamicConstMatrixRef.h:93
vctDynamicConstMatrixRef(size_type rows, size_type cols, stride_type rowStride, stride_type colStride, pointer dataPointer)
Definition vctDynamicConstMatrixRef.h:112
vctDynamicConstMatrixRef(const nsize_type &matrixSize, const nstride_type &matrixStride, const_pointer dataPointer)
Definition vctDynamicConstMatrixRef.h:141
MatrixOwnerType::iterator iterator
Definition vctDynamicConstMatrixRef.h:90
vctDynamicConstMatrixRef(const nsize_type &matrixSize, stride_type rowStride, stride_type colStride, const_pointer dataPointer)
Definition vctDynamicConstMatrixRef.h:130
vctDynamicConstMatrixRef(const nsize_type &matrixSize, const nstride_type &matrixStride, pointer dataPointer)
Definition vctDynamicConstMatrixRef.h:136
void SetRef(size_type rows, size_type cols, stride_type rowStride, stride_type colStride, const_pointer dataPointer)
Definition vctDynamicConstMatrixRef.h:254
vctDynamicConstMatrixRef(const vctDynamicConstMatrixBase< __ownerType, _elementType > &otherMatrix, const nsize_type &start, const nsize_type &matrixSize)
Definition vctDynamicConstMatrixRef.h:237
vctDynamicConstMatrixRef(const nsize_type &matrixSize, stride_type rowStride, stride_type colStride, pointer dataPointer)
Definition vctDynamicConstMatrixRef.h:125
void SetRef(const vctDynamicConstMatrixBase< __ownerType, _elementType > &otherMatrix, const nsize_type &start, const nsize_type &matrixSize)
Definition vctDynamicConstMatrixRef.h:381
MatrixOwnerType::const_iterator const_iterator
Definition vctDynamicConstMatrixRef.h:91
void SetRef(size_type rows, size_type cols, pointer dataPointer, bool storageOrder=VCT_DEFAULT_STORAGE)
Definition vctDynamicConstMatrixRef.h:290
vctDynamicConstMatrixRef(const vctDynamicConstMatrixBase< __ownerType, _elementType > &otherMatrix, size_type startRow, size_type startCol, size_type rows, size_type cols)
Definition vctDynamicConstMatrixRef.h:230
void SetRef(const vctDynamicConstMatrixBase< __ownerType, _elementType > &otherMatrix)
Definition vctDynamicConstMatrixRef.h:349
void SetRef(const vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, _elementType, __dataPtrType > &otherMatrix, size_type startRow, size_type startCol, size_type rows, size_type cols)
Definition vctDynamicConstMatrixRef.h:335
Definition vctDynamicMatrixRefOwner.h:40
vctVarStrideMatrixIterator< value_type > reverse_iterator
Definition vctDynamicMatrixRefOwner.h:53
vctVarStrideMatrixConstIterator< value_type > const_reverse_iterator
Definition vctDynamicMatrixRefOwner.h:51
vctVarStrideMatrixConstIterator< value_type > const_iterator
Definition vctDynamicMatrixRefOwner.h:50
vctVarStrideMatrixIterator< value_type > iterator
Definition vctDynamicMatrixRefOwner.h:52
A template for a fixed size matrix with fixed spacing in memory.
Definition vctFixedSizeConstMatrixBase.h:104
const_pointer Pointer(size_type rowIndex, size_type colIndex) const
Definition vctFixedSizeConstMatrixBase.h:329
size_type cols() const
Definition vctFixedSizeConstMatrixBase.h:282
difference_type row_stride() const
Definition vctFixedSizeConstMatrixBase.h:303
size_type rows() const
Definition vctFixedSizeConstMatrixBase.h:277
difference_type col_stride() const
Definition vctFixedSizeConstMatrixBase.h:309
void cmnThrow(const _exceptionType &except, cmnLogLevel lod=CMN_LOG_LEVEL_INIT_ERROR)
Definition cmnThrow.h:76
Declaration of vctDynamicConstMatrixBase.
size_type cols() const
Definition vctDynamicConstMatrixBase.h:243
OwnerType Matrix
Definition vctDynamicConstMatrixBase.h:167
const nsize_type & sizes(void) const
Definition vctDynamicConstMatrixBase.h:233
size_type rows() const
Definition vctDynamicConstMatrixBase.h:238
Declaration of vctDynamicMatrixRefOwner.
const bool VCT_DEFAULT_STORAGE
Definition vctForwardDeclarations.h:47