cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | List of all members
vctDynamicNArrayRef< _elementType, _dimension > Class Template Reference

Dynamic nArray referencing existing memory. More...

#include <vctDynamicNArrayRef.h>

Inheritance diagram for vctDynamicNArrayRef< _elementType, _dimension >:
vctDynamicNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension > vctDynamicConstNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension >

Public Types

enum  { DIMENSION = _dimension }
 
typedef vctDynamicNArrayRef
< _elementType, DIMENSION
ThisType
 
typedef
vctDynamicNArrayRefOwner
< _elementType, DIMENSION
NArrayOwnerType
 
typedef vctDynamicNArrayBase
< vctDynamicNArrayRefOwner
< _elementType, DIMENSION >
, _elementType, DIMENSION
BaseType
 
typedef NArrayOwnerType::iterator iterator
 
typedef
NArrayOwnerType::const_iterator 
const_iterator
 
typedef
NArrayOwnerType::reverse_iterator 
reverse_iterator
 
typedef
NArrayOwnerType::const_reverse_iterator 
const_reverse_iterator
 
- Public Types inherited from vctDynamicNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension >
enum  
 
typedef vctDynamicNArrayBase ThisType
 
typedef
vctDynamicConstNArrayBase
< vctDynamicNArrayRefOwner
< _elementType, _dimension >
, _elementType, _dimension > 
BaseType
 
typedef
vctDynamicNArrayRefOwner
< _elementType, _dimension > 
OwnerType
 
typedef OwnerType::iterator iterator
 
typedef OwnerType::const_iterator const_iterator
 
typedef OwnerType::reverse_iterator reverse_iterator
 
typedef
OwnerType::const_reverse_iterator 
const_reverse_iterator
 
typedef
BaseType::ConstSubarrayRefType 
ConstSubarrayRefType
 
typedef BaseType::SubarrayRefType SubarrayRefType
 
typedef
BaseType::ConstPermutationRefType 
ConstPermutationRefType
 
typedef
BaseType::PermutationRefType 
PermutationRefType
 
typedef BaseType::SlicesTypes SlicesTypes
 
typedef BaseType::ConstSliceRefType ConstSliceRefType
 
typedef BaseType::SliceRefType SliceRefType
 
- Public Types inherited from vctDynamicConstNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension >
enum  
 
typedef
vctDynamicConstNArrayBase
< vctDynamicNArrayRefOwner
< _elementType, _dimension >
, _elementType, _dimension > 
ThisType
 
typedef
vctDynamicNArrayRefOwner
< _elementType, _dimension > 
OwnerType
 
typedef vctReturnDynamicNArray
< value_type, DIMENSION
NArrayValueType
 
typedef vctDynamicNArray
< value_type, DIMENSION
NArrayReturnType
 
typedef cmnTypeTraits< value_type > TypeTraits
 
typedef TypeTraits::BoolType BoolType
 
typedef vctReturnDynamicNArray
< BoolType, DIMENSION
BoolNArrayReturnType
 
typedef OwnerType::iterator iterator
 
typedef OwnerType::const_iterator const_iterator
 
typedef OwnerType::reverse_iterator reverse_iterator
 
typedef
OwnerType::const_reverse_iterator 
const_reverse_iterator
 
typedef
vctDynamicConstNArrayRef
< value_type, DIMENSION
ConstSubarrayRefType
 
typedef vctDynamicNArrayRef
< value_type, DIMENSION
SubarrayRefType
 
typedef
vctDynamicConstNArrayRef
< value_type, DIMENSION
ConstPermutationRefType
 
typedef vctDynamicNArrayRef
< value_type, DIMENSION
PermutationRefType
 
typedef vctDynamicNArrayTypes
< DIMENSION >::template
SlicesTypes< _elementType > 
SlicesTypes
 
typedef
SlicesTypes::ConstSliceRefType 
ConstSliceRefType
 
