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

Implementation of a fixed-size vector using template metaprogramming. More...

#include <vctFixedSizeVector.h>

Inheritance diagram for vctFixedSizeVector< _elementType, _size >:
vctFixedSizeVectorBase< _size, 1, _elementType, vctFixedSizeVectorTraits< _elementType, _size, 1 >::array > vctFixedSizeConstVectorBase< _size, _stride, _elementType, _dataPtrType > mtsFixedSizeVector< _elementType, _size > vctBarycentricVector< _elementType, _size >

Public Types

enum  { SIZEMINUSONE = _size - 1 }
 
typedef
vctFixedSizeVectorTraits
< _elementType, _size, 1 > 
VectorTraits
 
typedef vctFixedSizeVector
< value_type, _size > 
ThisType
 
typedef vctFixedSizeVectorBase
< _size, 1, _elementType,
typename VectorTraits::array
BaseType
 
typedef BaseType::CopyType CopyType
 
typedef class cmnTypeTraits
< value_type > 
TypeTraits
 
typedef TypeTraits::VaArgPromotion ElementVaArgPromotion
 
- Public Types inherited from vctFixedSizeVectorBase< _size, 1, _elementType, vctFixedSizeVectorTraits< _elementType, _size, 1 >::array >
enum  
 
enum  
 
enum  
 
typedef
vctFixedSizeVectorTraits
< _elementType, _size, _stride > 
VectorTraits
 
typedef vctFixedSizeVectorBase
< _size, _stride, _elementType,
vctFixedSizeVectorTraits
< _elementType, _size, 1 >
::array > 
ThisType
 
typedef
vctFixedSizeConstVectorBase
< _size, _stride, _elementType,
vctFixedSizeVectorTraits
< _elementType, _size, 1 >
::array > 
BaseType
 
typedef BaseType::CopyType CopyType
 
typedef cmnTypeTraits< value_type > TypeTraits
 
typedef VectorTraits::iterator iterator
 
typedef
VectorTraits::const_iterator 
const_iterator
 
typedef
VectorTraits::reverse_iterator 
reverse_iterator
 
typedef
VectorTraits::const_reverse_iterator 
const_reverse_iterator
 
typedef
BaseType::RowConstMatrixRefType 
RowConstMatrixRefType
 
typedef BaseType::RowMatrixRefType RowMatrixRefType
 
typedef
BaseType::ColConstMatrixRefType 
ColConstMatrixRefType
 
typedef BaseType::ColMatrixRefType ColMatrixRefType
 
- Public Types inherited from vctFixedSizeConstVectorBase< _size, _stride, _elementType, _dataPtrType >
enum  { SIZE = VectorTraits::SIZE }
 
enum  { STRIDE = VectorTraits::STRIDE }
 
typedef
vctFixedSizeConstVectorBase
< _size, _stride, _elementType,
_dataPtrType > 
ThisType
 
typedef
vctFixedSizeVectorTraits
< _elementType, _size, _stride > 
VectorTraits
 
typedef VectorTraits::iterator iterator
 
typedef
VectorTraits::const_iterator 
const_iterator
 
typedef
VectorTraits::reverse_iterator 
reverse_iterator
 
typedef
VectorTraits::const_reverse_iterator 
const_reverse_iterator
 
typedef vctFixedSizeVector
< _elementType, _size > 
VectorValueType
 
typedef vctFixedSizeVector
< _elementType, _size > 
CopyType
 
typedef vctFixedSizeVector
< bool, _size > 
BoolVectorValueType
 
typedef
vctFixedSizeConstMatrixRef
< _elementType, 1, _size,
_stride *_size, _stride > 
RowConstMatrixRefType
 
typedef vctFixedSizeMatrixRef
< _elementType, 1, _size,
_stride *_size, _stride > 
RowMatrixRefType
 
typedef
vctFixedSizeConstMatrixRef
< _elementType, _size,
1, _stride, _stride *_size > 
ColConstMatrixRefType
 
typedef vctFixedSizeMatrixRef
< _elementType, _size,
1, _stride, _stride *_size > 
ColMatrixRefType
 

Public Member Functions

 VCT_CONTAINER_TRAITS_TYPEDEFS (_elementType)
 
 vctFixedSizeVector ()
 
 vctFixedSizeVector (const value_type &value)
 
