#include <vctDynamicConstNArrayRef.h>
Inheritance diagram for vctDynamicConstNArrayRef< _elementType, _dimension >:


The class vctDynamicConstNArrayRef allows to create a nArray overlaying an existing block of memory. It can be used to manipulate a container created by another toolkit (i.e. OpenGL, vtk, ...) or a cisstVector container using different parameters (different size, storage order or stride).
To setup the overlay, one can use either the constructors or the SetRef methods. When used with a cisst container, the SetRef methods can infer some of the memory layout information (pointer on first element, sizes, strides). When used to overlay existing memory referenced by a pointer, the user has to provide all the required information. In any case, the Ref object doesn't allocate nor free memory.
Finally, as this overlay is const, it can be used to make sure the referenced content is not modified.
For example to manipulate the first five elements of a nArray, one can do:
vctDynamicNArray<double, 2> wholeNArray(size_type(10, 10)); vctRandom(wholeNArray, -10.0, 10.0); vctDynamicNArrayRef<double, 2> first5x5; first5x5.SetRef(wholeNArray, size_type(0, 0), size_type(5, 5)); std::cout << first5x5 << " " << first5x5.SumOfElements() << std::endl;
Make sure the underlying memory is not freed after the Ref object is created and before it is used. This would lead to faulty memory access and potential bugs.
vctDynamicConstNArrayRef only performs const operations even if it stores a non-const value_type *. It can be initialized with either value_type * or const value_type *. For a non-const Ref, see vctDynamicNArrayRef.
| _elementType | Type of elements referenced. Also defined as value_type. | |
| _dimension | Dimension of the const nArray ref. |
Definition at line 90 of file vctDynamicConstNArrayRef.h.
| typedef vctDynamicConstNArrayRef<_elementType, DIMENSION> vctDynamicConstNArrayRef< _elementType, _dimension >::ThisType |
Type of the nArray itself.
Reimplemented from vctDynamicConstNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension >.
Definition at line 100 of file vctDynamicConstNArrayRef.h.
| vctDynamicConstNArrayRef< _elementType, _dimension >::vctDynamicConstNArrayRef | ( | const ThisType & | other | ) | [inline] |
Copy constructor
Definition at line 115 of file vctDynamicConstNArrayRef.h.
References vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::Pointer(), vctDynamicConstNArrayRef< _elementType, _dimension >::SetRef(), vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::sizes(), and vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::strides().
| vctDynamicConstNArrayRef< _elementType, _dimension >::vctDynamicConstNArrayRef | ( | const_pointer | dataPointer, | |
| const nsize_type & | sizes, | |||
| const nstride_type & | strides | |||
| ) | [inline] |
Create a reference to a memory location.
Definition at line 124 of file vctDynamicConstNArrayRef.h.
References vctDynamicConstNArrayRef< _elementType, _dimension >::SetRef().
| vctDynamicConstNArrayRef< _elementType, _dimension >::vctDynamicConstNArrayRef | ( | pointer | dataPointer, | |
| const nsize_type & | sizes, | |||
| const nstride_type & | strides | |||
| ) | [inline] |
Create a reference to a memory location.
Definition at line 132 of file vctDynamicConstNArrayRef.h.
References vctDynamicConstNArrayRef< _elementType, _dimension >::SetRef().
| vctDynamicConstNArrayRef< _elementType, _dimension >::vctDynamicConstNArrayRef | ( | const vctDynamicConstNArrayBase< __ownerType, value_type, DIMENSION > & | otherNArray | ) | [inline] |
Create a reference to an nArray.
Definition at line 141 of file vctDynamicConstNArrayRef.h.
References vctDynamicConstNArrayRef< _elementType, _dimension >::SetRef().
| vctDynamicConstNArrayRef< _elementType, _dimension >::vctDynamicConstNArrayRef | ( | const vctDynamicConstVectorBase< __ownerType, value_type > & | vector | ) | [inline] |
Create a reference to a dynamic vector.
Definition at line 150 of file vctDynamicConstNArrayRef.h.
References vctDynamicConstNArrayRef< _elementType, _dimension >::SetRef().
| vctDynamicConstNArrayRef< _elementType, _dimension >::vctDynamicConstNArrayRef | ( | const vctFixedSizeConstVectorBase< __size, __stride, value_type, __dataPtrType > & | vector | ) | [inline] |
Create a reference to a fixed-size vector.
Definition at line 159 of file vctDynamicConstNArrayRef.h.
References vctDynamicConstNArrayRef< _elementType, _dimension >::SetRef().
| vctDynamicConstNArrayRef< _elementType, _dimension >::vctDynamicConstNArrayRef | ( | const vctDynamicConstMatrixBase< __ownerType, value_type > & | matrix | ) | [inline] |
Create a reference to a dynamic matrix.
Definition at line 168 of file vctDynamicConstNArrayRef.h.
References vctDynamicConstNArrayRef< _elementType, _dimension >::SetRef().
| vctDynamicConstNArrayRef< _elementType, _dimension >::vctDynamicConstNArrayRef | ( | const vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, value_type, __dataPtrType > & | matrix | ) | [inline] |
Create a reference to a fixed-size matrix.
Definition at line 177 of file vctDynamicConstNArrayRef.h.
References vctDynamicConstNArrayRef< _elementType, _dimension >::SetRef().
| void vctDynamicConstNArrayRef< _elementType, _dimension >::SetRef | ( | const_pointer | dataPointer, | |
| const nsize_type & | sizes, | |||
| const nstride_type & | strides | |||
| ) | [inline] |
Set a reference to a memory location. The user should specify all the parameters of the referenced memory, including a start memory address.
Definition at line 189 of file vctDynamicConstNArrayRef.h.
References vctDynamicConstNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension >::NArray, and vctDynamicNArrayRefOwner< _elementType, _dimension >::SetRef().
Referenced by vctDynamicConstNArrayRef< _elementType, _dimension >::PermutationOf(), vctDynamicConstNArrayRef< _elementType, _dimension >::SetRef(), vctDynamicConstNArrayRef< _elementType, _dimension >::SliceOf(), vctDynamicConstNArrayRef< _elementType, _dimension >::SubarrayOf(), and vctDynamicConstNArrayRef< _elementType, _dimension >::vctDynamicConstNArrayRef().
| void vctDynamicConstNArrayRef< _elementType, _dimension >::SetRef | ( | const vctDynamicConstNArrayBase< __ownerType, value_type, DIMENSION > & | otherNArray | ) | [inline] |
Set a reference to an nArray. The reference will have identical dimensions, sizes and strides as the input nArray.
Definition at line 198 of file vctDynamicConstNArrayRef.h.
References vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::Pointer(), vctDynamicConstNArrayRef< _elementType, _dimension >::SetRef(), vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::sizes(), and vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::strides().
| void vctDynamicConstNArrayRef< _elementType, _dimension >::SubarrayOf | ( | const vctDynamicConstNArrayBase< __ownerType, value_type, DIMENSION > & | otherNArray, | |
| const nsize_type & | startPosition, | |||
| const nsize_type & | lengths | |||
| ) | [inline] |
Set a reference to a subarray of an nArray.
| otherNArray | the nArray over which to set this reference | |
| startPosition | vector of indices of the element position where the reference will start | |
| lengths | the number of elements to reference in each dimension |
Definition at line 211 of file vctDynamicConstNArrayRef.h.
References CMN_ASSERT, vctDynamicConstNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension >::LesserOrEqual(), vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::Pointer(), vctDynamicConstNArrayRef< _elementType, _dimension >::SetRef(), vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::sizes(), and vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::strides().
Referenced by vctDynamicConstNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension >::Subarray().
| void vctDynamicConstNArrayRef< _elementType, _dimension >::PermutationOf | ( | const vctDynamicConstNArrayBase< __ownerType, value_type, DIMENSION > & | otherNArray, | |
| const ndimension_type & | dimensions | |||
| ) | [inline] |
Set a reference to an nArray with a permutation of its strides.
| otherNArray | the nArray over which to set this reference | |
| dimensions | a sequence of dimension numbers representing the permuted order of strides |
Definition at line 227 of file vctDynamicConstNArrayRef.h.
References vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::Pointer(), vctDynamicConstNArrayRef< _elementType, _dimension >::SetRef(), vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::size(), vctDynamicConstNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension >::sizes(), vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::stride(), and vctDynamicConstNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension >::strides().
Referenced by vctDynamicConstNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension >::Permutation().
| void vctDynamicConstNArrayRef< _elementType, _dimension >::SliceOf | ( | const vctDynamicConstNArrayBase< __ownerType, value_type, DIMENSION+1 > & | otherNArray, | |
| dimension_type | dimension, | |||
| size_type | index | |||
| ) | [inline] |
Set a reference to an (n-1)-dimension slice of an n-dimension nArray.
| otherNArray | the nArray over which to set this reference | |
| dimension | the dimension number of the direction by which to reduce | |
| slice | the index number in the dimension specified by which to set the reference |
Definition at line 257 of file vctDynamicConstNArrayRef.h.
References vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::Pointer(), vctDynamicConstNArrayRef< _elementType, _dimension >::SetRef(), vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::sizes(), vctDynamicConstNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension >::sizes(), vctDynamicConstNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension >::strides(), and vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::strides().
| void vctDynamicConstNArrayRef< _elementType, _dimension >::SetRef | ( | const vctDynamicConstVectorBase< __ownerType, value_type > & | vector | ) | [inline] |
Set a reference to a dynamic vector. The reference will have identical size and stride as the input vector.
Definition at line 314 of file vctDynamicConstNArrayRef.h.
References vctDynamicConstVectorBase< _vectorOwnerType, _elementType >::Pointer(), vctDynamicConstNArrayRef< _elementType, _dimension >::SetRef(), vctDynamicConstVectorBase< _vectorOwnerType, _elementType >::size(), and vctDynamicConstVectorBase< _vectorOwnerType, _elementType >::stride().
| void vctDynamicConstNArrayRef< _elementType, _dimension >::SetRef | ( | const vctFixedSizeConstVectorBase< __size, __stride, value_type, __dataPtrType > & | vector | ) | [inline] |
Set a reference to a fixed-size vector. The reference will have identical size and stride as the input vector.
Definition at line 323 of file vctDynamicConstNArrayRef.h.
References vctFixedSizeConstVectorBase< _size, _stride, _elementType, _dataPtrType >::Pointer(), and vctDynamicConstNArrayRef< _elementType, _dimension >::SetRef().
| void vctDynamicConstNArrayRef< _elementType, _dimension >::SetRef | ( | const vctDynamicConstMatrixBase< __ownerType, value_type > & | matrix | ) | [inline] |
Set a reference to a dynamic matrix. The reference will have identical sizes and strides as the input matrix.
Definition at line 332 of file vctDynamicConstNArrayRef.h.
References vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >::col_stride(), vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >::cols(), vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >::Pointer(), vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >::row_stride(), vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >::rows(), and vctDynamicConstNArrayRef< _elementType, _dimension >::SetRef().
| void vctDynamicConstNArrayRef< _elementType, _dimension >::SetRef | ( | const vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, value_type, __dataPtrType > & | matrix | ) | [inline] |
Set a reference to a fixed-size matrix. The reference will have identical sizes and strides as the input matrix.
Definition at line 343 of file vctDynamicConstNArrayRef.h.
References vctDynamicConstNArrayRef< _elementType, _dimension >::SetRef().