cml::fixed_1D< Element, Size > Class Template Reference

Statically-allocated array. More...

#include <fixed_1D.h>

Inheritance diagram for cml::fixed_1D< Element, Size >:

Inheritance graph
[legend]
Collaboration diagram for cml::fixed_1D< Element, Size >:

Collaboration graph
[legend]

List of all members.

Public Types

enum  { array_size = Size }
 The length as an enumerated value. More...
typedef value_type array_impl [Size]
typedef const Element * const_pointer
typedef const Element & const_reference
typedef oned_tag dimension_tag
typedef fixed< Size,-1 > generator_type
typedef fixed_memory_tag memory_tag
typedef Element * pointer
typedef Element & reference
typedef not_resizable_tag resizing_tag
typedef fixed_size_tag size_tag
typedef Element value_type

Public Member Functions

 CML_STATIC_REQUIRE (Size > 0)
const_pointer data () const
 Return access to the data as a raw pointer.
pointer data ()
 Return access to the data as a raw pointer.
const_reference operator[] (size_t i) const
 Const access to the data as a C array.
reference operator[] (size_t i)
 Access to the data as a C array.
size_t size () const
 Return the number of elements in the array.

Protected Member Functions

 fixed_1D ()

Protected Attributes

array_impl m_data


Detailed Description

template<typename Element, int Size>
class cml::fixed_1D< Element, Size >

Statically-allocated array.

Note:
This class is designed to have the same size as a C array with the same length. It's therefore possible (but not recommended!) to coerce a normal C array into a fixed_1D<> like this:
typedef fixed_1D<double,10> array; double c_array[10]; array& array_object = *((array*)&c_array); double e1 = array_object[1];

It's also possible to do this with a pointer to an array of values (e.g. a double*), whether or not it was actually declared as a fixed C array. This is HIGHLY DISCOURAGED, though. It's relatively straightforward to implement a separate class to take a C array (or pointer) and turn it into an array object.

See also:
cml::fixed

Definition at line 47 of file fixed_1D.h.


Member Typedef Documentation

template<typename Element, int Size>
typedef value_type cml::fixed_1D< Element, Size >::array_impl[Size]

Definition at line 65 of file fixed_1D.h.

template<typename Element, int Size>
typedef const Element* cml::fixed_1D< Element, Size >::const_pointer

Definition at line 62 of file fixed_1D.h.

template<typename Element, int Size>
typedef const Element& cml::fixed_1D< Element, Size >::const_reference

Reimplemented in cml::vector< Element, fixed< Size > >.

Definition at line 61 of file fixed_1D.h.

template<typename Element, int Size>
typedef oned_tag cml::fixed_1D< Element, Size >::dimension_tag

Definition at line 77 of file fixed_1D.h.

template<typename Element, int Size>
typedef fixed<Size,-1> cml::fixed_1D< Element, Size >::generator_type

Reimplemented in cml::vector< Element, fixed< Size > >.

Definition at line 55 of file fixed_1D.h.

template<typename Element, int Size>
typedef fixed_memory_tag cml::fixed_1D< Element, Size >::memory_tag

Reimplemented in cml::vector< Element, fixed< Size > >.

Definition at line 68 of file fixed_1D.h.

template<typename Element, int Size>
typedef Element* cml::fixed_1D< Element, Size >::pointer

Definition at line 59 of file fixed_1D.h.

template<typename Element, int Size>
typedef Element& cml::fixed_1D< Element, Size >::reference

Reimplemented in cml::vector< Element, fixed< Size > >.

Definition at line 60 of file fixed_1D.h.

template<typename Element, int Size>
typedef not_resizable_tag cml::fixed_1D< Element, Size >::resizing_tag

Definition at line 74 of file fixed_1D.h.

template<typename Element, int Size>
typedef fixed_size_tag cml::fixed_1D< Element, Size >::size_tag

Reimplemented in cml::vector< Element, fixed< Size > >.

Definition at line 71 of file fixed_1D.h.

template<typename Element, int Size>
typedef Element cml::fixed_1D< Element, Size >::value_type

Reimplemented in cml::vector< Element, fixed< Size > >.

Definition at line 58 of file fixed_1D.h.


Member Enumeration Documentation

template<typename Element, int Size>
anonymous enum

The length as an enumerated value.

Enumerator:
array_size 

Definition at line 83 of file fixed_1D.h.


Constructor & Destructor Documentation

template<typename Element, int Size>
cml::fixed_1D< Element, Size >::fixed_1D (  )  [inline, protected]

Definition at line 117 of file fixed_1D.h.


Member Function Documentation

template<typename Element, int Size>
cml::fixed_1D< Element, Size >::CML_STATIC_REQUIRE ( Size  ,
 
)

template<typename Element, int Size>
const_pointer cml::fixed_1D< Element, Size >::data (  )  const [inline]

Return access to the data as a raw pointer.

Definition at line 113 of file fixed_1D.h.

template<typename Element, int Size>
pointer cml::fixed_1D< Element, Size >::data (  )  [inline]

Return access to the data as a raw pointer.

Definition at line 110 of file fixed_1D.h.

template<typename Element, int Size>
const_reference cml::fixed_1D< Element, Size >::operator[] ( size_t  i  )  const [inline]

Const access to the data as a C array.

Parameters:
i a size_t index into the array.
Returns:
a const reference to the array value at i.
Note:
This function does not range-check the argument.

Definition at line 107 of file fixed_1D.h.

template<typename Element, int Size>
reference cml::fixed_1D< Element, Size >::operator[] ( size_t  i  )  [inline]

Access to the data as a C array.

Parameters:
i a size_t index into the array.
Returns:
a mutable reference to the array value at i.
Note:
This function does not range-check the argument.

Definition at line 98 of file fixed_1D.h.

template<typename Element, int Size>
size_t cml::fixed_1D< Element, Size >::size (  )  const [inline]

Return the number of elements in the array.

Definition at line 89 of file fixed_1D.h.


Member Data Documentation

template<typename Element, int Size>
array_impl cml::fixed_1D< Element, Size >::m_data [protected]


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

Generated on Sat Jul 18 19:35:38 2009 for CML 1.0 by  doxygen 1.5.9