template<class __elementType , stride_type __stride, class __dataPtrType >
 vctFixedSizeVector (const vctFixedSizeConstVectorBase< _size, __stride, __elementType, __dataPtrType > &vector)
 
template<stride_type __stride, class __dataPtrType >
 vctFixedSizeVector (const vctFixedSizeConstVectorBase< SIZEMINUSONE, __stride, _elementType, __dataPtrType > &vector, value_type lastElement)
 
template<class __elementType >
 vctFixedSizeVector (const __elementType *elements)
 
template<class __vectorOwnerType >
 vctFixedSizeVector (const vctDynamicConstVectorBase< __vectorOwnerType, value_type > &vector)
 
ThisTypeoperator= (const value_type &value)
 
bool FromStreamRaw (std::istream &inputStream, const char delimiter= ' ')
 
void DeSerializeRaw (std::istream &inputStream)
 
template<stride_type __stride>
 vctFixedSizeVector (const vctFixedSizeConstVectorRef< _elementType, _size, __stride > &vector)
 
template<stride_type __stride>
 vctFixedSizeVector (const vctFixedSizeVectorRef< _elementType, _size, __stride > &vector)
 
Size dependant constructors.

The following methods are size dependant, i.e. don't necessarily mean anything for all sizes of vector. For example, using the constructor vctFixedSizeVector(value, value, value) on a vector of size 2 shouldn't be allowed. It would have been possible to check these errors at compilation time, but this would require an overhead of code and therefore execution time which is not worth it. Therefore, we are using CMN_ASSERT to check that the template parameter _size is valid

Note
Using CMN_ASSERT on a template parameter still allows the compiler to perform some optimization, which would be harder if assert was testing a method paramater.
The constructor with one argument is reserved for a SetAll semantics.
 vctFixedSizeVector (const value_type &element0, const value_type &element1)
 
 vctFixedSizeVector (const value_type &element0, const value_type &element1, const value_type &element2)
 
 vctFixedSizeVector (const value_type &element0, const value_type &element1, const value_type &element2, const value_type &element3)
 
 vctFixedSizeVector (const value_type element0, const value_type element1, const value_type element2, const value_type element3, const value_type element4,...)
 
ThisTypeoperator= (const ThisType &other)
 
template<stride_type __stride, class __elementType , class __dataPtrType >
ThisTypeoperator= (const vctFixedSizeConstVectorBase< _size, __stride, __elementType, __dataPtrType > &other)
 
template<stride_type __stride>
ThisTypeoperator= (const vctFixedSizeConstVectorRef< value_type, _size, __stride > &other)
 
template<stride_type __stride, class __elementType >
ThisTypeoperator= (const vctFixedSizeConstVectorRef< __elementType, _size, __stride > &other)
 
- Public Member Functions inherited from vctFixedSizeVectorBase< _size, 1, _elementType, vctFixedSizeVectorTraits< _elementType, _size, 1 >::array >
 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[] (size_type index)
 
const_reference operator[] (size_type index) const
 
reference at (size_type index) throw (std::out_of_range)
 
const_reference at (size_type index) const throw (std::out_of_range)
 
reference operator() (size_type index) throw (std::out_of_range)
 
const_reference operator() (size_type index) const throw (std::out_of_range)
 
reference Element (size_type index)
 
const_reference Element (size_type index) const
 
pointer Pointer (size_type index=0)
 
const_pointer Pointer (size_type index=0) const
 
value_type SetAll (const value_type &value)
 
bool Zeros (void)
 
ThisTypeAssign (const value_type element0, const value_type element1, const value_type element2, const value_type element3, const value_type element4,...)
 
ThisTypeAssign (const value_type *elements)
 
ThisTypeAssign (const vctDynamicConstVectorBase< __vectorOwnerType, value_type > &other)
 
ThisTypeConcatenationOf (const vctFixedSizeConstVectorBase< SIZEMINUSONE, __stride, __elementTypeVector, __dataPtrType > &other, __elementType last)
 
void SelectFrom (const vctFixedSizeConstVectorBase< __inputSize, __inputStride, _elementType, __inputDataPtrType > &input, const vctFixedSizeConstVectorBase< _size, __indexStride, index_type, __indexDataPtrType > &index)
 
