soma-io 6.0.6
AimsVector< T, D > Class Template Reference

The template class to implement basic vectors. More...

#include <soma-io/vector/vector.h>

Inheritance diagram for AimsVector< T, D >:

Public Types

typedef T value_type
 

Public Member Functions

Constructors and Destructor
 AimsVector ()
 The constructor allocates an appropriate amount of memory.
 
 AimsVector (const std::vector< T > &value)
 
 AimsVector (const T &value)
 The constructor fills the D items of vector with value.
 
 AimsVector (const T value[])
 The constructor copy the D item of value[].
 
 AimsVector (const T &x, const T &y)
 Constructor for D=2.
 
 AimsVector (const T &x, const T &y, const T &z)
 Constructor for D=3.
 
 AimsVector (const T &x, const T &y, const T &z, const T &t)
 Constructor for D=4.
 
 AimsVector (const AimsVector< T, D > &other)
 Copy constructor.
 
template<class U>
 AimsVector (const AimsVector< U, D > &other)
 Type conversion.
 
 ~AimsVector ()
 The destructor deletes the allocated memory space.
 
Manipulators and methods
AimsVector< T, D > & operator= (const AimsVector< T, D > &other)
 
AimsVector< T, D > & operator+= (const AimsVector< T, D > &other)
 
AimsVector< T, D > & operator-= (const AimsVector< T, D > &other)
 
AimsVector< T, D > & operator*= (double val)
 
AimsVector< T, D > & operator/= (double val)
 
AimsVector< T, D > & normalize ()
 
const T & item (int d) const
 Get a const reference to the dth item.
 
const T & operator[] (int d) const
 Get a const reference to the dth item.
 
T & item (int d)
 Get a non const reference to the dth item.
 
T & operator[] (int d)
 Get a const reference to the dth item.
 
int size () const
 
bool isNull () const
 Test if the vector is the null vector.
 
float norm () const
 Return the magnitude of the vector.
 
float norm2 () const
 Return the square magnitude of the vector.
 
double dnorm () const
 Return the magnitude of the vector.
 
double dnorm2 () const
 Return the square magnitude of the vector.
 
dot (const AimsVector< T, D > &other) const
 Get the dot product between 2 vectors.
 
Useful type definitions
std::vector< T > toStdVector () const
 

Protected Attributes

_value [D]
 Memory space allocated.
 

Iterators

typedef T * iterator
 
typedef const T * const_iterator
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 

Detailed Description

template<class T, int D>
class AimsVector< T, D >

The template class to implement basic vectors.

The first template argument provides the type of stored items and the second template argument provides the size of the vector.

Definition at line 136 of file vector.h.

Member Typedef Documentation

◆ const_iterator

template<class T, int D>
typedef const T* AimsVector< T, D >::const_iterator

Definition at line 201 of file vector.h.

◆ iterator

template<class T, int D>
typedef T* AimsVector< T, D >::iterator

Definition at line 200 of file vector.h.

◆ value_type

template<class T, int D>
typedef T AimsVector< T, D >::value_type

Definition at line 208 of file vector.h.

Constructor & Destructor Documentation

◆ AimsVector() [1/9]

template<class T, int D>
AimsVector< T, D >::AimsVector ( )
inline

The constructor allocates an appropriate amount of memory.

Definition at line 435 of file vector.h.

Referenced by AimsVector(), AimsVector(), dot(), normalize(), operator*=(), operator+=(), operator-=(), operator/=(), and operator=().

◆ AimsVector() [2/9]

template<class T, int D>
AimsVector< T, D >::AimsVector ( const std::vector< T > & value)
inlineexplicit

Definition at line 459 of file vector.h.

References _value.

◆ AimsVector() [3/9]

template<class T, int D>
AimsVector< T, D >::AimsVector ( const T & value)
inline

The constructor fills the D items of vector with value.

Definition at line 442 of file vector.h.

References _value.

◆ AimsVector() [4/9]

template<class T, int D>
AimsVector< T, D >::AimsVector ( const T value[])
inlineexplicit

The constructor copy the D item of value[].

Definition at line 451 of file vector.h.

References _value.

◆ AimsVector() [5/9]

template<class T, int D>
AimsVector< T, D >::AimsVector ( const T & x,
const T & y )
inline

Constructor for D=2.

Definition at line 619 of file vector.h.

References _value, and internal::fill_aimsvector2< T, D >::doit().

◆ AimsVector() [6/9]

template<class T, int D>
AimsVector< T, D >::AimsVector ( const T & x,
const T & y,
const T & z )
inline

Constructor for D=3.

Definition at line 627 of file vector.h.

References _value, and internal::fill_aimsvector3< T, D >::doit().

◆ AimsVector() [7/9]

template<class T, int D>
AimsVector< T, D >::AimsVector ( const T & x,
const T & y,
const T & z,
const T & t )
inline

Constructor for D=4.

Definition at line 635 of file vector.h.

References _value, and internal::fill_aimsvector4< T, D >::doit().

◆ AimsVector() [8/9]

template<class T, int D>
AimsVector< T, D >::AimsVector ( const AimsVector< T, D > & other)
inline

Copy constructor.

Definition at line 643 of file vector.h.