typedef SlicesTypes::SliceRefType SliceRefType
 

Public Member Functions

 VCT_CONTAINER_TRAITS_TYPEDEFS (_elementType)
 
 VCT_NARRAY_TRAITS_TYPEDEFS (DIMENSION)
 
 vctDynamicNArrayRef ()
 
 vctDynamicNArrayRef (const ThisType &other)
 
 vctDynamicNArrayRef (pointer dataPointer, const nsize_type &sizes, const nstride_type &strides)
 
template<class __ownerType >
 vctDynamicNArrayRef (vctDynamicNArrayBase< __ownerType, _elementType, DIMENSION > &otherNArray)
 
template<class __ownerType >
 vctDynamicNArrayRef (vctDynamicConstVectorBase< __ownerType, _elementType > &vector)
 
template<size_type __size, stride_type __stride, typename __dataPtrType >
 vctDynamicNArrayRef (vctFixedSizeConstVectorBase< __size, __stride, _elementType, __dataPtrType > &vector)
 
template<class __ownerType >
 vctDynamicNArrayRef (vctDynamicConstMatrixBase< __ownerType, _elementType > &matrix)
 
template<size_type __rows, size_type __cols, stride_type __rowStride, stride_type __colStride, typename __dataPtrType >
 vctDynamicNArrayRef (vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, _elementType, __dataPtrType > &matrix)
 
void SetRef (pointer dataPointer, const nsize_type &sizes, const nstride_type &strides)
 
template<class __ownerType >
void SetRef (vctDynamicNArrayBase< __ownerType, _elementType, DIMENSION > &otherNArray)
 
template<class __ownerType >
void SubarrayOf (vctDynamicNArrayBase< __ownerType, _elementType, DIMENSION > &otherNArray, const nsize_type &startPosition, const nsize_type &lengths)
 
template<class __ownerType >
void PermutationOf (vctDynamicNArrayBase< __ownerType, _elementType, DIMENSION > &otherNArray, const ndimension_type &dimensions)
 
template<class __ownerType >
void SliceOf (vctDynamicNArrayBase< __ownerType, _elementType, DIMENSION+1 > &otherNArray, dimension_type dimension, size_type index)
 
template<class __ownerType >
void SetRef (vctDynamicConstVectorBase< __ownerType, _elementType > &vector)
 
template<size_type __size, stride_type __stride, typename __dataPtrType >
void SetRef (vctFixedSizeConstVectorBase< __size, __stride, _elementType, __dataPtrType > &vector)
 
template<class __ownerType >
void SetRef (vctDynamicConstMatrixBase< __ownerType, _elementType > &matrix)
 
template<size_type __rows, size_type __cols, stride_type __rowStride, stride_type __colStride, typename __dataPtrType >
void SetRef (vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, _elementType, __dataPtrType > &matrix)
 
ThisTypeoperator= (const value_type &value)
 
Assignment operation into an nArray reference
Parameters
otherthe nArray to be copied.
ThisTypeoperator= (const ThisType &other)
 
ThisTypeoperator= (const vctDynamicConstNArrayRef< _elementType, DIMENSION > &other)
 
template<class __nArrayOwnerType , typename __elementType >
ThisTypeoperator= (const vctDynamicNArrayBase< __nArrayOwnerType, __elementType, DIMENSION > &other)
 
- Public Member Functions inherited from vctDynamicNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension >
 VCT_CONTAINER_TRAITS_TYPEDEFS (_elementType)
 
 VCT_NARRAY_TRAITS_TYPEDEFS (_dimension)
 
iterator begin (void)
 
const_iterator begin (void) const
 
iterator end (void)
 
const_iterator end (void) const
 
reverse_iterator rbegin (void)
 
const_reverse_iterator rbegin (void) const
 
reverse_iterator rend (void)
 
const_reverse_iterator rend (void) const
 
const OwnerTypeOwner (void) const
 
