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

A vector object of dynamic size. More...

#include <vctDynamicVector.h>

Inheritance diagram for vctDynamicVector< _elementType >:
vctDynamicVectorBase< vctDynamicVectorOwner< _elementType >, _elementType > vctDynamicConstVectorBase< _vectorOwnerType, _elementType > mtsHistory< _elementType > mtsVector< _elementType > vctReturnDynamicVector< _elementType >

Public Types

typedef vctDynamicVector
< _elementType > 
ThisType
 
typedef vctDynamicVectorBase
< vctDynamicVectorOwner
< _elementType >, _elementType > 
BaseType
 
typedef BaseType::CopyType CopyType
 
typedef BaseType::TypeTraits TypeTraits
 
typedef
BaseType::ElementVaArgPromotion 
ElementVaArgPromotion
 
- Public Types inherited from vctDynamicVectorBase< vctDynamicVectorOwner< _elementType >, _elementType >
typedef vctDynamicVectorBase ThisType
 
typedef
vctDynamicConstVectorBase
< vctDynamicVectorOwner
< _elementType >, _elementType > 
BaseType
 
typedef vctDynamicVectorOwner
< _elementType > 
VectorOwnerType
 
typedef BaseType::iterator iterator
 
typedef BaseType::reverse_iterator reverse_iterator
 
typedef BaseType::const_iterator const_iterator
 
typedef
BaseType::const_reverse_iterator 
const_reverse_iterator
 
typedef BaseType::CopyType CopyType
 
typedef BaseType::VectorValueType VectorValueType
 
typedef class cmnTypeTraits
< value_type > 
TypeTraits
 
typedef TypeTraits::VaArgPromotion ElementVaArgPromotion
 
- Public Types inherited from vctDynamicConstVectorBase< _vectorOwnerType, _elementType >
typedef
vctDynamicConstVectorBase
< _vectorOwnerType,
_elementType > 
ThisType
 
typedef _vectorOwnerType 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 vctDynamicVector
< _elementType > 
CopyType
 
typedef vctDynamicVector
< _elementType > 
VectorValueType
 
typedef vctDynamicVector
< _elementType > 
VectorReturnType
 
typedef cmnTypeTraits< value_type > TypeTraits
 
typedef TypeTraits::BoolType BoolType
 
typedef vctReturnDynamicVector
< BoolType
BoolVectorReturnType
 

Public Member Functions

 VCT_CONTAINER_TRAITS_TYPEDEFS (_elementType)
 
 vctDynamicVector ()
 
 vctDynamicVector (size_type size)
 
 vctDynamicVector (size_type size, value_type value)
 
 vctDynamicVector (size_type size, value_type element0, value_type element1,...) throw (std::runtime_error)
 
 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)
 
bool FromStreamRaw (std::istream &inputStream, const char delimiter= ' ')
 
void DeSerializeRaw (std::istream &inputStream)
 
template<class _elementType >
 vctDynamicVector (const vctReturnDynamicVector< _elementType > &other)
 
template<class _elementType >
vctDynamicVector< _elementType > & operator= (const vctReturnDynamicVector< _elementType > &other)
 
- Public Member Functions inherited from vctDynamicVectorBase< vctDynamicVectorOwner< _elementType >, _elementType >
 VCT_CONTAINER_TRAITS_TYPEDEFS (_elementType)
 
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
 
reference operator[] (index_type index)
 
const_reference operator[] (index_type index) const
 
const VectorOwnerTypeOwner (void) const
 
VectorOwnerTypeOwner (void)
 
pointer Pointer (index_type index=0)
 
const_pointer Pointer (index_type index=0) const
 
reference at (index_type index) throw (std::out_of_range)
 
const_reference at (index_type index) const throw (std::out_of_range)
 
reference operator() (index_type index) throw (std::out_of_range)
 
const_reference operator() (index_type index) const throw (std::out_of_range)
 
reference Element (index_type index)
 
const_reference Element (index_type index) const
 
value_type SetAll (const value_type value)
 
