|
| | VCT_CONTAINER_TRAITS_TYPEDEFS (_elementType) |
| | vctDynamicConstVectorRef () |
| | vctDynamicConstVectorRef (const ThisType &other) |
| | vctDynamicConstVectorRef (size_type size, pointer data, stride_type stride=1) |
| | vctDynamicConstVectorRef (size_type size, const_pointer data, stride_type stride=1) |
| template<size_type __size, stride_type __stride, class __dataPtrType> |
| | vctDynamicConstVectorRef (const vctFixedSizeConstVectorBase< __size, __stride, _elementType, __dataPtrType > &otherVector) |
| template<size_type __size, stride_type __stride, class __dataPtrType> |
| | vctDynamicConstVectorRef (const vctFixedSizeConstVectorBase< __size, __stride, _elementType, __dataPtrType > &otherVector, size_type startPosition, size_type length) |
| template<class __vectorOwnerType> |
| | vctDynamicConstVectorRef (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector) |
| template<class __vectorOwnerType> |
| | vctDynamicConstVectorRef (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector, size_type startPosition, size_type length) |
| void | SetRef (size_type size, const_pointer p, stride_type stride=1) |
| template<size_type __size, stride_type __stride, class __dataPtrType> |
| void | SetRef (const vctFixedSizeConstVectorBase< __size, __stride, _elementType, __dataPtrType > &otherVector) |
| template<size_type __size, stride_type __stride, class __dataPtrType> |
| void | SetRef (const vctFixedSizeConstVectorBase< __size, __stride, _elementType, __dataPtrType > &otherVector, size_type startPosition, size_type length) CISST_THROW(std |
| template<class __vectorOwnerType> |
| void | SetRef (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector) |
| template<class __vectorOwnerType> |
| void | SetRef (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector, size_type startPosition, size_type length) CISST_THROW(std |
template<class _elementType>
class vctDynamicConstVectorRef< _elementType >
Dynamic vector referencing existing memory (const).
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:
first5.
SetRef(wholeVector, 0, 5);
std::cout << first5 << " " << first5.SumOfElements() << std::endl;
void SetRef(size_type size, const_pointer p, stride_type stride=1)
Definition vctDynamicConstVectorRef.h:154
vctDynamicConstVectorRef()
Definition vctDynamicConstVectorRef.h:92
Definition vctForwardDeclarations.h:131
void vctRandom(vctDynamicMatrixBase< _matrixOwnerType, _elementType > &matrix, const typename vctDynamicMatrixBase< _matrixOwnerType, _elementType >::value_type min, const typename vctDynamicMatrixBase< _matrixOwnerType, _elementType >::value_type max)
Definition vctRandomDynamicMatrix.h:47
- Note
- 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.
-
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.
- See also
- vctDynamicVector, vctDynamicVectorRef
- Parameters
-