OwnerTypeOwner (void)
 
pointer Pointer (const nsize_type &indices)
 
const_pointer Pointer (const nsize_type &indices) const
 
pointer Pointer (void)
 
const_pointer Pointer (void) const
 
reference at (size_type metaIndex) throw (std::out_of_range)
 
const_reference at (size_type metaIndex) const throw (std::out_of_range)
 
reference at (const nsize_type &coordinates) throw (std::out_of_range)
 
const_reference at (const nsize_type &coordinates) const throw (std::out_of_range)
 
reference operator() (const nsize_type &coordinates) throw (std::out_of_range)
 
const_reference operator() (const nsize_type &coordinates) const throw (std::out_of_range)
 
reference Element (const nsize_type &coordinates)
 
const_reference Element (const nsize_type &coordinates) const
 
SubarrayRefType Subarray (const nsize_type &startPosition, const nsize_type &lengths)
 
ConstSubarrayRefType Subarray (const nsize_type &startPosition, const nsize_type &lengths) const
 
PermutationRefType Permutation (const ndimension_type &dimensions)
 
ConstPermutationRefType Permutation (const ndimension_type &dimensions) const
 
SliceRefType Slice (dimension_type dimension, size_type index) throw (std::runtime_error, std::out_of_range)
 
ConstSliceRefType Slice (dimension_type dimension, size_type index) const throw (std::runtime_error, std::out_of_range)
 
SliceRefType operator[] (size_type index)
 
ConstSliceRefType operator[] (size_type index) const
 
value_type SetAll (const value_type value)
 
bool Zeros (void)
 
ThisTypeAssign (const value_type *elements)
 
ThisTypeForceAssign (const vctDynamicConstNArrayBase< __nArrayOwnerType, __elementType, DIMENSION > &other)
 
ThisTypeAddProductOf (const value_type scalar, const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray)
 
ThisTypeAddElementwiseProductOf (const vctDynamicConstNArrayBase< __nArrayOwnerType1, value_type, DIMENSION > &nArray1, const vctDynamicConstNArrayBase< __nArrayOwnerType2, value_type, DIMENSION > &nArray2)
 
ThisTypeAssign (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &other)
 
ThisTypeAssign (const vctDynamicConstNArrayBase< __nArrayOwnerType, __elementType, DIMENSION > &other)
 
ThisTypeoperator= (const vctDynamicConstNArrayBase< __nArrayOwnerType, __elementType, DIMENSION > &other)
 
bool FastCopyOf (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &source, bool performSafetyChecks=true) throw (std::runtime_error)
 
ThisTypeSumOf (const vctDynamicConstNArrayBase< __nArrayOwnerType1, value_type, DIMENSION > &nArray1, const vctDynamicConstNArrayBase< __nArrayOwnerType2, value_type, DIMENSION > &nArray2)
 
ThisTypeDifferenceOf (const vctDynamicConstNArrayBase< __nArrayOwnerType1, value_type, DIMENSION > &nArray1, const vctDynamicConstNArrayBase< __nArrayOwnerType2, value_type, DIMENSION > &nArray2)
 
ThisTypeElementwiseProductOf (const vctDynamicConstNArrayBase< __nArrayOwnerType1, value_type, DIMENSION > &nArray1, const vctDynamicConstNArrayBase< __nArrayOwnerType2, value_type, DIMENSION > &nArray2)
 
ThisTypeElementwiseRatioOf (const vctDynamicConstNArrayBase< __nArrayOwnerType1, value_type, DIMENSION > &nArray1, const vctDynamicConstNArrayBase< __nArrayOwnerType2, value_type, DIMENSION > &nArray2)
 
ThisTypeElementwiseMinOf (const vctDynamicConstNArrayBase< __nArrayOwnerType1, value_type, DIMENSION > &nArray1, const vctDynamicConstNArrayBase< __nArrayOwnerType2, value_type, DIMENSION > &nArray2)
 
