Main Page   Groups   Namespaces  

mini3d::array< T, S > Class Template Reference
[Template]

array - A template array class More...

List of all members.

Public Types

typedef int size_t

Public Member Functions

 array ()
 Default constructor.
 array (T v[S])
 A constructor.
 array (const array<T, S-1>& src, T t)
 A constructor.
 array (const array<T, S>& src)
 Copy constructor.
virtual ~array ()
 Default destructor.
const T* c_ptr () const
 Get the pointer of the data.
norm2 () const
 Get the squared norm of the vector.
norm () const
 Get the norm of the vector.
array<T, S> normalize ()
 Will throw divide_by_zero exception if norm() < EPSILON.
array<T, S> normal () const
 Will throw divide_by_zero exception if norm() < EPSILON.
array<T, S>& operator= (const array<T, S>& src)
 Assignment operator.
array<T, S> operator* (double scale) const
 The scalar multiplication operator.
array<T, S> operator* (float scale) const
 The scalar multiplication operator.
array<T, S> operator* (int scale) const
 The scalar multiplication operator.
array<T, S>& operator*= (double scale)
 The in place scalar multiplication operator.
array<T, S>& operator*= (float scale)
 The in place scalar multiplication operator.
array<T, S>& operator*= (int scale)
 The in place scalar multiplication operator.
array<T, S> operator/ (double scale) const
 The scalar division operator.
array<T, S> operator/ (float scale) const
 The scalar division operator.
array<T, S> operator/ (int scale) const
 The scalar division operator.
array<T, S>& operator/= (double scale)
 The in place scalar division operator.
array<T, S>& operator/= (float scale)
 The in place scalar division operator.
array<T, S>& operator/= (int scale)
 The in place scalar division operator.
array<T, S> operator+ (const array<T, S>& rhs) const
 The array addition operator.
array<T, S>& operator+= (const array<T, S>& rhs)
 The in place array addition operator.
array<T, S> operator- (const array<T, S>& rhs) const
 The array subtraction operator.
array<T, S>& operator-= (const array<T, S>& rhs)
 The in place array subtraction operator.
array<T, S> operator- () const
 The unary operator.
T& operator[] (unsigned i)
 Get the element of the array (lvalue).
const T& operator[] (unsigned i) const
 Get the element of the array (rvalue).
T& operator() (unsigned i)
 Get the element of the array (lvalue).
const T& operator() (unsigned i) const
 Get the element of the array (rvalue).
size_t size () const
 Get the size of the array.

Protected Attributes

_v [S]

Friends

array<T, S> operator* (double scale, const array<T, S>& v)
 The scalar multiplication operator that allows the scalar value to preceed the array.
array<T, S> operator* (float scale, const array<T, S>& v)
 The scalar multiplication operator that allows the scalar value to preceed the array.
array<T, S> operator* (int scale, const array<T, S>& v)
 The scalar multiplication operator that allows the scalar value to preceed the array.
std::ostream& operator<< (std::ostream& os, const array<T, S>& v)
 The out stream operator.
std::istream& operator>> (std::istream& is, array<T, S>& v)
 The in stream operator.


Detailed Description

template <typename T, int S>
class mini3d::array< T, S >

array - A template array class


Member Typedef Documentation

template <typename T, int S>
typedef int mini3d::array<T, S>::size_t
 


Constructor & Destructor Documentation

template <typename T, int S>
mini3d::array<T, S>::array (  )  [inline]
 

Default constructor.

template <typename T, int S>
mini3d::array<T, S>::array ( v[S]  )  [inline]
 

A constructor.

Parameters:
v the array to be copied from