bool Zeros (void)
 
ThisTypeAssign (const value_type *elements)
 
ThisTypeAssign (value_type element0, value_type element1,...) throw (std::runtime_error)
 
ThisTypeConcatenationOf (const vctDynamicConstVectorBase< __vectorOwnerType, __elementType > &otherVector, __elementType lastElement)
 
void SelectFrom (const vctDynamicConstVectorBase< __inputVectorOwner, _elementType > &input, const vctDynamicConstVectorBase< __indexVectorOwner, index_type > &index)
 
void CrossProductOf (const vctDynamicConstVectorBase< __vectorOwnerType1, _elementType > &inputVector1, const vctDynamicConstVectorBase< __vectorOwnerType2, _elementType > &inputVector2)
 
ThisTypeAddProductOf (const value_type scalar, const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector)
 
ThisTypeAddElementwiseProductOf (const vctDynamicConstVectorBase< __vectorOwnerType1, _elementType > &vector1, const vctDynamicConstVectorBase< __vectorOwnerType2, _elementType > &vector2)
 
ThisTypeAssign (const vctDynamicConstVectorBase< __vectorOwnerType, value_type > &other)
 
ThisTypeAssign (const vctDynamicConstVectorBase< __vectorOwnerType, value_type > &other, size_type length, size_type startPositionThis=0, size_type startPositionOther=0)
 
ThisTypeAssign (const vctDynamicConstVectorBase< __vectorOwnerType, __elementType > &other)
 
ThisTypeAssign (const vctFixedSizeConstVectorBase< __size, __stride, __elementType, __dataPtrType > &other)
 
ThisTypeoperator= (const vctDynamicConstVectorBase< __vectorOwnerType, __elementType > &other)
 
ThisTypeForceAssign (const vctDynamicConstVectorBase< __vectorOwnerType, __elementType > &other)
 
ThisTypeForceAssign (const vctFixedSizeConstVectorBase< __size, __stride, __elementType, __dataPtrType > &other)
 
bool FastCopyOf (const vctDynamicConstVectorBase< __vectorOwnerType, value_type > &source, bool performSafetyChecks=true) throw (std::runtime_error)
 
bool FastCopyOf (const vctFixedSizeConstVectorBase< __size, __stride, value_type, __dataPtrType > &source, bool performSafetyChecks=true) throw (std::runtime_error)
 
value_type & X (void)
 
const value_type & X (void) const
 
value_type & Y (void)
 
const value_type & Y (void) const
 
value_type & Z (void)
 
const value_type & Z (void) const
 
value_type & W (void)
 
const value_type & W (void) const
 
vctDynamicVectorRef< _elementType > XY (void)
 
vctDynamicConstVectorRef
< _elementType > 
XY (void) const
 
vctDynamicVectorRef< _elementType > XZ (void)
 
vctDynamicConstVectorRef
< _elementType > 
XZ (void) const
 
vctDynamicVectorRef< _elementType > XW (void)
 
vctDynamicConstVectorRef
< _elementType > 
XW (void) const
 
vctDynamicVectorRef< _elementType > YZ (void)
 
vctDynamicConstVectorRef
< _elementType > 
YZ (void) const
 
vctDynamicVectorRef< _elementType > YW (void)
 
vctDynamicConstVectorRef
< _elementType > 
YW (void) const
 
vctDynamicVectorRef< _elementType > ZW (void)
 
vctDynamicConstVectorRef
< _elementType > 
ZW (void) const
 
vctDynamicVectorRef< _elementType > XYZ (void)
 
vctDynamicConstVectorRef
< _elementType > 
XYZ (void) const
 
vctDynamicVectorRef< _elementType > YZW (void)
 
vctDynamicConstVectorRef
< _elementType > 
YZW (void) const
 
vctDynamicVectorRef< _elementType > XYZW (void)
 
vctDynamicConstVectorRef
< _elementType > 
XYZW (void) const
 
vctDynamicVectorRef< _elementType > Ref (const size_type size, const size_type startPosition=0) throw (std::out_of_range)
 