ThisTypeElementwiseMaxOf (const vctDynamicConstNArrayBase< __nArrayOwnerType1, value_type, DIMENSION > &nArray1, const vctDynamicConstNArrayBase< __nArrayOwnerType2, value_type, DIMENSION > &nArray2)
 
ThisTypeAdd (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray)
 
ThisTypeSubtract (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray)
 
ThisTypeElementwiseMultiply (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray)
 
ThisTypeElementwiseDivide (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray)
 
ThisTypeElementwiseMin (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray)
 
ThisTypeElementwiseMax (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray)
 
ThisTypeoperator+= (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray)
 
ThisTypeoperator-= (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray)
 
ThisTypeSumOf (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &nArray, const value_type scalar)
 
ThisTypeDifferenceOf (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &nArray, const value_type scalar)
 
ThisTypeProductOf (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &nArray, const value_type scalar)
 
ThisTypeRatioOf (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &nArray, const value_type scalar)
 
ThisTypeClippedAboveOf (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &nArray, const value_type lowerBound)
 
ThisTypeClippedBelowOf (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &nArray, const value_type upperBound)
 
ThisTypeSumOf (const value_type scalar, const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &nArray)
 
ThisTypeDifferenceOf (const value_type scalar, const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &nArray)
 
ThisTypeProductOf (const value_type scalar, const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &nArray)
 
ThisTypeRatioOf (const value_type scalar, const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &nArray)
 
ThisTypeClippedAboveOf (const value_type upperBound, const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &nArray)
 
ThisTypeClippedBelowOf (const value_type lowerBound, const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &nArray)
 
ThisTypeAdd (const value_type scalar)
 
ThisTypeSubtract (const value_type scalar)
 
ThisTypeoperator+= (const value_type scalar)
 
ThisTypeoperator-= (const value_type scalar)
 
ThisTypeMultiply (const value_type scalar)
 
ThisTypeDivide (const value_type scalar)
 
ThisTypeClipAbove (const value_type upperBound)
 
ThisTypeClipBelow (const value_type lowerBound)
 
ThisTypeoperator*= (const value_type scalar)
 
ThisTypeoperator/= (const value_type scalar)
 
ThisTypeAbsOf (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray)
 
ThisTypeNegationOf (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray)
 
ThisTypeFloorOf (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray)
 
ThisTypeCeilOf (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray)
 
ThisTypeAbsSelf (void)
 
ThisTypeNegationSelf (void)
 
ThisTypeFloorSelf (void)
 
ThisTypeCeilSelf (void)
 
- Public Member Functions inherited from vctDynamicConstNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension >
 VCT_CONTAINER_TRAITS_TYPEDEFS (_elementType)
 
 VCT_NARRAY_TRAITS_TYPEDEFS (_dimension)
 
const_iterator begin (void) const
 
const_iterator end (void) const
 
const_reverse_iterator rbegin (void) const
 
const_reverse_iterator rend (void) const
 
size_type size (void) const
 
size_type size (dimension_type dimension) const
 
const nsize_type & sizes (void) const
 
const nstride_type & strides (void) const
 
difference_type stride (dimension_type dimension) const
 
dimension_type dimension (void) const
 
bool empty (void) const
 
bool ValidDimension (dimension_type dimension) const
 
bool ValidDimensionIndex (dimension_type dimensionIndex) const
 
bool ValidIndex (size_type index) const
 
bool ValidIndex (const nsize_type &indices) const
 
bool ValidIndex (dimension_type dimension, size_type index) const
 
const_reference at (size_type metaIndex) const throw (std::out_of_range)
 
const_reference at (const nsize_type &coordinates) const throw (std::out_of_range)
 
const_reference operator() (const nsize_type &coordinates) const throw (std::out_of_range)
 
const OwnerTypeOwner (void) const
 
