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

Declaration of vctDynamicVector. More...

Go to the source code of this file.

Classes

class  vctReturnDynamicVector< _elementType >

Macros

#define _vctDynamicVector_h

Functions

 vctDynamicVector ()
 A vector object of dynamic size.
 vctDynamicVector (size_type size)
 vctDynamicVector (size_type size, value_type value)
 vctDynamicVector (size_type size, value_type element0, value_type element1,...) CISST_THROW(std
 vctDynamicVector (size_type size, const value_type *values)
 vctDynamicVector (const vctReturnDynamicVector< value_type > &otherVector)
 vctDynamicVector (const ThisType &otherVector)
template<class _otherVectorOwnerType>
 vctDynamicVector (const vctDynamicConstVectorBase< _otherVectorOwnerType, value_type > &otherVector)
template<class _otherVectorOwnerType, typename _otherVectorElementType>
 vctDynamicVector (const vctDynamicConstVectorBase< _otherVectorOwnerType, _otherVectorElementType > &otherVector)
template<size_type __size, stride_type __stride, class __elementType, class __dataPtrType>
 vctDynamicVector (const vctFixedSizeConstVectorBase< __size, __stride, __elementType, __dataPtrType > &fixedVector)
template<class __vectorOwnerType, typename __elementType>
ThisTypeoperator= (const vctDynamicConstVectorBase< __vectorOwnerType, __elementType > &otherVector)
ThisTypeoperator= (const ThisType &other)
ThisTypeoperator= (const vctReturnDynamicVector< value_type > &other)
ThisTypeoperator= (const value_type &value)
template<class __vectorOwnerType, typename __elementType>
ThisTypeForceAssign (const vctDynamicConstVectorBase< __vectorOwnerType, __elementType > &other)
template<size_type __size, stride_type __stride, class __elementType, class __dataPtrType>
ThisTypeForceAssign (const vctFixedSizeConstVectorBase< __size, __stride, __elementType, __dataPtrType > &other)
void resize (size_type size)
void SetSize (size_type size)
void SetSize (size_type size, const value_type newValue)
bool FromStreamRaw (std::istream &inputStream, const char delimiter=' ')
void DeSerializeRaw (std::istream &inputStream)
Elementwise operations between dynamic vectors.
template<class _vectorOwnerType1, class _vectorOwnerType2, class _elementType>
vctReturnDynamicVector< _elementType > operator+ (const vctDynamicConstVectorBase< _vectorOwnerType1, _elementType > &inputVector1, const vctDynamicConstVectorBase< _vectorOwnerType2, _elementType > &inputVector2)
template<class _vectorOwnerType1, class _vectorOwnerType2, class _elementType>
vctReturnDynamicVector< _elementType > operator- (const vctDynamicConstVectorBase< _vectorOwnerType1, _elementType > &inputVector1, const vctDynamicConstVectorBase< _vectorOwnerType2, _elementType > &inputVector2)
Cross product between dynamic vectors.
template<class _vectorOwnerType1, class _vectorOwnerType2, class _elementType>
vctReturnDynamicVector< _elementType > operator% (const vctDynamicConstVectorBase< _vectorOwnerType1, _elementType > &inputVector1, const vctDynamicConstVectorBase< _vectorOwnerType2, _elementType > &inputVector2)
template<class _vectorOwnerType1, class _vectorOwnerType2, class _elementType>
vctReturnDynamicVector< _elementType > vctCrossProduct (const vctDynamicConstVectorBase< _vectorOwnerType1, _elementType > &inputVector1, const vctDynamicConstVectorBase< _vectorOwnerType2, _elementType > &inputVector2)
Elementwise operations between a dynamic vector and a

scalar.

template<class _vectorOwnerType, class _elementType>
vctReturnDynamicVector< _elementType > operator+ (const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > &inputVector, const _elementType &inputScalar)
template<class _vectorOwnerType, class _elementType>
vctReturnDynamicVector< _elementType > operator- (const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > &inputVector, const _elementType &inputScalar)
template<class _vectorOwnerType, class _elementType>
vctReturnDynamicVector< _elementType > operator* (const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > &inputVector, const _elementType &inputScalar)
template<class _vectorOwnerType, class _elementType>
vctReturnDynamicVector< _elementType > operator/ (const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > &inputVector, const _elementType &inputScalar)
Elementwise operations between a scalar and a dynamic

vector.

template<class _vectorOwnerType, class _elementType>
vctReturnDynamicVector< _elementType > operator+ (const _elementType &inputScalar, const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > &inputVector)
template<class _vectorOwnerType, class _elementType>
vctReturnDynamicVector< _elementType > operator- (const _elementType &inputScalar, const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > &inputVector)
template<class _vectorOwnerType, class _elementType>
vctReturnDynamicVector< _elementType > operator* (const _elementType &inputScalar, const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > &inputVector)
template<class _vectorOwnerType, class _elementType>
vctReturnDynamicVector< _elementType > operator/ (const _elementType &inputScalar, const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > &inputVector)
Elementwise operations on a dynamic vector.
template<class _vectorOwnerType, class _elementType>
vctReturnDynamicVector< _elementType > operator- (const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > &inputVector)
template<class _vectorOwnerType, class __vectorOwnerType, class _elementType, class _elementOperationType>
vctReturnDynamicVector< bool > vctDynamicVectorElementwiseCompareVector (const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > &vector1, const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > &vector2)
template<class _vectorOwnerType, class _elementType, class _elementOperationType>
vctReturnDynamicVector< bool > vctDynamicVectorElementwiseCompareScalar (const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > &vector, const _elementType &scalar)

Detailed Description

Declaration of vctDynamicVector.

Macro Definition Documentation

◆ _vctDynamicVector_h

#define _vctDynamicVector_h

Function Documentation

◆ DeSerializeRaw()

void DeSerializeRaw ( std::istream & inputStream)

Binary deserialization

◆ ForceAssign() [1/2]

template<class __vectorOwnerType, typename __elementType>
ThisType & ForceAssign ( const vctDynamicConstVectorBase< __vectorOwnerType, __elementType > & other)
inline

◆ ForceAssign() [2/2]

template<size_type __size, stride_type __stride, class __elementType, class __dataPtrType>
ThisType & ForceAssign ( const vctFixedSizeConstVectorBase< __size, __stride, __elementType, __dataPtrType > & other)
inline

◆ FromStreamRaw()

bool FromStreamRaw ( std::istream & inputStream,
const char delimiter = ' ' )

Read from an unformatted text input (e.g., one created by ToStreamRaw). Returns true if successful. This particular implementation assumes that the correct vector size is already set.

◆ operator%()

template<class _vectorOwnerType1, class _vectorOwnerType2, class _elementType>
vctReturnDynamicVector< _elementType > operator% ( const vctDynamicConstVectorBase< _vectorOwnerType1, _elementType > & inputVector1,
const vctDynamicConstVectorBase< _vectorOwnerType2, _elementType > & inputVector2 )

The cross product between two dynamic vectors will assert that both input vectors are of size 3.

Parameters
inputVector1left operand of the cross product
inputVector2right operand of the cross product
Returns
The cross product as a vctReturnDynamicVector

◆ operator*() [1/2]

template<class _vectorOwnerType, class _elementType>
vctReturnDynamicVector< _elementType > operator* ( const _elementType & inputScalar,
const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > & inputVector )

◆ operator*() [2/2]

template<class _vectorOwnerType, class _elementType>
vctReturnDynamicVector< _elementType > operator* ( const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > & inputVector,
const _elementType & inputScalar )

◆ operator+() [1/3]

template<class _vectorOwnerType, class _elementType>
vctReturnDynamicVector< _elementType > operator+ ( const _elementType & inputScalar,
const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > & inputVector )

Operation between a scalar and a dynamic vector.

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

◆ operator+() [2/3]

template<class _vectorOwnerType, class _elementType>
vctReturnDynamicVector< _elementType > operator+ ( const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > & inputVector,
const _elementType & inputScalar )

Operation between a dynamic vector and a scalar.

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

◆ operator+() [3/3]

template<class _vectorOwnerType1, class _vectorOwnerType2, class _elementType>
vctReturnDynamicVector< _elementType > operator+ ( const vctDynamicConstVectorBase< _vectorOwnerType1, _elementType > & inputVector1,
const vctDynamicConstVectorBase< _vectorOwnerType2, _elementType > & inputVector2 )

Operation between dynamic vectors (same size).

Parameters
inputVector1The first operand of the binary operation.
inputVector2The second operand of the binary operation.
Returns
The vector result of \(op(vector1, vector2)\).

◆ operator-() [1/4]

template<class _vectorOwnerType, class _elementType>
vctReturnDynamicVector< _elementType > operator- ( const _elementType & inputScalar,
const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > & inputVector )

◆ operator-() [2/4]

template<class _vectorOwnerType, class _elementType>
vctReturnDynamicVector< _elementType > operator- ( const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > & inputVector)

Unary operation on a dynamic vector.

Parameters
inputVectorThe operand of the unary operation
Returns
The vector result of \(op(vector)\).

◆ operator-() [3/4]

template<class _vectorOwnerType, class _elementType>
vctReturnDynamicVector< _elementType > operator- ( const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > & inputVector,
const _elementType & inputScalar )

◆ operator-() [4/4]

template<class _vectorOwnerType1, class _vectorOwnerType2, class _elementType>
vctReturnDynamicVector< _elementType > operator- ( const vctDynamicConstVectorBase< _vectorOwnerType1, _elementType > & inputVector1,
const vctDynamicConstVectorBase< _vectorOwnerType2, _elementType > & inputVector2 )

◆ operator/() [1/2]

template<class _vectorOwnerType, class _elementType>
vctReturnDynamicVector< _elementType > operator/ ( const _elementType & inputScalar,
const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > & inputVector )

◆ operator/() [2/2]

template<class _vectorOwnerType, class _elementType>
vctReturnDynamicVector< _elementType > operator/ ( const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > & inputVector,
const _elementType & inputScalar )

◆ operator=() [1/4]

ThisType & operator= ( const ThisType & other)

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

◆ operator=() [2/4]

ThisType & operator= ( const value_type & value)
inline

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

◆ operator=() [3/4]

template<class __vectorOwnerType, typename __elementType>
ThisType & operator= ( const vctDynamicConstVectorBase< __vectorOwnerType, __elementType > & otherVector)

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

◆ operator=() [4/4]

ThisType & operator= ( const vctReturnDynamicVector< value_type > & other)

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

◆ resize()

void resize ( size_type size)

Non-destructive size change. Change the size to the specified size, and copy as many elements as possible from the former vector.

◆ SetSize() [1/2]

void SetSize ( size_type size)

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

◆ SetSize() [2/2]

void SetSize ( size_type size,
const value_type newValue )

◆ vctCrossProduct()

template<class _vectorOwnerType1, class _vectorOwnerType2, class _elementType>
vctReturnDynamicVector< _elementType > vctCrossProduct ( const vctDynamicConstVectorBase< _vectorOwnerType1, _elementType > & inputVector1,
const vctDynamicConstVectorBase< _vectorOwnerType2, _elementType > & inputVector2 )

◆ vctDynamicVector() [1/9]

vctDynamicVector ( const ThisType & otherVector)

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

◆ vctDynamicVector() [2/9]

template<class _otherVectorOwnerType, typename _otherVectorElementType>
vctDynamicVector ( const vctDynamicConstVectorBase< _otherVectorOwnerType, _otherVectorElementType > & otherVector)
explicit

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

◆ vctDynamicVector() [3/9]

template<class _otherVectorOwnerType>
vctDynamicVector ( const vctDynamicConstVectorBase< _otherVectorOwnerType, value_type > & otherVector)

Copy constructor: Allocate memory and copy all the elements from the other vector.

◆ vctDynamicVector() [4/9]

template<size_type __size, stride_type __stride, class __elementType, class __dataPtrType>
vctDynamicVector ( const vctFixedSizeConstVectorBase< __size, __stride, __elementType, __dataPtrType > & fixedVector)
explicit

Constructor from a fixed-size vector

◆ vctDynamicVector() [5/9]

vctDynamicVector ( const vctReturnDynamicVector< value_type > & otherVector)

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

◆ vctDynamicVector() [6/9]

vctDynamicVector ( size_type size)
explicit

Constructor: Create a vector of the specified size. Elements initialized with default constructor.

◆ vctDynamicVector() [7/9]

vctDynamicVector ( size_type size,
const value_type * values )

Constructor: Create a vector of the specified size and assign the elements values from the memory block pointed to

◆ vctDynamicVector() [8/9]

vctDynamicVector ( size_type size,
value_type element0,
value_type element1,
... )

Constructor for any size greater than or equal to 2, using stdarg macros and variable number of arguments. This operation assumes that all the arguments are of type value_type, and that their number is equal to the size of the vector. The user may need to explicitly cast the parameters to value_type to avoid runtime bugs and errors. We have not checked if stdarg macros can use reference types (probably not), so unlike the other constructors, this constructor takes all arguments by value.

Note
This constructor does not assert that the size is correct, as there is no way to know how many arguments were passed.

◆ vctDynamicVector() [9/9]

vctDynamicVector ( size_type size,
value_type value )

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

◆ vctDynamicVectorElementwiseCompareScalar()

template<class _vectorOwnerType, class _elementType, class _elementOperationType>
vctReturnDynamicVector< bool > vctDynamicVectorElementwiseCompareScalar ( const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > & vector,
const _elementType & scalar )
inline

◆ vctDynamicVectorElementwiseCompareVector()

template<class _vectorOwnerType, class __vectorOwnerType, class _elementType, class _elementOperationType>
vctReturnDynamicVector< bool > vctDynamicVectorElementwiseCompareVector ( const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > & vector1,
const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > & vector2 )
inline