vctDynamicConstVectorRef
< _elementType > 
Ref (const size_type size, const size_type startPosition=0) const throw (std::out_of_range)
 
ThisTypeSumOf (const vctDynamicConstVectorBase< __vectorOwnerType1, _elementType > &vector1, const vctDynamicConstVectorBase< __vectorOwnerType2, _elementType > &vector2)
 
ThisTypeDifferenceOf (const vctDynamicConstVectorBase< __vectorOwnerType1, _elementType > &vector1, const vctDynamicConstVectorBase< __vectorOwnerType2, _elementType > &vector2)
 
ThisTypeElementwiseProductOf (const vctDynamicConstVectorBase< __vectorOwnerType1, _elementType > &vector1, const vctDynamicConstVectorBase< __vectorOwnerType2, _elementType > &vector2)
 
ThisTypeElementwiseRatioOf (const vctDynamicConstVectorBase< __vectorOwnerType1, _elementType > &vector1, const vctDynamicConstVectorBase< __vectorOwnerType2, _elementType > &vector2)
 
ThisTypeElementwiseMinOf (const vctDynamicConstVectorBase< __vectorOwnerType1, _elementType > &vector1, const vctDynamicConstVectorBase< __vectorOwnerType2, _elementType > &vector2)
 
ThisTypeElementwiseMaxOf (const vctDynamicConstVectorBase< __vectorOwnerType1, _elementType > &vector1, const vctDynamicConstVectorBase< __vectorOwnerType2, _elementType > &vector2)
 
ThisTypeElementwiseClippedInOf (const vctDynamicConstVectorBase< __vectorOwnerType1, _elementType > &boundVector, const vctDynamicConstVectorBase< __vectorOwnerType2, _elementType > &vector)
 
ThisTypeAdd (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector)
 
ThisTypeSubtract (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector)
 
ThisTypeElementwiseMultiply (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector)
 
ThisTypeElementwiseDivide (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector)
 
ThisTypeElementwiseMin (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector)
 
ThisTypeElementwiseMax (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector)
 
ThisTypeElementwiseClipIn (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &boundVector)
 
ThisTypeoperator+= (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector)
 
ThisTypeoperator-= (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector)
 
ThisTypeSwapElementsWith (vctDynamicVectorBase< __vectorOwnerType, _elementType > &otherVector)
 
ThisTypeSumOf (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &vector, const value_type scalar)
 
ThisTypeDifferenceOf (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &vector, const value_type scalar)
 
ThisTypeProductOf (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &vector, const value_type scalar)
 
ThisTypeRatioOf (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &vector, const value_type scalar)
 
ThisTypeClippedAboveOf (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &vector, const value_type upperBound)
 
ThisTypeClippedBelowOf (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &vector, const value_type lowerBound)
 
ThisTypeClippedInOf (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &vector, const value_type bound)
 
ThisTypeSumOf (const value_type scalar, const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &vector)
 
ThisTypeDifferenceOf (const value_type scalar, const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &vector)
 
ThisTypeProductOf (const value_type scalar, const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &vector)
 
ThisTypeRatioOf (const value_type scalar, const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &vector)
 
ThisTypeClippedAboveOf (const value_type upperBound, const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &vector)
 
ThisTypeClippedBelowOf (const value_type lowerBound, const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &vector)
 
ThisTypeClippedInOf (const value_type bound, const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &vector)
 
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)
 
ThisTypeClipIn (const value_type bound)
 
ThisTypeoperator*= (const value_type scalar)
 
ThisTypeoperator/= (const value_type scalar)
 
ThisTypeProductOf (const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &inputMatrix, const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &inputVector)
 
ThisTypeProductOf (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &inputVector, const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &inputMatrix)
 
ThisTypeAbsOf (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector)
 
ThisTypeNegationOf (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector)
 
ThisTypeFloorOf (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector)
 
ThisTypeCeilOf (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector)
 
ThisTypeNormalizedOf (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector) throw (std::runtime_error)
 
