cisst-saw
Loading...
Searching...
No Matches
vctDynamicNArray.h File Reference

Declaration of vctDynamicNArray. More...

Go to the source code of this file.

Classes

class  vctReturnDynamicNArray< _elementType, _dimension >

Macros

#define _vctDynamicNArray_h

Typedefs

typedef vctDynamicNArrayBase< vctDynamicNArrayOwner< _elementType, _dimension >, _elementType, _dimension > BaseType
typedef vctDynamicNArray< _elementType, _dimension > ThisType

Functions

 VCT_CONTAINER_TRAITS_TYPEDEFS (_elementType)
 An nArray object of dynamic size.
 VCT_NARRAY_TRAITS_TYPEDEFS (_dimension)
 vctDynamicNArray ()
 vctDynamicNArray (const nsize_type &sizes)
 vctDynamicNArray (const nsize_type &sizes, value_type value)
 vctDynamicNArray (const vctReturnDynamicNArray< value_type, _dimension > &otherNArray)
 vctDynamicNArray (const ThisType &otherNArray)
template<class _otherNArrayOwnerType>
 vctDynamicNArray (const vctDynamicConstNArrayBase< _otherNArrayOwnerType, value_type, _dimension > &otherNArray)
template<class _otherNArrayOwnerType, typename _otherNArrayElementType>
 vctDynamicNArray (const vctDynamicConstNArrayBase< _otherNArrayOwnerType, _otherNArrayElementType, _dimension > &otherNArray)
template<class __nArrayOwnerType, typename __elementType>
ThisTypeoperator= (const vctDynamicConstNArrayBase< __nArrayOwnerType, __elementType, _dimension > &otherNArray)
ThisTypeoperator= (const ThisType &otherNArray)
ThisTypeoperator= (const vctReturnDynamicNArray< value_type, _dimension > &otherNArray)
ThisTypeoperator= (const value_type &value)
template<class __nArrayOwnerType, typename __elementType>
ThisTypeForceAssign (const vctDynamicConstNArrayBase< __nArrayOwnerType, __elementType, _dimension > &other)
void SetSize (const nsize_type &sizes)
Elementwise operations between nArrays.
template<class _nArrayOwnerType1, class _nArrayOwnerType2, class _elementType, vct::size_type _dimension>
vctReturnDynamicNArray< _elementType, _dimension > operator+ (const vctDynamicConstNArrayBase< _nArrayOwnerType1, _elementType, _dimension > &inputNArray1, const vctDynamicConstNArrayBase< _nArrayOwnerType2, _elementType, _dimension > &inputNArray2)
template<class _nArrayOwnerType1, class _nArrayOwnerType2, class _elementType, vct::size_type _dimension>
vctReturnDynamicNArray< _elementType, _dimension > operator- (const vctDynamicConstNArrayBase< _nArrayOwnerType1, _elementType, _dimension > &inputNArray1, const vctDynamicConstNArrayBase< _nArrayOwnerType2, _elementType, _dimension > &inputNArray2)
Elementwise operations between an nArray and a

scalar.

