#include <vctDynamicConstVectorRef.h>
Inheritance diagram for vctDynamicConstVectorRef< _elementType >:


The class vctDynamicConstVectorRef allows to create a vector 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, size, stride). 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 vector, one can do:
vctDynamicVector<double> wholeVector(10); vctRandom(wholeVector, -10.0, 10.0); vctDynamicConstVectorRef<double> first5; first5.SetRef(wholeVector, 0, 5); std::cout << first5 << " " << first5.SumOfElements() << std::endl;
vctDynamicConstVectorRef 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 vctDynamicVectorRef.
| _elementType | Type of elements referenced. Also defined as value_type. |
Definition at line 80 of file vctDynamicConstVectorRef.h.
| typedef vctDynamicConstVectorRef<value_type> vctDynamicConstVectorRef< _elementType >::ThisType |
Type of the vector itself.
Reimplemented from vctDynamicConstVectorBase< vctDynamicVectorRefOwner< _elementType >, _elementType >.
Definition at line 85 of file vctDynamicConstVectorRef.h.
| typedef BaseType::CopyType vctDynamicConstVectorRef< _elementType >::CopyType |
The type used to create a copy.
Reimplemented from vctDynamicConstVectorBase< vctDynamicVectorRefOwner< _elementType >, _elementType >.
Definition at line 88 of file vctDynamicConstVectorRef.h.
| typedef VectorOwnerType::iterator vctDynamicConstVectorRef< _elementType >::iterator |
Iterator on the elements of the vector.
Reimplemented from vctDynamicConstVectorBase< vctDynamicVectorRefOwner< _elementType >, _elementType >.
Definition at line 89 of file vctDynamicConstVectorRef.h.
| typedef VectorOwnerType::const_iterator vctDynamicConstVectorRef< _elementType >::const_iterator |
Const iterator on the elements of the vector.
Reimplemented from vctDynamicConstVectorBase< vctDynamicVectorRefOwner< _elementType >, _elementType >.
Definition at line 90 of file vctDynamicConstVectorRef.h.
| typedef VectorOwnerType::reverse_iterator vctDynamicConstVectorRef< _elementType >::reverse_iterator |
Reverse iterator on the elements of the vector.
Reimplemented from vctDynamicConstVectorBase< vctDynamicVectorRefOwner< _elementType >, _elementType >.
Definition at line 91 of file vctDynamicConstVectorRef.h.
| typedef VectorOwnerType::const_reverse_iterator vctDynamicConstVectorRef< _elementType >::const_reverse_iterator |
Const reverse iterator on the elements of the vector.
Reimplemented from vctDynamicConstVectorBase< vctDynamicVectorRefOwner< _elementType >, _elementType >.
Definition at line 92 of file vctDynamicConstVectorRef.h.
| vctDynamicConstVectorRef< _elementType >::vctDynamicConstVectorRef | ( | ) | [inline] |
Default constructor initializes the vector reference to NULL
Definition at line 95 of file vctDynamicConstVectorRef.h.
| vctDynamicConstVectorRef< _elementType >::vctDynamicConstVectorRef | ( | const ThisType & | other | ) | [inline] |
Copy constructor
Definition at line 99 of file vctDynamicConstVectorRef.h.
References vctDynamicConstVectorBase< _vectorOwnerType, _elementType >::Pointer(), vctDynamicConstVectorRef< _elementType >::SetRef(), vctDynamicConstVectorBase< _vectorOwnerType, _elementType >::size(), and vctDynamicConstVectorBase< _vectorOwnerType, _elementType >::stride().
| vctDynamicConstVectorRef< _elementType >::vctDynamicConstVectorRef | ( | const vctFixedSizeConstVectorBase< __size, __stride, _elementType, __dataPtrType > & | otherVector | ) | [inline] |
Initialize a dynamic reference to a fixed-size vector.
The size and stride values are taken from the fixed size vector.
Definition at line 119 of file vctDynamicConstVectorRef.h.
References vctDynamicConstVectorRef< _elementType >::SetRef().
| vctDynamicConstVectorRef< _elementType >::vctDynamicConstVectorRef | ( | const vctFixedSizeConstVectorBase< __size, __stride, _elementType, __dataPtrType > & | otherVector, | |
| size_type | startPosition, | |||
| size_type | length | |||
| ) | [inline] |
Initialize a dynamic reference to specified subvector of a fixed-size vector.
The stride values are taken from the fixed size vector, but the starting point and length must be specified.
Definition at line 131 of file vctDynamicConstVectorRef.h.
References vctDynamicConstVectorRef< _elementType >::SetRef().
| vctDynamicConstVectorRef< _elementType >::vctDynamicConstVectorRef | ( | const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > & | otherVector | ) | [inline] |
Initialize a dynamic reference to a dynamic vector.
Definition at line 141 of file vctDynamicConstVectorRef.h.
References vctDynamicConstVectorRef< _elementType >::SetRef().
| vctDynamicConstVectorRef< _elementType >::vctDynamicConstVectorRef | ( | const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > & | otherVector, | |
| size_type | startPosition, | |||
| size_type | length | |||
| ) | [inline] |
Initialize a dynamic reference to a specified subvector of a dynamic vector.
Definition at line 151 of file vctDynamicConstVectorRef.h.
References vctDynamicConstVectorRef< _elementType >::SetRef().
| void vctDynamicConstVectorRef< _elementType >::SetRef | ( | const vctFixedSizeConstVectorBase< __size, __stride, _elementType, __dataPtrType > & | otherVector | ) | [inline] |
Set a dynamic reference to a fixed-size vector
Definition at line 166 of file vctDynamicConstVectorRef.h.
References vctFixedSizeConstVectorBase< _size, _stride, _elementType, _dataPtrType >::Pointer(), vctDynamicConstVectorRef< _elementType >::SetRef(), vctFixedSizeConstVectorBase< _size, _stride, _elementType, _dataPtrType >::size(), and vctFixedSizeConstVectorBase< _size, _stride, _elementType, _dataPtrType >::stride().
| void vctDynamicConstVectorRef< _elementType >::SetRef | ( | const vctFixedSizeConstVectorBase< __size, __stride, _elementType, __dataPtrType > & | otherVector, | |
| size_type | startPosition, | |||
| size_type | length | |||
| ) | throw (std::out_of_range) [inline] |
Set a dynamic reference to a specified subvector of a fixed-size vector
This method verifies that the size of this vector does not exceed the size of the input vector (otherwise cmnThrow is used to throw std::out_of_range).
Definition at line 178 of file vctDynamicConstVectorRef.h.
References cmnThrow(), and vctDynamicConstVectorRef< _elementType >::SetRef().
| void vctDynamicConstVectorRef< _elementType >::SetRef | ( | const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > & | otherVector | ) | [inline] |
Set a dynamic reference to a dynamic vector
Definition at line 192 of file vctDynamicConstVectorRef.h.
References vctDynamicConstVectorBase< _vectorOwnerType, _elementType >::Pointer(), vctDynamicConstVectorRef< _elementType >::SetRef(), vctDynamicConstVectorBase< _vectorOwnerType, _elementType >::size(), and vctDynamicConstVectorBase< _vectorOwnerType, _elementType >::stride().
| void vctDynamicConstVectorRef< _elementType >::SetRef | ( | const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > & | otherVector, | |
| size_type | startPosition, | |||
| size_type | length | |||
| ) | throw (std::out_of_range) [inline] |
Set a dynamic reference to a specified subvector of dynamic vector
This method verifies that the size of this vector does not exceed the size of the input vector (otherwise cmnThrow is used to throw std::out_of_range).
Definition at line 204 of file vctDynamicConstVectorRef.h.
References cmnThrow(), and vctDynamicConstVectorRef< _elementType >::SetRef().