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


The class vctDynamicVectorRef 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.
For example to manipulate the first five elements of a vector, one can do:
vctDynamicVector<double> wholeVector(10); vctRandom(wholeVector, -10.0, 10.0); vctDynamicVectorRef<double> first5; first5.SetRef(wholeVector, 0, 5); first5.SetAll(5.0);
vctDynamicVectorRef can perform const and non-const operations. It can be initialized with a non-const object only (value_type *). For a const Ref, see vctDynamicConstVectorRef.
| _elementType | Type of elements referenced. Also defined as value_type. |
Definition at line 80 of file vctDynamicVectorRef.h.
| typedef vctDynamicVectorRef<_elementType> vctDynamicVectorRef< _elementType >::ThisType |
Type of the vector itself.
Reimplemented from vctDynamicVectorBase< vctDynamicVectorRefOwner< _elementType >, _elementType >.
Definition at line 84 of file vctDynamicVectorRef.h.
| typedef vctDynamicVectorBase<vctDynamicVectorRefOwner<_elementType>, _elementType> vctDynamicVectorRef< _elementType >::BaseType |
Type of the base class.
Reimplemented from vctDynamicVectorBase< vctDynamicVectorRefOwner< _elementType >, _elementType >.
Definition at line 86 of file vctDynamicVectorRef.h.
| typedef BaseType::CopyType vctDynamicVectorRef< _elementType >::CopyType |
The type used to create a copy.
Reimplemented from vctDynamicVectorBase< vctDynamicVectorRefOwner< _elementType >, _elementType >.
Definition at line 87 of file vctDynamicVectorRef.h.
| typedef VectorOwnerType::iterator vctDynamicVectorRef< _elementType >::iterator |
Iterator on the elements of the vector.
Reimplemented from vctDynamicVectorBase< vctDynamicVectorRefOwner< _elementType >, _elementType >.
Definition at line 88 of file vctDynamicVectorRef.h.
| typedef VectorOwnerType::const_iterator vctDynamicVectorRef< _elementType >::const_iterator |
Const iterator on the elements of the vector.
Reimplemented from vctDynamicVectorBase< vctDynamicVectorRefOwner< _elementType >, _elementType >.
Definition at line 89 of file vctDynamicVectorRef.h.
| typedef VectorOwnerType::reverse_iterator vctDynamicVectorRef< _elementType >::reverse_iterator |
Reverse iterator on the elements of the vector.
Reimplemented from vctDynamicVectorBase< vctDynamicVectorRefOwner< _elementType >, _elementType >.
Definition at line 90 of file vctDynamicVectorRef.h.
| typedef VectorOwnerType::const_reverse_iterator vctDynamicVectorRef< _elementType >::const_reverse_iterator |
Const reverse iterator on the elements of the vector.
Reimplemented from vctDynamicVectorBase< vctDynamicVectorRefOwner< _elementType >, _elementType >.
Definition at line 91 of file vctDynamicVectorRef.h.
| vctDynamicVectorRef< _elementType >::vctDynamicVectorRef | ( | ) | [inline] |
Default constructor initializes the vector reference to NULL
Definition at line 94 of file vctDynamicVectorRef.h.
| vctDynamicVectorRef< _elementType >::vctDynamicVectorRef | ( | 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 vctDynamicVectorRef 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 103 of file vctDynamicVectorRef.h.
| vctDynamicVectorRef< _elementType >::vctDynamicVectorRef | ( | vctFixedSizeVectorBase< __size, __stride, _elementType, __dataPtrType > & | otherVector, | |
| size_type | startPosition = 0 | |||
| ) | [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 120 of file vctDynamicVectorRef.h.
| vctDynamicVectorRef< _elementType >::vctDynamicVectorRef | ( | vctFixedSizeVectorBase< __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 133 of file vctDynamicVectorRef.h.
| vctDynamicVectorRef< _elementType >::vctDynamicVectorRef | ( | vctDynamicVectorBase< __vectorOwnerType, _elementType > & | otherVector | ) | [inline] |
Initialize a dynamic reference to a dynamic vector.
Definition at line 143 of file vctDynamicVectorRef.h.
| vctDynamicVectorRef< _elementType >::vctDynamicVectorRef | ( | vctDynamicVectorBase< __vectorOwnerType, _elementType > & | otherVector, | |
| size_type | startPosition, | |||
| size_type | length | |||
| ) | [inline] |
Initialize a dynamic reference to a dynamic vector.
Definition at line 153 of file vctDynamicVectorRef.h.
| void vctDynamicVectorRef< _elementType >::SetRef | ( | vctFixedSizeVectorBase< __size, __stride, _elementType, __dataPtrType > & | otherVector, | |
| size_type | startPosition = 0 | |||
| ) | [inline] |
Set a dynamic reference to a fixed-size vector.
| otherVector | the vector for which a new reference is set. | |
| startPosition | the index of the first element in otherVector to be indexed by this reference. |
the size and memory stride of this reference will be equal to the size and memory stride of the input vector.
Definition at line 174 of file vctDynamicVectorRef.h.
| void vctDynamicVectorRef< _elementType >::SetRef | ( | vctFixedSizeVectorBase< __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 188 of file vctDynamicVectorRef.h.
| void vctDynamicVectorRef< _elementType >::SetRef | ( | vctDynamicVectorBase< __vectorOwnerType, _elementType > & | otherVector | ) | [inline] |
Set a dynamic reference to a dynamic vector.
Definition at line 202 of file vctDynamicVectorRef.h.
| void vctDynamicVectorRef< _elementType >::SetRef | ( | vctDynamicVectorBase< __vectorOwnerType, _elementType > & | otherVector, | |
| size_type | startPosition, | |||
| size_type | length | |||
| ) | throw (std::out_of_range) [inline] |
Set a dynamic reference to a specified subvector of a 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 214 of file vctDynamicVectorRef.h.
| ThisType& vctDynamicVectorRef< _elementType >::operator= | ( | const ThisType & | other | ) | [inline] |
Assignment operation between vectors of different types
| other | The vector to be copied. |
Definition at line 237 of file vctDynamicVectorRef.h.
| ThisType& vctDynamicVectorRef< _elementType >::operator= | ( | const vctDynamicConstVectorRef< value_type > & | other | ) | [inline] |
Assignment operation between vectors of different types
| other | The vector to be copied. |
Definition at line 242 of file vctDynamicVectorRef.h.
| ThisType& vctDynamicVectorRef< _elementType >::operator= | ( | const vctDynamicConstVectorBase< __vectorOwnerType, __elementType > & | other | ) | [inline] |
Assignment operation between vectors of different types
| other | The vector to be copied. |
Reimplemented from vctDynamicVectorBase< vctDynamicVectorRefOwner< _elementType >, _elementType >.
Definition at line 247 of file vctDynamicVectorRef.h.
| ThisType& vctDynamicVectorRef< _elementType >::operator= | ( | const value_type & | value | ) | [inline] |
Assignement of a scalar to all elements. See also SetAll.
Definition at line 253 of file vctDynamicVectorRef.h.
| void vctDynamicVectorRef< _elementType >::DeSerializeRaw | ( | std::istream & | inputStream | ) | throw (std::runtime_error) [inline] |
Binary deserialization. This method can not resize the existing block of memory and will throw an exception is the sizes don't match.
Definition at line 261 of file vctDynamicVectorRef.h.