References _value, and AimsVector().

◆ AimsVector() [9/9]

template<class T, int D>
template<class U>
AimsVector< T, D >::AimsVector ( const AimsVector< U, D > & other)
inlineexplicit

Type conversion.

Definition at line 651 of file vector.h.

References _value, and AimsVector().

◆ ~AimsVector()

template<class T, int D>
AimsVector< T, D >::~AimsVector ( )
inline

The destructor deletes the allocated memory space.

Definition at line 672 of file vector.h.

Member Function Documentation

◆ begin() [1/2]

template<class T, int D>
iterator AimsVector< T, D >::begin ( )
inline

Definition at line 202 of file vector.h.

◆ begin() [2/2]

template<class T, int D>
const_iterator AimsVector< T, D >::begin ( ) const
inline

Definition at line 203 of file vector.h.

◆ dnorm()

template<class T, int D>
double AimsVector< T, D >::dnorm ( ) const
inline

Return the magnitude of the vector.

Definition at line 803 of file vector.h.

References item().

Referenced by dnorm().

◆ dnorm2()

template<class T, int D>
double AimsVector< T, D >::dnorm2 ( ) const
inline

Return the square magnitude of the vector.

Definition at line 813 of file vector.h.

References item().

Referenced by dnorm2().

◆ dot()

template<class T, int D>
T AimsVector< T, D >::dot ( const AimsVector< T, D > & other) const
inline

Get the dot product between 2 vectors.

Definition at line 824 of file vector.h.

References AimsVector(), and item().

◆ end() [1/2]

template<class T, int D>
iterator AimsVector< T, D >::end ( )
inline

Definition at line 204 of file vector.h.

◆ end() [2/2]

template<class T, int D>
const_iterator AimsVector< T, D >::end ( ) const
inline

Definition at line 205 of file vector.h.

◆ isNull()

template<class T, int D>
bool AimsVector< T, D >::isNull ( ) const
inline

Test if the vector is the null vector.

Definition at line 773 of file vector.h.

References _value.

◆ item() [1/2]

template<class T, int D>
T & AimsVector< T, D >::item ( int d)
inline

Get a non const reference to the dth item.

Definition at line 749 of file vector.h.

References _value.

◆ item() [2/2]

template<class T, int D>
const T & AimsVector< T, D >::item ( int d) const
inline

Get a const reference to the dth item.

Definition at line 731 of file vector.h.

References _value.

Referenced by dnorm(), dnorm2(), dot(), norm(), norm2(), operator<<(), operator<<(), operator<<(), operator==(), operator>>(), operator>>(), operator>>(), and toStdVector().

◆ norm()

template<class T, int D>
float AimsVector< T, D >::norm ( ) const
inline

Return the magnitude of the vector.

Definition at line 783 of file vector.h.

References item().

Referenced by norm().

◆ norm2()

template<class T, int D>
float AimsVector< T, D >::norm2 ( ) const
inline

Return the square magnitude of the vector.

Definition at line 793 of file vector.h.

References item().

Referenced by norm2().

◆ normalize()

template<class T, int D>
AimsVector< T, D > & AimsVector< T, D >::normalize ( )
inline

Definition at line 719 of file vector.h.

References AimsVector(), and norm().

◆ operator*=()

template<class T, int D>
AimsVector< T, D > & AimsVector< T, D >::operator*= ( double val)
inline

Definition at line 699 of file vector.h.

References _value, and AimsVector().

◆ operator+=()

template<class T, int D>
AimsVector< T, D > & AimsVector< T, D >::operator+= ( const AimsVector< T, D > & other)
inline

Definition at line 679 of file vector.h.

References _value, and AimsVector().

◆ operator-=()

template<class T, int D>
AimsVector< T, D > & AimsVector< T, D >::operator-= ( const AimsVector< T, D > & other)
inline

Definition at line 689 of file vector.h.

References _value, and AimsVector().

◆ operator/=()

template<class T, int D>
AimsVector< T, D > & AimsVector< T, D >::operator/= ( double val)
inline

Definition at line 709 of file vector.h.

References _value, and AimsVector().

◆ operator=()

template<class T, int D>
AimsVector< T, D > & AimsVector< T, D >::operator= ( const AimsVector< T, D > & other)
inline

Definition at line 660 of file vector.h.

References _value, and AimsVector().

◆ operator[]() [1/2]

template<class T, int D>
T & AimsVector< T, D >::operator[] ( int d)
inline

Get a const reference to the dth item.

Definition at line 758 of file vector.h.

References _value.

◆ operator[]() [2/2]

template<class T, int D>
const T & AimsVector< T, D >::operator[] ( int d) const
inline

Get a const reference to the dth item.

Definition at line 740 of file vector.h.

References _value.

◆ size()

template<class T, int D>
int AimsVector< T, D >::size ( ) const
inline

Definition at line 766 of file vector.h.

◆ toStdVector()

template<class T, int D>
std::vector< T > AimsVector< T, D >::toStdVector ( ) const
inline

Definition at line 835 of file vector.h.

References item().

Member Data Documentation

◆ _value

template<class T, int D>
T AimsVector< T, D >::_value[D]
protected

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