Documentation


animal::Array< N, T > Struct Template Reference

#include <array.h>

Inheritance diagram for animal::Array< N, T >:

array List of all members.

Detailed Description

template<std::size_t N, class T>
struct animal::Array< N, T >

Fixed-size array.

Two template parameters are given: the type of the entries and the size (dimension) of the array. Knowing the size of the array at compile-time allows the compiler to perfrom optimizations.

Additionally, this class provides an stl-compatible interface (.size(), .begin(), ::value_type, etc.) due to its parent class boost::array.

Ad-hoc constructors can be used for dimensions 2,3,4: Array(const T&,const T&), Array(const T&,const T&,const T&), Array(const T&,const T&,const T&,const T&),

Examples:

array_test.cpp, linear_test.cpp, matrix_test.cpp, and rotation2d_test.cpp.

Definition at line 26 of file array.h.

Public Member Functions

 Array ()
 default constructor, does nothing

 Array (const T &t)
 set all the values uniformly to the given value

 Array (const T t[N])
 copy the values from the C array.

 Array (const T &x, const T &y)
 Constructor for a 2d vector.

 Array (const T &x, const T &y, const T &z)
 Constructor for a 3d vector.

 Array (const T &x, const T &y, const T &z, const T &t)
 Constructor for a 4d vector.

Arrayoperator+= (const Array &v)
 $ u += v $

Arrayoperator-= (const Array &v)
 $ u -= v $

Arrayoperator *= (const T &a)
 $ u *= a $ where a is a scalar

Array operator+ (const Array &v) const
 $ u + v $

Array operator- (const Array &v) const
 $ u - v $

Array operator * (const T &a) const
 $ u * a $ where a is a scalar

operator * (const Array &v) const
 $ u * v $ where v is an array

Array operator- () const
 $ -u $


Friends

Array operator * (const float a, const Array &u)
 $ a * u $ where a is a scalar


Constructor & Destructor Documentation

template<std::size_t N, class T>
animal::Array< N, T >::Array  )  [inline]
 

default constructor, does nothing

Definition at line 29 of file array.h.

template<std::size_t N, class T>
animal::Array< N, T >::Array const T &  t  )  [inline, explicit]
 

set all the values uniformly to the given value

Definition at line 32 of file array.h.

template<std::size_t N, class T>
animal::Array< N, T >::Array const T  t[N]  )  [inline]
 

copy the values from the C array.

Definition at line 40 of file array.h.

template<std::size_t N, class T>
animal::Array< N, T >::Array const T &  x,
const T &  y
[inline]
 

Constructor for a 2d vector.

Definition at line 47 of file array.h.

template<std::size_t N, class T>
animal::Array< N, T >::Array const T &  x,
const T &  y,
const T &  z
[inline]
 

Constructor for a 3d vector.

Definition at line 55 of file array.h.

template<std::size_t N, class T>
animal::Array< N, T >::Array const T &  x,
const T &  y,
const T &  z,
const T &  t
[inline]
 

Constructor for a 4d vector.

Definition at line 64 of file array.h.


Member Function Documentation

template<std::size_t N, class T>
T animal::Array< N, T >::operator * const Array< N, T > &  v  )  const [inline]
 

$ u * v $ where v is an array

Definition at line 127 of file array.h.

template<std::size_t N, class T>
Array animal::Array< N, T >::operator * const T &  a  )  const [inline]
 

$ u * a $ where a is a scalar

Definition at line 111 of file array.h.

template<std::size_t N, class T>
Array& animal::Array< N, T >::operator *= const T &  a  )  [inline]
 

$ u *= a $ where a is a scalar

Definition at line 88 of file array.h.

template<std::size_t N, class T>
Array animal::Array< N, T >::operator+ const Array< N, T > &  v  )  const [inline]
 

$ u + v $

Definition at line 95 of file array.h.

template<std::size_t N, class T>
Array& animal::Array< N, T >::operator+= const Array< N, T > &  v  )  [inline]
 

$ u += v $

Definition at line 74 of file array.h.

template<std::size_t N, class T>
Array animal::Array< N, T >::operator-  )  const [inline]
 

$ -u $

Definition at line 133 of file array.h.

template<std::size_t N, class T>
Array animal::Array< N, T >::operator- const Array< N, T > &  v  )  const [inline]
 

$ u - v $

Definition at line 103 of file array.h.

template<std::size_t N, class T>
Array& animal::Array< N, T >::operator-= const Array< N, T > &  v  )  [inline]
 

$ u -= v $

Definition at line 81 of file array.h.


Friends And Related Function Documentation

template<std::size_t N, class T>
Array operator * const float  a,
const Array< N, T > &  u
[friend]
 

$ a * u $ where a is a scalar

Definition at line 119 of file array.h.


The documentation for this struct was generated from the following file:
Generated on Thu Dec 23 13:52:29 2004 by doxygen 1.3.6