void CrossProductOf (const vctFixedSizeConstVectorBase< 3, __stride1, _elementType, __dataPtr1Type > &inputVector1, const vctFixedSizeConstVectorBase< 3, __stride2, _elementType, __dataPtr2Type > &inputVector2)
 
ThisTypeAddProductOf (const value_type scalar, const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector)
 
ThisTypeAddElementwiseProductOf (const vctFixedSizeConstVectorBase< _size, __stride1, value_type, __dataPtrType1 > &vector1, const vctFixedSizeConstVectorBase< _size, __stride2, value_type, __dataPtrType2 > &vector2)
 
ThisTypeAssign (const vctFixedSizeConstVectorBase< _size, __stride, __elementType, __dataPtrType > &other)
 
ThisTypeoperator= (const vctFixedSizeConstVectorBase< _size, __stride, __elementType, __dataPtrType > &other)
 
ThisTypeAssign (const value_type element0) throw (std::runtime_error)
 
ThisTypeAssign (const value_type element0, const value_type element1) throw (std::runtime_error)
 
ThisTypeAssign (const value_type element0, const value_type element1, const value_type element2) throw (std::runtime_error)
 
ThisTypeAssign (const value_type element0, const value_type element1, const value_type element2, const value_type element3) throw (std::runtime_error)
 
ThisTypeForceAssign (const vctFixedSizeConstVectorBase< _size, __stride, __elementType, __dataPtrType > &other)
 