template<class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
vctReturnDynamicNArray< _elementType, _dimension > operator+ (const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &inputNArray, const _elementType &inputScalar)
template<class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
vctReturnDynamicNArray< _elementType, _dimension > operator- (const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &inputNArray, const _elementType &inputScalar)
template<class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
vctReturnDynamicNArray< _elementType, _dimension > operator* (const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &inputNArray, const _elementType &inputScalar)
template<class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
vctReturnDynamicNArray< _elementType, _dimension > operator/ (const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &inputNArray, const _elementType &inputScalar)
Elementwise operations between a scalar and an nArray.
template<class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
vctReturnDynamicNArray< _elementType, _dimension > operator+ (const _elementType &inputScalar, const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &inputNArray)
template<class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
vctReturnDynamicNArray< _elementType, _dimension > operator- (const _elementType &inputScalar, const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &inputNArray)
template<class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
vctReturnDynamicNArray< _elementType, _dimension > operator* (const _elementType &inputScalar, const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &inputNArray)
template<class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
vctReturnDynamicNArray< _elementType, _dimension > operator/ (const _elementType &inputScalar, const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &inputNArray)
Elementwise operations on an nArray.
template<class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
vctReturnDynamicNArray< _elementType, _dimension > operator- (const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &inputNArray)
template<class _nArrayOwnerType1, class _nArrayOwnerType2, class _elementType, vct::size_type _dimension>
vctReturnDynamicNArray< _elementType, _dimension > operator* (const vctDynamicConstNArrayBase< _nArrayOwnerType1, _elementType, _dimension > &inputNArray1, const vctDynamicConstNArrayBase< _nArrayOwnerType2, _elementType, _dimension > &inputNArray2)
template<class _nArrayOwnerType, class __nArrayOwnerType, class _elementType, class _elementOperationType, vct::size_type _dimension>
vctReturnDynamicNArray< bool, _dimension > vctDynamicNArrayElementwiseCompareNArray (const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &nArray1, const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &nArray2)
template<class _nArrayOwnerType, class _elementType, class _elementOperationType, vct::size_type _dimension>
vctReturnDynamicNArray< bool, _dimension > vctDynamicNArrayElementwiseCompareScalar (const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &nArray, const _elementType &scalar)
template<class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
vctDynamicNArrayRef< _elementType, _dimension - 1 > vctDynamicNArrayNArraySlice (vctDynamicNArrayBase< _nArrayOwnerType, _elementType, _dimension > &input, vct::size_type dimension, vct::index_type index)
template<class _nArrayOwnerType, class _elementType>
_elementType & vctDynamicNArrayElementSlice (vctDynamicNArrayBase< _nArrayOwnerType, _elementType, 1 > &input, vct::index_type index)
template<class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
vctDynamicConstNArrayRef< _elementType, _dimension - 1 > vctDynamicNArrayConstNArraySlice (const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &input, vct::size_type dimension, vct::index_type index)
template<class _nArrayOwnerType, class _elementType>
const _elementType & vctDynamicNArrayConstElementSlice (const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, 1 > &input, vct::index_type index)

Detailed Description

Declaration of vctDynamicNArray.

Macro Definition Documentation

◆ _vctDynamicNArray_h

#define _vctDynamicNArray_h

Typedef Documentation

◆ BaseType

typedef vctDynamicNArrayBase<vctDynamicNArrayOwner<_elementType, _dimension>, _elementType, _dimension> BaseType

◆ ThisType

typedef vctDynamicNArray<_elementType, _dimension> ThisType

Function Documentation

◆ ForceAssign()

template<class __nArrayOwnerType, typename __elementType>
ThisType & ForceAssign ( const vctDynamicConstNArrayBase< __nArrayOwnerType, __elementType, _dimension > & other)
inline

◆ operator*() [1/3]

template<class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
vctReturnDynamicNArray< _elementType, _dimension > operator* ( const _elementType & inputScalar,
const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > & inputNArray )

◆ operator*() [2/3]

template<class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
vctReturnDynamicNArray< _elementType, _dimension > operator* ( const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > & inputNArray,
const _elementType & inputScalar )

◆ operator*() [3/3]

template<class _nArrayOwnerType1, class _nArrayOwnerType2, class _elementType, vct::size_type _dimension>
vctReturnDynamicNArray< _elementType, _dimension > operator* ( const vctDynamicConstNArrayBase< _nArrayOwnerType1, _elementType, _dimension > & inputNArray1,
const vctDynamicConstNArrayBase< _nArrayOwnerType2, _elementType, _dimension > & inputNArray2 )

◆ operator+() [1/3]

template<class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
vctReturnDynamicNArray< _elementType, _dimension > operator+ ( const _elementType & inputScalar,
const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > & inputNArray )

