Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

RayGina::Rstd::carray< T, n > Class Template Reference

C-Array class. More...

#include <carray.hxx>

List of all members.

Public Types

typedef T & reference
typedef const T & const_reference
typedef T * iterator
typedef const T * const_iterator

Public Member Functions

 carray ()
 carray (T value)
 carray (const T *data)
template<typename It>
 carray (It it)
reference operator[] (unsigned int i)
const_reference operator[] (unsigned int i) const
const unsigned int size () const
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const

Private Attributes

m_data [n]


Detailed Description

template<typename T, unsigned int n>
class RayGina::Rstd::carray< T, n >

C-Array class.

This class can be used to pass a bundle of equal-type parameters to or from functions without the overhead of dynamic memory-allocation. It can be used for any type and any size. To be compatible with the standard-containers and standard-algorithms, some iterators are provided. Note: to wrap only two parameters even of different type, you may use std::pair .

Author:
Stephan Weigelt (pushmatrix)
Warning:
not really tested, but should work correctly.

Definition at line 25 of file carray.hxx.


Member Typedef Documentation

template<typename T, unsigned int n>
typedef const T* RayGina::Rstd::carray< T, n >::const_iterator
 

Definition at line 31 of file carray.hxx.

template<typename T, unsigned int n>
typedef const T& RayGina::Rstd::carray< T, n >::const_reference
 

Definition at line 29 of file carray.hxx.

template<typename T, unsigned int n>
typedef T* RayGina::Rstd::carray< T, n >::iterator
 

Definition at line 30 of file carray.hxx.

template<typename T, unsigned int n>
typedef T& RayGina::Rstd::carray< T, n >::reference
 

Definition at line 28 of file carray.hxx.


Constructor & Destructor Documentation

template<typename T, unsigned int n>
RayGina::Rstd::carray< T, n >::carray  )  [inline]
 

Default constructor. Does nothing, i.e. leaves the values un-initialized. Should be used only when you want to initialize the values later.

Definition at line 4 of file carray.inl.

template<typename T, unsigned int n>
RayGina::Rstd::carray< T, n >::carray value  )  [inline, explicit]
 

Initalizes all elements with the given value (by copy).

Parameters:
value the value to assign.

Definition at line 10 of file carray.inl.

template<typename T, unsigned int n>
RayGina::Rstd::carray< T, n >::carray const T *  data  )  [inline, explicit]
 

Initalizes all elements by reading n values from a native C-array.

Parameters:
data 
Warning:
assumes that the array data has at least the length n

Definition at line 20 of file carray.inl.

template<typename T, unsigned int n>
template<typename It>
RayGina::Rstd::carray< T, n >::carray It  it  )  [inline]
 

Initalizes all elements by reading n values from an iterator.

Parameters:
it the iterator, for instance std::vector<T>::iterator

Definition at line 31 of file carray.inl.


Member Function Documentation

template<typename T, unsigned int n>
RayGina::Rstd::carray< T, n >::const_iterator RayGina::Rstd::carray< T, n >::begin  )  const [inline]
 

Read-only iterator (constant) pointing to the first element.

Definition at line 83 of file carray.inl.

template<typename T, unsigned int n>
RayGina::Rstd::carray< T, n >::iterator RayGina::Rstd::carray< T, n >::begin  )  [inline]
 

Read/write iterator (non-constant) pointing to the first element.

Definition at line 67 of file carray.inl.

template<typename T, unsigned int n>
RayGina::Rstd::carray< T, n >::const_iterator RayGina::Rstd::carray< T, n >::end  )  const [inline]
 

Iterator (constant) pointing one behind the last element.

Definition at line 91 of file carray.inl.

template<typename T, unsigned int n>
RayGina::Rstd::carray< T, n >::iterator RayGina::Rstd::carray< T, n >::end  )  [inline]
 

Iterator (non-constant) pointing one behind the last element.

Definition at line 75 of file carray.inl.

template<typename T, unsigned int n>
RayGina::Rstd::carray< T, n >::const_reference RayGina::Rstd::carray< T, n >::operator[] unsigned int  i  )  const [inline]
 

Value access operator for read-only access (constant)

Definition at line 51 of file carray.inl.

template<typename T, unsigned int n>
RayGina::Rstd::carray< T, n >::reference RayGina::Rstd::carray< T, n >::operator[] unsigned int  i  )  [inline]
 

Value access operator for read/write access (non-constant)

Definition at line 43 of file carray.inl.

template<typename T, unsigned int n>
const unsigned int RayGina::Rstd::carray< T, n >::size  )  const [inline]
 

Size of the carray ( == n )

Definition at line 59 of file carray.inl.


Member Data Documentation

template<typename T, unsigned int n>
T RayGina::Rstd::carray< T, n >::m_data[n] [private]
 

Definition at line 84 of file carray.hxx.


The documentation for this class was generated from the following files:
Generated on Sun Dec 2 17:01:12 2007 for rayGina by  doxygen 1.3.9.1