template <typename T, int S>
mini3d::array<T, S>::array ( const array<T, S-1>&  src,
t
[inline]
 

A constructor.

Parameters:
v the array to be copied from
t the last component

template <typename T, int S>
mini3d::array<T, S>::array ( const array<T, S>&  src  )  [inline]
 

Copy constructor.

Parameters:
src the array to be copied from

template <typename T, int S>
virtual mini3d::array<T, S>::~array (  )  [inline, virtual]
 

Default destructor.


Member Function Documentation

template <typename T, int S>
const T* mini3d::array<T, S>::c_ptr (  )  const [inline]
 

Get the pointer of the data.

Returns:
the c style pointer

template <typename T, int S>
T mini3d::array<T, S>::norm (  )  const [inline]
 

Get the norm of the vector.

Returns:
the norm

template <typename T, int S>
T mini3d::array<T, S>::norm2 (  )  const [inline]
 

Get the squared norm of the vector.

Returns:
the squared norm

template <typename T, int S>
array<T, S> mini3d::array<T, S>::normal (  )  const [inline]
 

Will throw divide_by_zero exception if norm() < EPSILON.

Returns:
the normal of this vector

template <typename T, int S>
array<T, S> mini3d::array<T, S>::normalize (  )  [inline]
 

Will throw divide_by_zero exception if norm() < EPSILON.

Returns:
itself

template <typename T, int S>
array<T, S> mini3d::array<T, S>::operator* ( int  scale  )  const [inline]
 

The scalar multiplication operator.

Parameters:
scale an int scalar which you want to multiply
Returns:
the array after the multiplication

template <typename T, int S>
array<T, S> mini3d::array<T, S>::operator* ( float  scale  )  const [inline]
 

The scalar multiplication operator.

Parameters:
scale an float scalar which you want to multiply
Returns:
the array after the multiplication

template <typename T, int S>
array<T, S> mini3d::array<T, S>::operator* ( double  scale  )  const [inline]
 

The scalar multiplication operator.

Parameters:
scale an double scalar which you want to multiply
Returns:
the array after the multiplication

template <typename T, int S>
array<T, S>& mini3d::array<T, S>::operator*= ( int  scale  )  [inline]
 

The in place scalar multiplication operator.

Parameters:
scale an int scalar which you want to multiply
Returns:
this array after the multiplication

template <typename T, int S>
array<T, S>& mini3d::array<T, S>::operator*= ( float  scale  )  [inline]
 

The in place scalar multiplication operator.

Parameters:
scale an float scalar which you want to multiply
Returns:
this array after the multiplication

template <typename T, int S>
array<T, S>& mini3d::array<T, S>::operator*= ( double  scale  )  [inline]
 

The in place scalar multiplication operator.

Parameters:
scale an double scalar which you want to multiply
Returns:
this array after the multiplication

template <typename T, int S>
const T& mini3d::array<T, S>::operator() ( unsigned  i  )  const [inline]
 

Get the element of the array (rvalue).

Parameters:
i the index of the element
Returns:
the element of the array at the specified location

template <typename T, int S>
T& mini3d::array<T, S>::operator() ( unsigned  i  )  [inline]
 

Get the element of the array (lvalue).

Parameters:
i the index of the element
Returns:
the element of the array at the specified location

template <typename T, int S>
array<T, S> mini3d::array<T, S>::operator+ ( const array<T, S>&  rhs  )  const [inline]
 

The array addition operator.

Parameters:
rhs the array which you want to add
Returns:
the array after the addition

template <typename T, int S>
array<T, S>& mini3d::array<T, S>::operator+= ( const array<T, S>&  rhs  )  [inline]
 

The in place array addition operator.

Parameters:
rhs the array which you want to add
Returns:
the array after the addition

template <typename T, int S>
array<T, S> mini3d::array<T, S>::operator- (  )  const [inline]
 

The unary operator.

Returns:
the unary of this array

template <typename T, int S>
array<T, S> mini3d::array<T, S>::operator- ( const array<T, S>&  rhs  )  const [inline]
 

The array subtraction operator.

Parameters:
rhs the array which you want to add
Returns:
the array after the addition

template <typename T, int S>
array<T, S>& mini3d::array<T, S>::operator-= ( const array<T, S>&  rhs  )  [inline]
 

The in place array subtraction operator.

Parameters:
rhs the array which you want to add
Returns:
the array after the addition

template <typename T, int S>
array<T, S> mini3d::array<T, S>::operator/ ( int  scale  )  const [inline]
 

The scalar division operator.

Parameters:
scale a int scalar which you want to divide
Returns:
the array after the division

template <typename T, int S>
array<T, S> mini3d::array<T, S>::operator/ ( float  scale  )  const [inline]
 

The scalar division operator.

Parameters:
scale a float scalar which you want to divide
Returns:
the array after the division

template <typename T, int S>
array<T, S> mini3d::array<T, S>::operator/ ( double  scale  )  const [inline]
 

The scalar division operator.

Parameters:
scale a double scalar which you want to divide
Returns:
the array after the division

template <typename T, int S>
array<T, S>& mini3d::array<T, S>::operator/= ( int  scale  )  [inline]
 

The in place scalar division operator.

Parameters:
scale a int scalar which you want to divide
Returns:
this array after the division

template <typename T, int S>
array<T, S>& mini3d::array<T, S>::operator/= ( float  scale  )  [inline]
 

The in place scalar division operator.

Parameters:
scale a float scalar which you want to divide
Returns:
this array after the division

template <typename T, int S>
array<T, S>& mini3d::array<T, S>::operator/= ( double  scale  )  [inline]
 

The in place scalar division operator.

Parameters:
scale a double scalar which you want to divide
Returns:
this array after the division

template <typename T, int S>
array<T, S>& mini3d::array<T, S>::operator= ( const array<T, S>&  src  )  [inline]
 

Assignment operator.

Parameters:
src the array to be copied from
Returns:
itself

template <typename T, int S>
const T& mini3d::array<T, S>::operator[] ( unsigned  i  )  const [inline]
 

Get the element of the array (rvalue).

Parameters:
i the index of the element
Returns:
the element of the array at the specified location

template <typename T, int S>
T& mini3d::array<T, S>::operator[] ( unsigned  i  )  [inline]
 

Get the element of the array (lvalue).

Parameters:
i the index of the element
Returns:
the element of the array at the specified location

template <typename T, int S>
size_t mini3d::array<T, S>::size (  )  const [inline]
 

Get the size of the array.

Returns:
the size of the array


Friends And Related Function Documentation

template <typename T, int S>
array<T, S> operator* ( int  scale,
const array<T, S>&  v
[friend]
 

The scalar multiplication operator that allows the scalar value to preceed the array.

Parameters:
scale an int scalar which you want to multiply
Returns:
the array after the multiplication

template <typename T, int S>
array<T, S> operator* ( float  scale,
const array<T, S>&  v
[friend]
 

The scalar multiplication operator that allows the scalar value to preceed the array.

Parameters:
scale an float scalar which you want to multiply
Returns:
the array after the multiplication

template <typename T, int S>
array<T, S> operator* ( double  scale,
const array<T, S>&  v
[friend]
 

The scalar multiplication operator that allows the scalar value to preceed the array.

Parameters:
scale an double scalar which you want to multiply
Returns:
the array after the multiplication

template <typename T, int S>
std::ostream& operator<< ( std::ostream&  os,
const array<T, S>&  v
[friend]
 

The out stream operator.

Parameters:
os the ostream
m the array
Returns:
the ostream

template <typename T, int S>
std::istream& operator>> ( std::istream&  is,
array<T, S>&  v
[friend]
 

The in stream operator.

Parameters:
is the istream
m the array
Returns:
the istream


Member Data Documentation

template <typename T, int S>
T mini3d::array<T, S>::_v[S] [protected]
 


The documentation for this class was generated from the following file:
Generated for libmini3d by Doxygen 1.4.4 © 1997-2001