Operation between a scalar and an nArray.

Parameters
inputScalarThe first operand of the binary operation.
inputNArrayThe second operand of the binary operation.
Returns
The nArray result of \(op(scalar, nArray)\).

◆ operator+() [2/3]

template<class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
vctReturnDynamicNArray< _elementType, _dimension > operator+ ( const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > & inputNArray,
const _elementType & inputScalar )

Operation between an nArray and a scalar.

Parameters
inputNArrayThe first operand of the binary operation.
inputScalarThe second operand of the binary operation.
Returns
The nArray result of \(op(nArray, scalar)\).

◆ operator+() [3/3]

template<class _nArrayOwnerType1, class _nArrayOwnerType2, class _elementType, vct::size_type _dimension>
vctReturnDynamicNArray< _elementType, _dimension > operator+ ( const vctDynamicConstNArrayBase< _nArrayOwnerType1, _elementType, _dimension > & inputNArray1,
const vctDynamicConstNArrayBase< _nArrayOwnerType2, _elementType, _dimension > & inputNArray2 )

Operation between nArrays (same size).

Parameters
inputNArray1The first operand of the binary operation.
inputNArray2The second operand of the binary operation.
Returns
The nArray result of \(op(nArray1, nArray2)\).

◆ operator-() [1/4]

template<class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
vctReturnDynamicNArray< _elementType, _dimension > operator- ( const _elementType & inputScalar,
const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > & inputNArray )

◆ operator-() [2/4]

template<class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
vctReturnDynamicNArray< _elementType, _dimension > operator- ( const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > & inputNArray)

Unary operation on an nArray.

Parameters
inputNArrayThe operand of the unary operation
Returns
The nArray result of \(op(nArray)\).

◆ operator-() [3/4]

template<class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
vctReturnDynamicNArray< _elementType, _dimension > operator- ( const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > & inputNArray,
const _elementType & inputScalar )

◆ operator-() [4/4]

template<class _nArrayOwnerType1, class _nArrayOwnerType2, class _elementType, vct::size_type _dimension>
vctReturnDynamicNArray< _elementType, _dimension > operator- ( const vctDynamicConstNArrayBase< _nArrayOwnerType1, _elementType, _dimension > & inputNArray1,
const vctDynamicConstNArrayBase< _nArrayOwnerType2, _elementType, _dimension > & inputNArray2 )

◆ operator/() [1/2]

template<class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
vctReturnDynamicNArray< _elementType, _dimension > operator/ ( const _elementType & inputScalar,
const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > & inputNArray )

◆ operator/() [2/2]

template<class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
vctReturnDynamicNArray< _elementType, _dimension > operator/ ( const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > & inputNArray,
const _elementType & inputScalar )

◆ operator=() [1/4]

ThisType & operator= ( const ThisType & otherNArray)

Equals operator: Assignment from a vctDynamicNArray to this nArray (also a vctDynamicNArray). The operation discards the old memory allocated for this nArray and allocates new memory the size of the input vctDynamicNArray. Then the elements of the input vctDynamicNArray are copied into this nArray.

◆ operator=() [2/4]

ThisType & operator= ( const value_type & value)
inline

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

◆ operator=() [3/4]

template<class __nArrayOwnerType, typename __elementType>
ThisType & operator= ( const vctDynamicConstNArrayBase< __nArrayOwnerType, __elementType, _dimension > & otherNArray)

Assignment from an nArray to this nArray. The operation discards the old memory allocated for this nArray and allocates new memory the size of the input nArray. Then the elements of the input nArray are copied into this nArray.

◆ operator=() [4/4]

ThisType & operator= ( const vctReturnDynamicNArray< value_type, _dimension > & otherNArray)

Assignment from a transitional vctReturnDynamicNArray to a vctDynamicNArray variable. This specialized operation does not perform any element copy. Instead it transfers ownership of the data from the other nArray to this nArray, and disowns the other nArray. The right hand side operand must be a temporary object returned, e.g., from a function or overloaded operator.