const_pointer Pointer (void) const
 
const_pointer Pointer (const nsize_type &indices) const
 
const_reference Element (const nsize_type &coordinates) const
 
ConstSubarrayRefType Subarray (const nsize_type &startPosition, const nsize_type &lengths) const
 
ConstPermutationRefType Permutation (const ndimension_type &dimensions) const
 
ConstSliceRefType Slice (dimension_type dimension, size_type index) const throw (std::runtime_error, std::out_of_range)
 
ConstSliceRefType operator[] (size_type index) const
 
bool FastCopyCompatible (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &source) const
 
std::string ToString (void)
 
void ToStream (std::ostream &outputStream) const
 
value_type SumOfElements (void) const
 
value_type ProductOfElements (void) const
 
value_type NormSquare (void) const
 
NormType Norm (void) const
 
value_type L1Norm (void) const
 
value_type LinfNorm (void) const
 
value_type MaxElement (void) const
 
value_type MinElement (void) const
 
value_type MaxAbsElement (void) const
 
value_type MinAbsElement (void) const
 
void MinAndMaxElement (value_type &minElement, value_type &maxElement) const
 
bool IsPositive (void) const
 
bool IsNonNegative (void) const
 
bool IsNonPositive (void) const
 
bool IsNegative (void) const
 
bool All (void) const
 
bool Any (void) const
 
bool IsFinite (void) const
 
bool HasNaN (void) const
 
bool IsCompact (void) const
 