ThisTypeAbsSelf (void)
 
ThisTypeNegationSelf (void)
 
ThisTypeFloorSelf (void)
 
ThisTypeCeilSelf (void)
 
ThisTypeNormalizedSelf (void) throw (std::runtime_error)
 
- Public Member Functions inherited from vctDynamicConstVectorBase< _vectorOwnerType, _elementType >
 VCT_CONTAINER_TRAITS_TYPEDEFS (_elementType)
 
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
 
difference_type stride () const
 
bool empty () const
 
const_reference operator[] (index_type index) const
 
const_reference at (size_type index) const throw (std::out_of_range)
 
const_reference operator() (size_type index) const throw (std::out_of_range)
 
const_reference Element (size_type index) const
 
const OwnerTypeOwner (void) const
 
const_pointer Pointer (index_type index=0) const
 
bool ValidIndex (size_type index) const
 
vctDynamicConstVectorRef
< _elementType > 
Ref (const size_type size, const size_type startPosition=0) const throw (std::out_of_range)
 
template<class __vectorOwnerType >
value_type DotProduct (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector) const
 
std::string ToString (void) const
 
void ToStream (std::ostream &outputStream) const
 
void ToStreamRaw (std::ostream &outputStream, const char delimiter= ' ', bool headerOnly=false, const std::string &headerPrefix="") const
 
void SerializeRaw (std::ostream &outputStream) const
 
const value_type & X (void) const
 
const value_type & Y (void) const
 
const value_type & Z (void) const
 
const value_type & W (void) const
 
vctDynamicConstVectorRef
< _elementType > 
XY (void) const
 
vctDynamicConstVectorRef
< _elementType > 
XZ (void) const
 
vctDynamicConstVectorRef
< _elementType > 
XW (void) const
 
vctDynamicConstVectorRef
< _elementType > 
YZ (void) const
 
vctDynamicConstVectorRef
< _elementType > 
YW (void) const
 
vctDynamicConstVectorRef
< _elementType > 
ZW (void) const
 
vctDynamicConstVectorRef
< _elementType > 
XYZ (void) const
 
vctDynamicConstVectorRef
< _elementType > 
YZW (void) const
 
vctDynamicConstVectorRef
< _elementType > 
XYZW (void) const
 
value_type SumOfElements (void) const
 
value_type ProductOfElements (void) const
 
value_type NormSquare (void) const
 
NormType Norm (void) const
 
bool IsNormalized (void) const
 
bool IsNormalized (_elementType tolerance) 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 IsFortran (void) const
 
template<class __vectorOwnerType >
bool FastCopyCompatible (const vctDynamicConstVectorBase< __vectorOwnerType, value_type > &source) const
 
template<size_type __size, stride_type __stride, class __dataPtrType >
bool FastCopyCompatible (const vctFixedSizeConstVectorBase< __size, __stride, value_type, __dataPtrType > &source) const
 
template<class __vectorOwnerType >
bool Equal (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector) const
 
template<class __vectorOwnerType >
bool operator== (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector) const
 
template<class __vectorOwnerType >
bool AlmostEqual (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector, value_type tolerance) const
 
template<class __vectorOwnerType >
bool AlmostEqual (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector) const
 
template<class __vectorOwnerType >
bool NotEqual (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector) const
 
template<class __vectorOwnerType >
bool operator!= (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector) const
 
template<class __vectorOwnerType >
bool Lesser (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector) const
 
template<class __vectorOwnerType >
bool LesserOrEqual (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector) const
 
template<class __vectorOwnerType >
bool Greater (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector) const
 
template<class __vectorOwnerType >
bool GreaterOrEqual (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector) const
 
template<class __vectorOwnerType >
BoolVectorReturnType ElementwiseEqual (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector) const
 
template<class __vectorOwnerType >
BoolVectorReturnType ElementwiseNotEqual (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector) const
 
template<class __vectorOwnerType >
BoolVectorReturnType ElementwiseLesser (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector) const
 