ThisTypeForceAssign (const vctDynamicConstVectorBase< __vectorOwnerType, value_type > &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
 
vctFixedSizeVectorRef
< _elementType, 2, _stride > 
XY (void)
 
vctFixedSizeConstVectorRef
< _elementType, 2, _stride > 
XY (void) const
 
vctFixedSizeVectorRef
< _elementType, 2, 2 *_stride > 
XZ (void)
 
vctFixedSizeConstVectorRef
< _elementType, 2, 2 *_stride > 
XZ (void) const
 
vctFixedSizeVectorRef
< _elementType, 2, 3 *_stride > 
XW (void)
 
vctFixedSizeConstVectorRef
< _elementType, 2, 3 *_stride > 
XW (void) const
 
vctFixedSizeVectorRef
< _elementType, 2, _stride > 
YZ (void)
 
vctFixedSizeConstVectorRef
< _elementType, 2, _stride > 
YZ (void) const
 
vctFixedSizeVectorRef
< _elementType, 2, 2 *_stride > 
YW (void)
 
vctFixedSizeConstVectorRef
< _elementType, 2, 2 *_stride > 
YW (void) const
 
vctFixedSizeVectorRef
< _elementType, 2, _stride > 
ZW (void)
 
vctFixedSizeConstVectorRef
< _elementType, 2, _stride > 
ZW (void) const
 
vctFixedSizeVectorRef
< _elementType, 3, _stride > 
XYZ (void)
 
vctFixedSizeConstVectorRef
< _elementType, 3, _stride > 
XYZ (void) const
 
vctFixedSizeVectorRef
< _elementType, 3, _stride > 
YZW (void)
 
vctFixedSizeConstVectorRef
< _elementType, 3, _stride > 
YZW (void) const
 
vctFixedSizeVectorRef
< _elementType, 4, _stride > 
XYZW (void)
 
vctFixedSizeConstVectorRef
< _elementType, 4, _stride > 
XYZW (void) const
 
RowConstMatrixRefType AsRowMatrix (void) const
 
RowMatrixRefType AsRowMatrix (void)
 
ColConstMatrixRefType AsColMatrix (void) const
 
ColMatrixRefType AsColMatrix (void)
 
vctFixedSizeConstVectorRef
< _elementType, __subSize,
_stride > 
Ref (const size_type startPosition=0) const throw (std::out_of_range)
 
vctFixedSizeVectorRef
< _elementType, __subSize,
_stride > 
Ref (const size_type startPosition=0) throw (std::out_of_range)
 
ThisTypeSumOf (const vctFixedSizeConstVectorBase< _size, __stride1, value_type, __dataPtrType1 > &vector1, const vctFixedSizeConstVectorBase< _size, __stride2, value_type, __dataPtrType2 > &vector2)
 
ThisTypeDifferenceOf (const vctFixedSizeConstVectorBase< _size, __stride1, value_type, __dataPtrType1 > &vector1, const vctFixedSizeConstVectorBase< _size, __stride2, value_type, __dataPtrType2 > &vector2)
 
ThisTypeElementwiseProductOf (const vctFixedSizeConstVectorBase< _size, __stride1, value_type, __dataPtrType1 > &vector1, const vctFixedSizeConstVectorBase< _size, __stride2, value_type, __dataPtrType2 > &vector2)
 
ThisTypeElementwiseRatioOf (const vctFixedSizeConstVectorBase< _size, __stride1, value_type, __dataPtrType1 > &vector1, const vctFixedSizeConstVectorBase< _size, __stride2, value_type, __dataPtrType2 > &vector2)
 
ThisTypeElementwiseMinOf (const vctFixedSizeConstVectorBase< _size, __stride1, value_type, __dataPtrType1 > &vector1, const vctFixedSizeConstVectorBase< _size, __stride2, value_type, __dataPtrType2 > &vector2)
 
ThisTypeElementwiseMaxOf (const vctFixedSizeConstVectorBase< _size, __stride1, value_type, __dataPtrType1 > &vector1, const vctFixedSizeConstVectorBase< _size, __stride2, value_type, __dataPtrType2 > &vector2)
 
ThisTypeAdd (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector)
 
ThisTypeSubtract (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector)
 
ThisTypeElementwiseMultiply (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector)
 
ThisTypeElementwiseDivide (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector)
 
ThisTypeElementwiseMin (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector)
 
ThisTypeElementwiseMax (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector)
 
ThisTypeoperator+= (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector)
 
ThisTypeoperator-= (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector)
 
ThisTypeSwapElementsWith (vctFixedSizeVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector)
 
ThisTypeSumOf (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &vector, const value_type scalar)
 
ThisTypeDifferenceOf (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &vector, const value_type scalar)
 
ThisTypeProductOf (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &vector, const value_type scalar)
 
ThisTypeRatioOf (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &vector, const value_type scalar)
 
ThisTypeClippedAboveOf (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &vector, const value_type upperBound)
 
ThisTypeClippedBelowOf (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &vector, const value_type lowerBound)
 
ThisTypeSumOf (const value_type scalar, const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &vector)
 
ThisTypeDifferenceOf (const value_type scalar, const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &vector)
 
ThisTypeProductOf (const value_type scalar, const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &vector)
 
ThisTypeRatioOf (const value_type scalar, const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &vector)
 
ThisTypeClippedAboveOf (const value_type upperBound, const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &vector)
 
ThisTypeClippedBelowOf (const value_type lowerBound, const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &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)
 
ThisTypeoperator*= (const value_type scalar)
 
ThisTypeoperator/= (const value_type scalar)
 
ThisTypeProductOf (const vctFixedSizeConstMatrixBase< _size, __matrixCols, __matrixRowStride, __matrixColStride, _elementType, __matrixDataPtrType > &inputMatrix, const vctFixedSizeConstVectorBase< __matrixCols, __vectorStride, _elementType, __vectorDataPtrType > &inputVector)
 
ThisTypeProductOf (const vctFixedSizeConstVectorBase< __vectorSize, __vectorStride, _elementType, __vectorDataPtrType > &inputVector, const vctFixedSizeConstMatrixBase< __vectorSize, _size, __matrixRowStride, __matrixColStride, _elementType, __matrixDataPtrType > &inputMatrix)
 
ThisTypeAbsOf (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector)
 
ThisTypeNegationOf (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector)
 
ThisTypeFloorOf (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector)
 
ThisTypeCeilOf (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector)
 
ThisTypeNormalizedOf (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) throw (std::runtime_error)
 
ThisTypeAbsSelf (void)
 
ThisTypeNegationSelf (void)
 
ThisTypeFloorSelf (void)
 
ThisTypeCeilSelf (void)
 
ThisTypeNormalizedSelf (void) throw (std::runtime_error)
 
- Public Member Functions inherited from vctFixedSizeConstVectorBase< _size, _stride, _elementType, _dataPtrType >
 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
 
size_type max_size (void) const
 
difference_type stride (void) const
 
bool empty (void) const
 
const_reference operator[] (size_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_pointer Pointer (size_type index=0) const
 
bool ValidIndex (size_type index) const
 
template<vct::size_type __subSize>
vctFixedSizeConstVectorRef
< _elementType, __subSize,
_stride > 
Ref (const size_type startPosition=0) const throw (std::out_of_range)
 
template<stride_type __stride, class __dataPtrType >
value_type DotProduct (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &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
 
vctFixedSizeConstVectorRef
< _elementType, 2, _stride > 
XY (void) const
 
vctFixedSizeConstVectorRef
< _elementType, 2, 2 *_stride > 
XZ (void) const
 
vctFixedSizeConstVectorRef
< _elementType, 2, 3 *_stride > 
XW (void) const
 
vctFixedSizeConstVectorRef
< _elementType, 2, _stride > 
YZ (void) const
 
vctFixedSizeConstVectorRef
< _elementType, 2, 2 *_stride > 
YW (void) const
 
vctFixedSizeConstVectorRef
< _elementType, 2, _stride > 
ZW (void) const
 
vctFixedSizeConstVectorRef
< _elementType, 3, _stride > 
XYZ (void) const
 
vctFixedSizeConstVectorRef
< _elementType, 3, _stride > 
YZW (void) const
 
vctFixedSizeConstVectorRef
< _elementType, 4, _stride > 
XYZW (void) const
 
RowConstMatrixRefType AsRowMatrix (void) const
 
ColConstMatrixRefType AsColMatrix (void) const
 
value_type SumOfElements (void) const
 
value_type ProductOfElements (void) const
 
value_type NormSquare (void) const
 
NormType Norm (void) const
 
bool IsNormalized (_elementType tolerance=cmnTypeTraits< _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<size_type __size, stride_type __stride, class __dataPtrType >
bool FastCopyCompatible (const vctFixedSizeConstVectorBase< __size, __stride, value_type, __dataPtrType > &source) const
 
template<class __vectorOwnerType >
bool FastCopyCompatible (const vctDynamicConstVectorBase< __vectorOwnerType, value_type > &source) const
 
template<stride_type __stride, class __dataPtrType >
bool Equal (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const
 
template<stride_type __stride, class __dataPtrType >
bool operator== (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const
 
template<stride_type __stride, class __dataPtrType >
bool AlmostEqual (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector, value_type tolerance) const
 
template<stride_type __stride, class __dataPtrType >
bool AlmostEqual (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const
 
template<stride_type __stride, class __dataPtrType >
bool NotEqual (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const
 
template<stride_type __stride, class __dataPtrType >
bool operator!= (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const
 
template<stride_type __stride, class __dataPtrType >
bool Lesser (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const
 
template<stride_type __stride, class __dataPtrType >
bool LesserOrEqual (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const
 
template<stride_type __stride, class __dataPtrType >
bool Greater (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const
 
template<stride_type __stride, class __dataPtrType >
bool GreaterOrEqual (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const
 
template<stride_type __stride, class __dataPtrType >
BoolVectorValueType ElementwiseEqual (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const
 
template<stride_type __stride, class __dataPtrType >
BoolVectorValueType ElementwiseNotEqual (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const
 
template<stride_type __stride, class __dataPtrType >
BoolVectorValueType ElementwiseLesser (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const
 
template<stride_type __stride, class __dataPtrType >
BoolVectorValueType ElementwiseLesserOrEqual (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const
 
template<stride_type __stride, class __dataPtrType >
BoolVectorValueType ElementwiseGreater (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const
 
template<stride_type __stride, class __dataPtrType >
BoolVectorValueType ElementwiseGreaterOrEqual (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &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
 
BoolVectorValueType ElementwiseEqual (const value_type &scalar) const
 
BoolVectorValueType ElementwiseNotEqual (const value_type &scalar) const
 
BoolVectorValueType ElementwiseLesser (const value_type &scalar) const
 
BoolVectorValueType ElementwiseLesserOrEqual (const value_type &scalar) const
 
BoolVectorValueType ElementwiseGreater (const value_type &scalar) const
 
BoolVectorValueType ElementwiseGreaterOrEqual (const value_type &scalar) const
 
VectorValueType Abs (void) const
 
VectorValueType Negation (void) const
 
VectorValueType Floor (void) const
 
VectorValueType Ceil (void) const
 
VectorValueType Normalized (void) const throw (std::runtime_error)
 

Additional Inherited Members

- Protected Member Functions inherited from vctFixedSizeConstVectorBase< _size, _stride, _elementType, _dataPtrType >
void ThrowUnlessValidIndex (size_type index) const throw (std::out_of_range)
 
- Protected Attributes inherited from vctFixedSizeConstVectorBase< _size, _stride, _elementType, _dataPtrType >
_dataPtrType Data
 

Detailed Description

template<class _elementType, vct::size_type _size>
class vctFixedSizeVector< _elementType, _size >

Implementation of a fixed-size vector using template metaprogramming.

The vector type is stored as a contiguous array of a fixed size (stack allocation). It provides methods for operations which are implemented using template metaprogramming. See vctFixedSizeConstVectorBase and vctFixedSizeVectorBase for more implementation details.

Parameters
_elementTypethe type of an element in the vector
_sizethe size of the vector
Note
We do not provide a constructor from one value_type *. You can use vctFixedSizeVectorBase::Assign(const value_type * ) for that purpose. The reason is we did not want to have too many functions in the first place.

Member Typedef Documentation

template<class _elementType, vct::size_type _size>
typedef vctFixedSizeVectorBase<_size, 1, _elementType, typename VectorTraits::array> vctFixedSizeVector< _elementType, _size >::BaseType
template<class _elementType, vct::size_type _size>
typedef BaseType::CopyType vctFixedSizeVector< _elementType, _size >::CopyType
template<class _elementType, vct::size_type _size>
typedef TypeTraits::VaArgPromotion vctFixedSizeVector< _elementType, _size >::ElementVaArgPromotion
template<class _elementType, vct::size_type _size>
typedef vctFixedSizeVector<value_type, _size> vctFixedSizeVector< _elementType, _size >::ThisType
template<class _elementType, vct::size_type _size>
typedef class cmnTypeTraits< value_type > vctFixedSizeVector< _elementType, _size >::TypeTraits

Type traits for the elements of the vector.

template<class _elementType, vct::size_type _size>
typedef vctFixedSizeVectorTraits<_elementType, _size, 1> vctFixedSizeVector< _elementType, _size >::VectorTraits

Type traits for the vector. Based on type of elements, size and stride, it defines array, pointer, etc. (see vctFixedSizeVectorTraits).

Member Enumeration Documentation

template<class _elementType, vct::size_type _size>
anonymous enum
Enumerator
SIZEMINUSONE 

Constructor & Destructor Documentation

template<class _elementType, vct::size_type _size>
vctFixedSizeVector< _elementType, _size >::vctFixedSizeVector ( )
inline

Default constructor. Do nothing.

template<class _elementType, vct::size_type _size>
vctFixedSizeVector< _elementType, _size >::vctFixedSizeVector ( const value_type &  value)
inlineexplicit

Initialize all the elements to the given value.

Parameters
valuethe value used to set all the elements of the vector
template<class _elementType, vct::size_type _size>
template<class __elementType , stride_type __stride, class __dataPtrType >
vctFixedSizeVector< _elementType, _size >::vctFixedSizeVector ( const vctFixedSizeConstVectorBase< _size, __stride, __elementType, __dataPtrType > &  vector)
inlineexplicit

Initialize the elements of this vector with values from another vector. The other vector can include elements of any type, which will be converted using standard conversion to elements of this vector.

template<class _elementType, vct::size_type _size>
template<stride_type __stride>
vctFixedSizeVector< _elementType, _size >::vctFixedSizeVector ( const vctFixedSizeConstVectorRef< _elementType, _size, __stride > &  vector)
inline

initializing a vector from a vector-ref of the same element type does not need to be declared "explicit".

template<class _elementType, vct::size_type _size>
template<stride_type __stride>
vctFixedSizeVector< _elementType, _size >::vctFixedSizeVector ( const vctFixedSizeVectorRef< _elementType, _size, __stride > &  vector)
inline
template<class _elementType, vct::size_type _size>
template<stride_type __stride, class __dataPtrType >
vctFixedSizeVector< _elementType, _size >::vctFixedSizeVector ( const vctFixedSizeConstVectorBase< SIZEMINUSONE, __stride, _elementType, __dataPtrType > &  vector,
value_type  lastElement 
)
inline

Initialize the elements of this vector by appending one value after the elements from another vector. The other vector has to have the same element type as this one.

template<class _elementType, vct::size_type _size>
template<class __elementType >
vctFixedSizeVector< _elementType, _size >::vctFixedSizeVector ( const __elementType *  elements)
inlineexplicit

Initialize this vector from a conventional C array by copying the elements (assuming input stride == 1).

template<class _elementType, vct::size_type _size>
template<class __vectorOwnerType >
vctFixedSizeVector< _elementType, _size >::vctFixedSizeVector ( const vctDynamicConstVectorBase< __vectorOwnerType, value_type > &  vector)
inline

Initialize the vector from a dynamic vector with elements of the same type.

Note
Since the size of the dynamic vector might not match the size of the fixed size one, this constructor can throw an exception.
See Also
Corresponding Assign()
template<class _elementType, vct::size_type _size>
vctFixedSizeVector< _elementType, _size >::vctFixedSizeVector ( const value_type &  element0,
const value_type &  element1 
)
inline

Constructor for a vector of size 2.

template<class _elementType, vct::size_type _size>
vctFixedSizeVector< _elementType, _size >::vctFixedSizeVector ( const value_type &  element0,
const value_type &  element1,
const value_type &  element2 
)
inline

Constructor for a vector of size 3.

template<class _elementType, vct::size_type _size>
vctFixedSizeVector< _elementType, _size >::vctFixedSizeVector ( const value_type &  element0,
const value_type &  element1,
const value_type &  element2,
const value_type &  element3 
)
inline

Constructor for a vector of size 4.

template<class _elementType, vct::size_type _size>
vctFixedSizeVector< _elementType, _size >::vctFixedSizeVector ( const value_type  element0,
const value_type  element1,
const value_type  element2,
const value_type  element3,
const value_type  element4,
  ... 
)
inline

Constructor for any size greater than 4, 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.

Member Function Documentation

template<class _elementType, vct::size_type _size>
void vctFixedSizeVector< _elementType, _size >::DeSerializeRaw ( std::istream &  inputStream)
inline

Binary deserialization

template<class _elementType, vct::size_type _size>
bool vctFixedSizeVector< _elementType, _size >::FromStreamRaw ( std::istream &  inputStream,
const char  delimiter = ' ' 
)
inline

Read from an unformatted text input (e.g., one created by ToStreamRaw). Returns true if successful.

template<class _elementType, vct::size_type _size>
ThisType& vctFixedSizeVector< _elementType, _size >::operator= ( const ThisType other)
inline

Assignment operation between vectors of different types.

Parameters
otherThe vector to be copied.
template<class _elementType, vct::size_type _size>
template<stride_type __stride, class __elementType , class __dataPtrType >
ThisType& vctFixedSizeVector< _elementType, _size >::operator= ( const vctFixedSizeConstVectorBase< _size, __stride, __elementType, __dataPtrType > &  other)
inline
template<class _elementType, vct::size_type _size>
template<stride_type __stride>
ThisType& vctFixedSizeVector< _elementType, _size >::operator= ( const vctFixedSizeConstVectorRef< value_type, _size, __stride > &  other)
inline
template<class _elementType, vct::size_type _size>
template<stride_type __stride, class __elementType >
ThisType& vctFixedSizeVector< _elementType, _size >::operator= ( const vctFixedSizeConstVectorRef< __elementType, _size, __stride > &  other)
inline
template<class _elementType, vct::size_type _size>
ThisType& vctFixedSizeVector< _elementType, _size >::operator= ( const value_type &  value)
inline

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

template<class _elementType, vct::size_type _size>
vctFixedSizeVector< _elementType, _size >::VCT_CONTAINER_TRAITS_TYPEDEFS ( _elementType  )

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