bool Equal (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
 
bool operator== (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
 
bool AlmostEqual (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray, value_type tolerance) const
 
bool AlmostEqual (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
 
bool NotEqual (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
 
bool operator!= (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
 
bool Lesser (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
 
bool LesserOrEqual (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
 
bool Greater (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
 
bool GreaterOrEqual (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
 
bool Equal (const value_type &scalar) const
 
bool operator== (const value_type &scalar) const
 
bool NotEqual (const value_type &scalar) const
 
bool operator!= (const value_type &scalar) const
 
bool Lesser (const value_type &scalar) const
 
bool LesserOrEqual (const value_type &scalar) const
 
bool Greater (const value_type &scalar) const
 
bool GreaterOrEqual (const value_type &scalar) const
 
BoolNArrayReturnType ElementwiseEqual (const value_type &scalar) const
 
BoolNArrayReturnType ElementwiseNotEqual (const value_type &scalar) const
 
BoolNArrayReturnType ElementwiseLesser (const value_type &scalar) const
 
BoolNArrayReturnType ElementwiseLesserOrEqual (const value_type &scalar) const
 
BoolNArrayReturnType ElementwiseGreater (const value_type &scalar) const
 
BoolNArrayReturnType ElementwiseGreaterOrEqual (const value_type &scalar) const
 
BoolNArrayReturnType ElementwiseEqual (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
 
BoolNArrayReturnType ElementwiseNotEqual (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
 
BoolNArrayReturnType ElementwiseLesser (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
 
BoolNArrayReturnType ElementwiseLesserOrEqual (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
 
BoolNArrayReturnType ElementwiseGreater (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
 
BoolNArrayReturnType ElementwiseGreaterOrEqual (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
 
NArrayReturnType Abs (void) const
 
NArrayReturnType Negation (void) const
 
NArrayReturnType Floor (void) const
 
NArrayReturnType Ceil (void) const
 

Additional Inherited Members

- Protected Member Functions inherited from vctDynamicConstNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension >
void ThrowUnlessValidDimensionIndex (dimension_type dimensionIndex) const throw (std::out_of_range)
 
void ThrowUnlessValidIndex (size_type index) const throw (std::out_of_range)
 
void ThrowUnlessValidIndex (const nsize_type &indices) const throw (std::out_of_range)
 
void ThrowUnlessValidIndex (dimension_type dimension, size_type index) const throw (std::out_of_range)
 
- Protected Attributes inherited from vctDynamicConstNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension >
OwnerType NArray
 

Detailed Description

template<class _elementType, vct::size_type _dimension>
class vctDynamicNArrayRef< _elementType, _dimension >

Dynamic nArray referencing existing memory.

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:

vctRandom(wholeNArray, -10.0, 10.0);
first5x5.SetRef(wholeNArray, size_type(0, 0), size_type(5, 5));
first5x5.SetAll(5.0);
Note
On top of the SetRef methods provided for the cisst vectors and matrices (see vctDynamicVectorRef and vctDynamicMatrixRef), the ref classes for nArrays provides the methods SubarrayOf (re-size, same dimension), PermutationOf (same dimension, same sizes but different ordering of dimensions), SliceOf (reduce dimension by 1). By combining different Refs created using a mix of these methods, one can create any desired overlay.
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.
See Also
vctDynamicNArray, vctDynamicConstNArrayRef
Parameters
_elementTypeType of elements referenced. Also defined as value_type.
_dimensionDimension of the nArray ref.

Member Typedef Documentation

template<class _elementType, vct::size_type _dimension>
typedef vctDynamicNArrayBase<vctDynamicNArrayRefOwner<_elementType, DIMENSION>, _elementType, DIMENSION> vctDynamicNArrayRef< _elementType, _dimension >::BaseType
template<class _elementType, vct::size_type _dimension>
typedef NArrayOwnerType::const_iterator vctDynamicNArrayRef< _elementType, _dimension >::const_iterator
template<class _elementType, vct::size_type _dimension>
typedef NArrayOwnerType::const_reverse_iterator vctDynamicNArrayRef< _elementType, _dimension >::const_reverse_iterator
template<class _elementType, vct::size_type _dimension>
typedef NArrayOwnerType::iterator vctDynamicNArrayRef< _elementType, _dimension >::iterator
template<class _elementType, vct::size_type _dimension>
typedef vctDynamicNArrayRefOwner<_elementType, DIMENSION> vctDynamicNArrayRef< _elementType, _dimension >::NArrayOwnerType
template<class _elementType, vct::size_type _dimension>
typedef NArrayOwnerType::reverse_iterator vctDynamicNArrayRef< _elementType, _dimension >::reverse_iterator
template<class _elementType, vct::size_type _dimension>
typedef vctDynamicNArrayRef<_elementType, DIMENSION> vctDynamicNArrayRef< _elementType, _dimension >::ThisType

Member Enumeration Documentation

template<class _elementType, vct::size_type _dimension>
anonymous enum
Enumerator
DIMENSION 

Constructor & Destructor Documentation

template<class _elementType, vct::size_type _dimension>
vctDynamicNArrayRef< _elementType, _dimension >::vctDynamicNArrayRef ( )
inline
template<class _elementType, vct::size_type _dimension>
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.

template<class _elementType, vct::size_type _dimension>
vctDynamicNArrayRef< _elementType, _dimension >::vctDynamicNArrayRef ( pointer  dataPointer,
const nsize_type &  sizes,
const nstride_type &  strides 
)
inline

Create a reference to a memory location.

Note
see corresponding SetRef method below
template<class _elementType, vct::size_type _dimension>
template<class __ownerType >
vctDynamicNArrayRef< _elementType, _dimension >::vctDynamicNArrayRef ( vctDynamicNArrayBase< __ownerType, _elementType, DIMENSION > &  otherNArray)
inline

Create a reference to an nArray.

Note
see corresponding SetRef method below
template<class _elementType, vct::size_type _dimension>
template<class __ownerType >
vctDynamicNArrayRef< _elementType, _dimension >::vctDynamicNArrayRef ( vctDynamicConstVectorBase< __ownerType, _elementType > &  vector)
inline

Create a reference to a dynamic vector.

Note
see corresponding SetRef method below
template<class _elementType, vct::size_type _dimension>
template<size_type __size, stride_type __stride, typename __dataPtrType >
vctDynamicNArrayRef< _elementType, _dimension >::vctDynamicNArrayRef ( vctFixedSizeConstVectorBase< __size, __stride, _elementType, __dataPtrType > &  vector)
inline

Create a reference to a fixed-size vector.

Note
see corresponding SetRef method below
template<class _elementType, vct::size_type _dimension>
template<class __ownerType >
vctDynamicNArrayRef< _elementType, _dimension >::vctDynamicNArrayRef ( vctDynamicConstMatrixBase< __ownerType, _elementType > &  matrix)
inline

Create a reference to a dynamic matrix.

Note
see corresponding SetRef method below
template<class _elementType, vct::size_type _dimension>
template<size_type __rows, size_type __cols, stride_type __rowStride, stride_type __colStride, typename __dataPtrType >
vctDynamicNArrayRef< _elementType, _dimension >::vctDynamicNArrayRef ( vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, _elementType, __dataPtrType > &  matrix)
inline

Create a reference to a fixed-size matrix.

Note
see corresponding SetRef method below

Member Function Documentation

template<class _elementType, vct::size_type _dimension>
ThisType& vctDynamicNArrayRef< _elementType, _dimension >::operator= ( const ThisType other)
inline
template<class _elementType, vct::size_type _dimension>
ThisType& vctDynamicNArrayRef< _elementType, _dimension >::operator= ( const vctDynamicConstNArrayRef< _elementType, DIMENSION > &  other)
inline
template<class _elementType, vct::size_type _dimension>
template<class __nArrayOwnerType , typename __elementType >
ThisType& vctDynamicNArrayRef< _elementType, _dimension >::operator= ( const vctDynamicNArrayBase< __nArrayOwnerType, __elementType, DIMENSION > &  other)
inline
template<class _elementType, vct::size_type _dimension>
ThisType& vctDynamicNArrayRef< _elementType, _dimension >::operator= ( const value_type &  value)
inline

Assignment of a scalar to all elements. See also SetAll.

template<class _elementType, vct::size_type _dimension>
template<class __ownerType >
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.

Parameters
otherNArraythe nArray over which to set this reference
dimensionsa sequence of dimension numbers representing the permuted order of strides
Note
Preserves the number of dimensions.
template<class _elementType, vct::size_type _dimension>
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.

template<class _elementType, vct::size_type _dimension>
template<class __ownerType >
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.

template<class _elementType, vct::size_type _dimension>
template<class __ownerType >
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.

template<class _elementType, vct::size_type _dimension>
template<size_type __size, stride_type __stride, typename __dataPtrType >
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.

template<class _elementType, vct::size_type _dimension>
template<class __ownerType >
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.

template<class _elementType, vct::size_type _dimension>
template<size_type __rows, size_type __cols, stride_type __rowStride, stride_type __colStride, typename __dataPtrType >
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.

template<class _elementType, vct::size_type _dimension>
template<class __ownerType >
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.

Parameters
otherNArraythe nArray over which to set this reference
dimensionthe dimension number of the direction by which to reduce
slicethe index number in the dimension specified by which to set the reference
Note
The number of dimensions is reduced by one.
template<class _elementType, vct::size_type _dimension>
template<class __ownerType >
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.

Parameters
otherNArraythe nArray over which to set this reference
startPositionvector of indices of the element position where the reference will start
lengthsthe number of elements to reference in each dimension
Note
Preserves the number of dimensions.
template<class _elementType, vct::size_type _dimension>
vctDynamicNArrayRef< _elementType, _dimension >::VCT_CONTAINER_TRAITS_TYPEDEFS ( _elementType  )
template<class _elementType, vct::size_type _dimension>
vctDynamicNArrayRef< _elementType, _dimension >::VCT_NARRAY_TRAITS_TYPEDEFS ( DIMENSION  )

The documentation for this class was generated from the following file: