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


The class vctDynamicNArrayRef 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.
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)); first5x5.SetAll(5.0);
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.
vctDynamicNArrayRef can perform const and non-const operations. It can be initialized with a non-const object only (value_type *). For a const Ref, see vctDynamicConstNArrayRef.
| _elementType | Type of elements referenced. Also defined as value_type. | |
| _dimension | Dimension of the nArray ref. |
Definition at line 88 of file vctDynamicNArrayRef.h.
| other | the nArray to be copied. |
| typedef vctDynamicNArrayRef<_elementType, DIMENSION> vctDynamicNArrayRef< _elementType, _dimension >::ThisType |
Type of the nArray itself
Reimplemented from vctDynamicNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension >.
Definition at line 98 of file vctDynamicNArrayRef.h.
| typedef vctDynamicNArrayBase<vctDynamicNArrayRefOwner<_elementType, DIMENSION>, _elementType, DIMENSION> vctDynamicNArrayRef< _elementType, _dimension >::BaseType |
Type of the base class
Reimplemented from vctDynamicNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension >.
Definition at line 100 of file vctDynamicNArrayRef.h.
| vctDynamicNArrayRef< _elementType, _dimension >::vctDynamicNArrayRef | ( | const ThisType & | other | ) | [inline] |
Copy constructor. This copy constructor takes a const reference on the object to copy but has to remove the const-ness of the point to create a vctDynamicNArrayRef and allow it to manipulate elements. The explict use of a const_cast is far from great but there is no easy solution as C++ requires the copy constructor to take a const reference.
Definition at line 118 of file vctDynamicNArrayRef.h.
References vctDynamicNArrayBase< _nArrayOwnerType, _elementType, _dimension >::Pointer(), vctDynamicNArrayRef< _elementType, _dimension >::SetRef(), vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::sizes(), and vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::strides().
| vctDynamicNArrayRef< _elementType, _dimension >::vctDynamicNArrayRef | ( | pointer | dataPointer, | |
| const nsize_type & | sizes, | |||
| const nstride_type & | strides | |||
| ) | [inline] |
Create a reference to a memory location.
Definition at line 127 of file vctDynamicNArrayRef.h.
References vctDynamicNArrayRef< _elementType, _dimension >::SetRef().
| vctDynamicNArrayRef< _elementType, _dimension >::vctDynamicNArrayRef | ( | vctDynamicNArrayBase< __ownerType, _elementType, DIMENSION > & | otherNArray | ) | [inline] |
Create a reference to an nArray.
Definition at line 136 of file vctDynamicNArrayRef.h.
References vctDynamicNArrayRef< _elementType, _dimension >::SetRef().
| vctDynamicNArrayRef< _elementType, _dimension >::vctDynamicNArrayRef | ( | vctDynamicConstVectorBase< __ownerType, _elementType > & | vector | ) | [inline] |
Create a reference to a dynamic vector.
Definition at line 145 of file vctDynamicNArrayRef.h.
References vctDynamicNArrayRef< _elementType, _dimension >::SetRef().
| vctDynamicNArrayRef< _elementType, _dimension >::vctDynamicNArrayRef | ( | vctFixedSizeConstVectorBase< __size, __stride, _elementType, __dataPtrType > & | vector | ) | [inline] |
Create a reference to a fixed-size vector.
Definition at line 154 of file vctDynamicNArrayRef.h.
References vctDynamicNArrayRef< _elementType, _dimension >::SetRef().
| vctDynamicNArrayRef< _elementType, _dimension >::vctDynamicNArrayRef | ( | vctDynamicConstMatrixBase< __ownerType, _elementType > & | matrix | ) | [inline] |
Create a reference to a dynamic matrix.
Definition at line 163 of file vctDynamicNArrayRef.h.
References vctDynamicNArrayRef< _elementType, _dimension >::SetRef().
| vctDynamicNArrayRef< _elementType, _dimension >::vctDynamicNArrayRef | ( | vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, _elementType, __dataPtrType > & | matrix | ) | [inline] |
Create a reference to a fixed-size matrix.
Definition at line 172 of file vctDynamicNArrayRef.h.
References vctDynamicNArrayRef< _elementType, _dimension >::SetRef().
| void vctDynamicNArrayRef< _elementType, _dimension >::SetRef | ( | 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 181 of file vctDynamicNArrayRef.h.
References vctDynamicConstNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension >::NArray, and vctDynamicNArrayRefOwner< _elementType, _dimension >::SetRef().
Referenced by vctDynamicNArrayRef< _elementType, _dimension >::PermutationOf(), vctDynamicNArrayRef< _elementType, _dimension >::SetRef(), vctDynamicNArrayRef< _elementType, _dimension >::SliceOf(), vctDynamicNArrayRef< _elementType, _dimension >::SubarrayOf(), and vctDynamicNArrayRef< _elementType, _dimension >::vctDynamicNArrayRef().
| void vctDynamicNArrayRef< _elementType, _dimension >::SetRef | ( | vctDynamicNArrayBase< __ownerType, _elementType, 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 190 of file vctDynamicNArrayRef.h.
References vctDynamicNArrayBase< _nArrayOwnerType, _elementType, _dimension >::Pointer(), vctDynamicNArrayRef< _elementType, _dimension >::SetRef(), vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::sizes(), and vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::strides().
| void vctDynamicNArrayRef< _elementType, _dimension >::SubarrayOf | ( | vctDynamicNArrayBase< __ownerType, _elementType, 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 203 of file vctDynamicNArrayRef.h.
References CMN_ASSERT, vctDynamicConstNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension >::LesserOrEqual(), vctDynamicNArrayBase< _nArrayOwnerType, _elementType, _dimension >::Pointer(), vctDynamicNArrayRef< _elementType, _dimension >::SetRef(), vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::sizes(), and vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::strides().
Referenced by vctDynamicNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension >::Subarray().
| void vctDynamicNArrayRef< _elementType, _dimension >::PermutationOf | ( | vctDynamicNArrayBase< __ownerType, _elementType, 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 219 of file vctDynamicNArrayRef.h.
References vctDynamicNArrayBase< _nArrayOwnerType, _elementType, _dimension >::Pointer(), vctDynamicNArrayRef< _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 vctDynamicNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension >::Permutation().
| void vctDynamicNArrayRef< _elementType, _dimension >::SliceOf | ( | vctDynamicNArrayBase< __ownerType, _elementType, 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 249 of file vctDynamicNArrayRef.h.
References vctDynamicNArrayBase< _nArrayOwnerType, _elementType, _dimension >::Pointer(), vctDynamicNArrayRef< _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 vctDynamicNArrayRef< _elementType, _dimension >::SetRef | ( | vctDynamicConstVectorBase< __ownerType, _elementType > & | vector | ) | [inline] |
Set a reference to a dynamic vector. The reference will have identical size and stride as the input vector.
Definition at line 306 of file vctDynamicNArrayRef.h.
References vctDynamicConstVectorBase< _vectorOwnerType, _elementType >::Pointer(), vctDynamicNArrayRef< _elementType, _dimension >::SetRef(), vctDynamicConstVectorBase< _vectorOwnerType, _elementType >::size(), and vctDynamicConstVectorBase< _vectorOwnerType, _elementType >::stride().
| void vctDynamicNArrayRef< _elementType, _dimension >::SetRef | ( | vctFixedSizeConstVectorBase< __size, __stride, _elementType, __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 315 of file vctDynamicNArrayRef.h.
References vctFixedSizeConstVectorBase< _size, _stride, _elementType, _dataPtrType >::Pointer(), and vctDynamicNArrayRef< _elementType, _dimension >::SetRef().
| void vctDynamicNArrayRef< _elementType, _dimension >::SetRef | ( | vctDynamicConstMatrixBase< __ownerType, _elementType > & | matrix | ) | [inline] |
Set a reference to a dynamic matrix. The reference will have identical sizes and strides as the input matrix.
Definition at line 324 of file vctDynamicNArrayRef.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 vctDynamicNArrayRef< _elementType, _dimension >::SetRef().
| void vctDynamicNArrayRef< _elementType, _dimension >::SetRef | ( | vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, _elementType, __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 335 of file vctDynamicNArrayRef.h.
References vctDynamicNArrayRef< _elementType, _dimension >::SetRef().
| ThisType& vctDynamicNArrayRef< _elementType, _dimension >::operator= | ( | const value_type & | value | ) | [inline] |
Assignment of a scalar to all elements. See also SetAll.
Definition at line 366 of file vctDynamicNArrayRef.h.