Specialized version of VecBase that is actually used for all user interaction with a traditional vector. More...
#include <VecBase.h>
Public Types | |
enum | Params { Size = SIZE } |
The number of components this VecBase has. More... | |
typedef DATA_TYPE | DataType |
The datatype used for the components of this VecBase. | |
typedef VecBase< DATA_TYPE, SIZE, meta::DefaultVecTag > | VecType |
Public Member Functions | |
VecBase () | |
Default constructor. | |
VecBase (const VecBase< DATA_TYPE, SIZE > &rVec) | |
Makes an exact copy of the given VecBase object. | |
template<typename REP2 > | |
VecBase (const VecBase< DATA_TYPE, SIZE, REP2 > &rVec) | |
void | set (const DATA_TYPE *dataPtr) |
Sets the components in this VecBase using the given array. | |
template<typename REP2 > | |
VecType & | operator= (const VecBase< DATA_TYPE, SIZE, REP2 > &rhs) |
Assign from different rep. | |
VecBase (const DATA_TYPE &val0, const DATA_TYPE &val1) | |
Creates a new VecBase initialized to the given values. | |
VecBase (const DATA_TYPE &val0, const DATA_TYPE &val1, const DATA_TYPE &val2) | |
VecBase (const DATA_TYPE &val0, const DATA_TYPE &val1, const DATA_TYPE &val2, const DATA_TYPE &val3) | |
void | set (const DATA_TYPE &val0) |
Sets the components in this VecBase to the given values. | |
void | set (const DATA_TYPE &val0, const DATA_TYPE &val1) |
void | set (const DATA_TYPE &val0, const DATA_TYPE &val1, const DATA_TYPE &val2) |
void | set (const DATA_TYPE &val0, const DATA_TYPE &val1, const DATA_TYPE &val2, const DATA_TYPE &val3) |
DATA_TYPE & | operator[] (const unsigned i) |
Gets the ith component in this VecBase. | |
const DATA_TYPE & | operator[] (const unsigned i) const |
DATA_TYPE * | getData () |
Gets the internal array of the components. | |
const DATA_TYPE * | getData () const |
Public Attributes | |
DATA_TYPE | mData [SIZE] |
The array of components. |
Specialized version of VecBase that is actually used for all user interaction with a traditional vector.
DATA_TYPE | the datatype to use for the components | |
SIZE | the number of components this VecBase has |
Definition at line 94 of file VecBase.h.
typedef DATA_TYPE gmtl::VecBase< DATA_TYPE, SIZE, meta::DefaultVecTag >::DataType |
The datatype used for the components of this VecBase.
Reimplemented in gmtl::Vec< DATA_TYPE, SIZE >, gmtl::Vec< DATA_TYPE, 3 >, and gmtl::Vec< DATA_TYPE, 4 >.
typedef VecBase<DATA_TYPE, SIZE, meta::DefaultVecTag> gmtl::VecBase< DATA_TYPE, SIZE, meta::DefaultVecTag >::VecType |
Reimplemented in gmtl::Vec< DATA_TYPE, SIZE >, gmtl::Vec< DATA_TYPE, 3 >, and gmtl::Vec< DATA_TYPE, 4 >.
enum gmtl::VecBase< DATA_TYPE, SIZE, meta::DefaultVecTag >::Params |
The number of components this VecBase has.
Reimplemented in gmtl::Vec< DATA_TYPE, SIZE >, gmtl::Vec< DATA_TYPE, 3 >, and gmtl::Vec< DATA_TYPE, 4 >.
Definition at line 108 of file VecBase.h.
{ Size = SIZE };
gmtl::VecBase< DATA_TYPE, SIZE, meta::DefaultVecTag >::VecBase | ( | ) | [inline] |
Default constructor.
Does nothing, leaves data alone. This is for performance because this constructor is called by derived class constructors Even when they just want to set the data directly
Definition at line 117 of file VecBase.h.
{ #ifdef GMTL_COUNT_CONSTRUCT_CALLS gmtl::helpers::VecCtrCounterInstance()->inc(); #endif }
gmtl::VecBase< DATA_TYPE, SIZE, meta::DefaultVecTag >::VecBase | ( | const VecBase< DATA_TYPE, SIZE > & | rVec | ) | [inline] |
Makes an exact copy of the given VecBase object.
rVec | the VecBase object to copy |
Definition at line 129 of file VecBase.h.
{ #ifdef GMTL_COUNT_CONSTRUCT_CALLS gmtl::helpers::VecCtrCounterInstance()->inc(); #endif #ifdef GMTL_NO_METAPROG for(unsigned i=0;i<SIZE;++i) mData[i] = rVec.mData[i]; #else gmtl::meta::AssignVecUnrolled<SIZE-1, VecBase<DATA_TYPE,SIZE> >::func(*this, rVec); #endif }
gmtl::VecBase< DATA_TYPE, SIZE, meta::DefaultVecTag >::VecBase | ( | const VecBase< DATA_TYPE, SIZE, REP2 > & | rVec | ) | [inline] |
Definition at line 144 of file VecBase.h.
{ #ifdef GMTL_COUNT_CONSTRUCT_CALLS gmtl::helpers::VecCtrCounterInstance()->inc(); #endif for(unsigned i=0;i<SIZE;++i) { mData[i] = rVec[i]; } }
gmtl::VecBase< DATA_TYPE, SIZE, meta::DefaultVecTag >::VecBase | ( | const DATA_TYPE & | val0, | |
const DATA_TYPE & | val1 | |||
) | [inline] |
Creates a new VecBase initialized to the given values.
Definition at line 158 of file VecBase.h.
{ #ifdef GMTL_COUNT_CONSTRUCT_CALLS gmtl::helpers::VecCtrCounterInstance()->inc(); #endif GMTL_STATIC_ASSERT( SIZE == 2, Invalid_constructor_of_size_2_used); mData[0] = val0; mData[1] = val1; }
gmtl::VecBase< DATA_TYPE, SIZE, meta::DefaultVecTag >::VecBase | ( | const DATA_TYPE & | val0, | |
const DATA_TYPE & | val1, | |||
const DATA_TYPE & | val2 | |||
) | [inline] |
Definition at line 166 of file VecBase.h.
{ #ifdef GMTL_COUNT_CONSTRUCT_CALLS gmtl::helpers::VecCtrCounterInstance()->inc(); #endif GMTL_STATIC_ASSERT( SIZE == 3, Invalid_constructor_of_size_3_used ); mData[0] = val0; mData[1] = val1; mData[2] = val2; }
gmtl::VecBase< DATA_TYPE, SIZE, meta::DefaultVecTag >::VecBase | ( | const DATA_TYPE & | val0, | |
const DATA_TYPE & | val1, | |||
const DATA_TYPE & | val2, | |||
const DATA_TYPE & | val3 | |||
) | [inline] |
Definition at line 174 of file VecBase.h.
{ #ifdef GMTL_COUNT_CONSTRUCT_CALLS gmtl::helpers::VecCtrCounterInstance()->inc(); #endif // @todo need compile time assert GMTL_STATIC_ASSERT( SIZE == 4, Invalid_constructor_of_size_4_used); mData[0] = val0; mData[1] = val1; mData[2] = val2; mData[3] = val3; }
DATA_TYPE* gmtl::VecBase< DATA_TYPE, SIZE, meta::DefaultVecTag >::getData | ( | ) | [inline] |
const DATA_TYPE* gmtl::VecBase< DATA_TYPE, SIZE, meta::DefaultVecTag >::getData | ( | ) | const [inline] |
VecType& gmtl::VecBase< DATA_TYPE, SIZE, meta::DefaultVecTag >::operator= | ( | const VecBase< DATA_TYPE, SIZE, REP2 > & | rhs | ) | [inline] |
Assign from different rep.
Reimplemented in gmtl::Vec< DATA_TYPE, SIZE >, gmtl::Vec< DATA_TYPE, 3 >, and gmtl::Vec< DATA_TYPE, 4 >.
Definition at line 262 of file VecBase.h.
{ for(unsigned i=0;i<SIZE;++i) { mData[i] = rhs[i]; } //gmtl::meta::AssignVecUnrolled<SIZE-1, VecBase<DATA_TYPE,SIZE> >::func(*this, rVec); return *this; }
DATA_TYPE& gmtl::VecBase< DATA_TYPE, SIZE, meta::DefaultVecTag >::operator[] | ( | const unsigned | i | ) | [inline] |
Gets the ith component in this VecBase.
i | the zero-based index of the component to access. |
Definition at line 237 of file VecBase.h.
{ gmtlASSERT(i < SIZE); return mData[i]; }
const DATA_TYPE& gmtl::VecBase< DATA_TYPE, SIZE, meta::DefaultVecTag >::operator[] | ( | const unsigned | i | ) | const [inline] |
Definition at line 242 of file VecBase.h.
{ gmtlASSERT(i < SIZE); return mData[i]; }
void gmtl::VecBase< DATA_TYPE, SIZE, meta::DefaultVecTag >::set | ( | const DATA_TYPE & | val0, | |
const DATA_TYPE & | val1 | |||
) | [inline] |
Definition at line 211 of file VecBase.h.
{ GMTL_STATIC_ASSERT( SIZE >= 2, Set_out_of_valid_range); mData[0] = val0; mData[1] = val1; }
void gmtl::VecBase< DATA_TYPE, SIZE, meta::DefaultVecTag >::set | ( | const DATA_TYPE & | val0, | |
const DATA_TYPE & | val1, | |||
const DATA_TYPE & | val2, | |||
const DATA_TYPE & | val3 | |||
) | [inline] |
void gmtl::VecBase< DATA_TYPE, SIZE, meta::DefaultVecTag >::set | ( | const DATA_TYPE & | val0 | ) | [inline] |
void gmtl::VecBase< DATA_TYPE, SIZE, meta::DefaultVecTag >::set | ( | const DATA_TYPE * | dataPtr | ) | [inline] |
Sets the components in this VecBase using the given array.
dataPtr | the array containing the values to copy |
Definition at line 191 of file VecBase.h.
{ #ifdef GMTL_NO_METAPROG for ( unsigned int i = 0; i < SIZE; ++i ) { mData[i] = dataPtr[i]; } #else gmtl::meta::AssignArrayUnrolled<SIZE-1, DATA_TYPE>::func(&(mData[0]), dataPtr); #endif }
void gmtl::VecBase< DATA_TYPE, SIZE, meta::DefaultVecTag >::set | ( | const DATA_TYPE & | val0, | |
const DATA_TYPE & | val1, | |||
const DATA_TYPE & | val2 | |||
) | [inline] |
DATA_TYPE gmtl::VecBase< DATA_TYPE, SIZE, meta::DefaultVecTag >::mData[SIZE] |