template<class __vectorOwnerType >
BoolVectorReturnType ElementwiseLesserOrEqual (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector) const
 
template<class __vectorOwnerType >
BoolVectorReturnType ElementwiseGreater (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector) const
 
template<class __vectorOwnerType >
BoolVectorReturnType ElementwiseGreaterOrEqual (const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector) 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
 
BoolVectorReturnType ElementwiseEqual (const value_type &scalar) const
 
BoolVectorReturnType ElementwiseNotEqual (const value_type &scalar) const
 
BoolVectorReturnType ElementwiseLesser (const value_type &scalar) const
 
BoolVectorReturnType ElementwiseLesserOrEqual (const value_type &scalar) const
 
BoolVectorReturnType ElementwiseGreater (const value_type &scalar) const
 
BoolVectorReturnType ElementwiseGreaterOrEqual (const value_type &scalar) const
 
VectorReturnType Abs (void) const
 
VectorReturnType Negation (void) const
 
VectorReturnType Floor (void) const
 
VectorReturnType Ceil (void) const
 
VectorReturnType Normalized (void) const throw (std::runtime_error)
 

Friends

class vctReturnDynamicVector< _elementType >
 

Additional Inherited Members

- Protected Member Functions inherited from vctDynamicConstVectorBase< _vectorOwnerType, _elementType >
void ThrowUnlessValidIndex (size_type index) const throw (std::out_of_range)
 
- Protected Attributes inherited from vctDynamicConstVectorBase< _vectorOwnerType, _elementType >
OwnerType Vector
 

Detailed Description

template<class _elementType>
class vctDynamicVector< _elementType >

A vector object of dynamic size.

This class defines a vector object of dynamic size with memory allocation. Note that unlike the STL vector class (std::vector), this class is not meant to be used as a dynamic container, but in vector algebra.

The algebraic operations are mostly inherited from the base classes vctDynamicVectorBase and vctDynamicConstVectorBase. Here, we will briefly describe the specific properties of vctDynamicVector, with a few usage examples.

  1. The class is templated by its element type, that is, the vector element. Normally, the element should be an arithmetic type, that is, support all the standard arithmetic operations: +, -, *, /, =, ==, <, >, <=, >=, ...
  2. The class uses dynamically allocated memory, and, more importantly, owns the memory. That is, a vctDynamicVector object automatically frees the allocated memory it owns when it is destroyed.
  3. To allocate the memory, use one of the following operations.
    // define a typical element type
    typedef double ElementType;
    // the vectorSize variable can be set to any value at any time
    // before creating the vector.
    size_t vectorSize = 12;
    // constructor allocation
    // Create an empty vector and later allocate memory.
    v2.SetSize(vectorSize);
    // Create a dynamic vector of some size and then change it.
    // This operation does not preserve any elements in the resized
    // vector
    vctDynamicVector<Elements> v3(3 * vectorSize);
    v3.SetSize(2 * vectorSize);
    // resize a vector and keep as many elements as possible.
    v3.resize(vectorSize);
    // Store an algebraic result to a new vector. In this case,
    // memory is allocated by the algebraic operation, and then
    // attached to the vector object.
  4. Vector assignment can be facilitated through the Assign method (defined in the base class) or as follows.
    // Initialize all elements to the same value
    vctDynamicVector<ElementType> v5(vectorSize, 2.0);
    // Initialize the elements by specific value. NOTE: All the
    // arguments MUST be of type ElementType
    1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0);
    // Assign one vector to another. This operation reallocates
    // space for the target vector. Note that the right-hand-side
    // object can be any ``dynamic'' vector of any element type,
    // not just a vctDynamicVector<ElementType>
    vctDynamicMatrix<int> someNumbers(numRows, numCols);
    v1 = someNumbers.Column(2);

A few more notes.

Parameters
_elementTypethe type of an element in the vector
See Also
vctDynamicVectorBase vctDynamicConstVectorBase

Member Typedef Documentation