Todo
This operator needs some revisions.

◆ SetSize()

void SetSize ( const nsize_type & sizes)

Destructive size change. Change the size to the specified size. Discard all of the old values.

◆ VCT_NARRAY_TRAITS_TYPEDEFS()

VCT_NARRAY_TRAITS_TYPEDEFS ( _dimension )

◆ vctDynamicNArray() [1/7]

vctDynamicNArray ( )

Default constructor. Initialize an empty nArray.

◆ vctDynamicNArray() [2/7]

vctDynamicNArray ( const nsize_type & sizes)

Constructor: Create an nArray of the specified sizes. Elements initialized with default constructor.

◆ vctDynamicNArray() [3/7]

vctDynamicNArray ( const nsize_type & sizes,
value_type value )

Constructor: Create an nArray of the specified size and assign all elements a specific value.

◆ vctDynamicNArray() [4/7]

vctDynamicNArray ( const ThisType & otherNArray)

Copy constructor: Allocate memory to store a copy of the other nArray, and copy the elements of the other nArray to this nArray.

◆ vctDynamicNArray() [5/7]

template<class _otherNArrayOwnerType, typename _otherNArrayElementType>
vctDynamicNArray ( const vctDynamicConstNArrayBase< _otherNArrayOwnerType, _otherNArrayElementType, _dimension > & otherNArray)
explicit

Copy constructor: Allocate memory and copy all the elements from the other nArray. This constructor can also be used for type conversions.

◆ vctDynamicNArray() [6/7]

template<class _otherNArrayOwnerType>
vctDynamicNArray ( const vctDynamicConstNArrayBase< _otherNArrayOwnerType, value_type, _dimension > & otherNArray)

◆ vctDynamicNArray() [7/7]

vctDynamicNArray ( const vctReturnDynamicNArray< value_type, _dimension > & otherNArray)

Special copy constructor: Take ownership of the data of a temporary nArray object of type vctReturnDynamicNArray. Disown the other nArray.

◆ vctDynamicNArrayConstElementSlice()

template<class _nArrayOwnerType, class _elementType>
const _elementType & vctDynamicNArrayConstElementSlice ( const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, 1 > & input,
vct::index_type index )
inline

◆ vctDynamicNArrayConstNArraySlice()

template<class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
vctDynamicConstNArrayRef< _elementType, _dimension - 1 > vctDynamicNArrayConstNArraySlice ( const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > & input,
vct::size_type dimension,
vct::index_type index )
inline

◆ vctDynamicNArrayElementSlice()

template<class _nArrayOwnerType, class _elementType>
_elementType & vctDynamicNArrayElementSlice ( vctDynamicNArrayBase< _nArrayOwnerType, _elementType, 1 > & input,
vct::index_type index )
inline

◆ vctDynamicNArrayElementwiseCompareNArray()

template<class _nArrayOwnerType, class __nArrayOwnerType, class _elementType, class _elementOperationType, vct::size_type _dimension>
vctReturnDynamicNArray< bool, _dimension > vctDynamicNArrayElementwiseCompareNArray ( const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > & nArray1,
const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > & nArray2 )
inline

◆ vctDynamicNArrayElementwiseCompareScalar()

template<class _nArrayOwnerType, class _elementType, class _elementOperationType, vct::size_type _dimension>
vctReturnDynamicNArray< bool, _dimension > vctDynamicNArrayElementwiseCompareScalar ( const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > & nArray,
const _elementType & scalar )
inline

◆ vctDynamicNArrayNArraySlice()

template<class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
vctDynamicNArrayRef< _elementType, _dimension - 1 > vctDynamicNArrayNArraySlice ( vctDynamicNArrayBase< _nArrayOwnerType, _elementType, _dimension > & input,
vct::size_type dimension,
vct::index_type index )
inline