template<class _elementType>
typedef vctDynamicVectorBase<vctDynamicVectorOwner<_elementType>, _elementType> vctDynamicVector< _elementType >::BaseType
template<class _elementType>
typedef BaseType::CopyType vctDynamicVector< _elementType >::CopyType
template<class _elementType>
typedef BaseType::ElementVaArgPromotion vctDynamicVector< _elementType >::ElementVaArgPromotion
template<class _elementType>
typedef vctDynamicVector<_elementType> vctDynamicVector< _elementType >::ThisType
template<class _elementType>
typedef BaseType::TypeTraits vctDynamicVector< _elementType >::TypeTraits

Constructor & Destructor Documentation

template<class _elementType>
vctDynamicVector< _elementType >::vctDynamicVector ( )
inline

Default constructor. Initialize an empty vector.

template<class _elementType>
vctDynamicVector< _elementType >::vctDynamicVector ( size_type  size)
inlineexplicit

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

template<class _elementType>
vctDynamicVector< _elementType >::vctDynamicVector ( size_type  size,
value_type  value 
)
inline

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

template<class _elementType>
vctDynamicVector< _elementType >::vctDynamicVector ( size_type  size,
value_type  element0,
value_type  element1,
  ... 
)
throw (std::runtime_error
)
inline

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.
template<class _elementType>
vctDynamicVector< _elementType >::vctDynamicVector ( size_type  size,
const value_type *  values 
)
inline

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

template<class _elementType>
vctDynamicVector< _elementType >::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.

template<class _elementType>
vctDynamicVector< _elementType >::vctDynamicVector ( const ThisType otherVector)
inline

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

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

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

template<class _elementType>
template<class _otherVectorOwnerType , typename _otherVectorElementType >
vctDynamicVector< _elementType >::vctDynamicVector ( const vctDynamicConstVectorBase< _otherVectorOwnerType, _otherVectorElementType > &  otherVector)
inlineexplicit

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

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

Constructor from a fixed-size vector

template<class _elementType>
template<class _elementType >
vctDynamicVector< _elementType >::vctDynamicVector ( const vctReturnDynamicVector< _elementType > &  other)

Member Function Documentation

template<class _elementType>
void vctDynamicVector< _elementType >::DeSerializeRaw ( std::istream &  inputStream)
inline

Binary deserialization

template<class _elementType>
template<class __vectorOwnerType , typename __elementType >
ThisType& vctDynamicVector< _elementType >::ForceAssign ( const vctDynamicConstVectorBase< __vectorOwnerType, __elementType > &  other)
inline
template<class _elementType>
template<size_type __size, stride_type __stride, class __elementType , class __dataPtrType >
ThisType& vctDynamicVector< _elementType >::ForceAssign ( const vctFixedSizeConstVectorBase< __size, __stride, __elementType, __dataPtrType > &  other)
inline
template<class _elementType>
bool vctDynamicVector< _elementType >::FromStreamRaw ( std::istream &  inputStream,
const char  delimiter = ' ' 
)
inline

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.

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

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.

template<class _elementType>
ThisType& vctDynamicVector< _elementType >::operator= ( const ThisType other)
inline

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.

template<class _elementType>
ThisType& vctDynamicVector< _elementType >::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.

template<class _elementType>
ThisType& vctDynamicVector< _elementType >::operator= ( const value_type &  value)
inline

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

template<class _elementType>
template<class _elementType >
vctDynamicVector<_elementType>& vctDynamicVector< _elementType >::operator= ( const vctReturnDynamicVector< _elementType > &  other)
template<class _elementType>
void vctDynamicVector< _elementType >::resize ( size_type  size)
inline

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

template<class _elementType>
void vctDynamicVector< _elementType >::SetSize ( size_type  size)
inline

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

template<class _elementType>
vctDynamicVector< _elementType >::VCT_CONTAINER_TRAITS_TYPEDEFS ( _elementType  )

Friends And Related Function Documentation

template<class _elementType>
friend class vctReturnDynamicVector< _elementType >
friend

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