cml::dynamic_1D< Element, Alloc > Class Template Reference

Dynamically-sized and allocated 1D array. More...

#include <dynamic_1D.h>

Inheritance diagram for cml::dynamic_1D< Element, Alloc >:

Inheritance graph
[legend]
Collaboration diagram for cml::dynamic_1D< Element, Alloc >:

Collaboration graph
[legend]

List of all members.

Public Types

enum  { array_size = -1 }
 Dynamic arrays have no fixed size. More...
typedef Alloc::template rebind
< Element >::other 
allocator_type
typedef std::vector< Element,
allocator_type
array_impl
typedef array_impl::const_pointer const_pointer
typedef array_impl::const_reference const_reference
typedef oned_tag dimension_tag
typedef dynamic< Alloc > generator_type
typedef dynamic_memory_tag memory_tag
typedef array_impl::pointer pointer
typedef array_impl::reference reference
typedef resizable_tag resizing_tag
typedef dynamic_size_tag size_tag
typedef array_impl::value_type value_type

Public Member Functions

const_pointer data () const
 Return access to the data as a raw pointer.
pointer data ()
 Return access to the data as a raw pointer.
 dynamic_1D (size_t size)
 Construct a dynamic array given the size.
 dynamic_1D ()
 Construct a dynamic array with no size.
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.
void resize (size_t s)
 Set the array size to the given value.
size_t size () const
 Return the number of elements in the array.

Protected Attributes

array_impl m_data


Detailed Description

template<typename Element, class Alloc>
class cml::dynamic_1D< Element, Alloc >

Dynamically-sized and allocated 1D array.

Note:
The allocator should be an STL-compatible allocator.

Definition at line 30 of file dynamic_1D.h.


Member Typedef Documentation

template<typename Element, class Alloc>
typedef Alloc::template rebind<Element>::other cml::dynamic_1D< Element, Alloc >::allocator_type

Definition at line 35 of file dynamic_1D.h.

template<typename Element, class Alloc>
typedef std::vector<Element,allocator_type> cml::dynamic_1D< Element, Alloc >::array_impl

Definition at line 41 of file dynamic_1D.h.

template<typename Element, class Alloc>
typedef array_impl::const_pointer cml::dynamic_1D< Element, Alloc >::const_pointer

Definition at line 48 of file dynamic_1D.h.

template<typename Element, class Alloc>
typedef array_impl::const_reference cml::dynamic_1D< Element, Alloc >::const_reference

Reimplemented in cml::vector< Element, dynamic< Alloc > >.

Definition at line 47 of file dynamic_1D.h.

template<typename Element, class Alloc>
typedef oned_tag cml::dynamic_1D< Element, Alloc >::dimension_tag

Definition at line 60 of file dynamic_1D.h.

template<typename Element, class Alloc>
typedef dynamic<Alloc> cml::dynamic_1D< Element, Alloc >::generator_type

Reimplemented in cml::vector< Element, dynamic< Alloc > >.

Definition at line 38 of file dynamic_1D.h.

template<typename Element, class Alloc>
typedef dynamic_memory_tag cml::dynamic_1D< Element, Alloc >::memory_tag

Reimplemented in cml::vector< Element, dynamic< Alloc > >.

Definition at line 51 of file dynamic_1D.h.

template<typename Element, class Alloc>
typedef array_impl::pointer cml::dynamic_1D< Element, Alloc >::pointer

Definition at line 45 of file dynamic_1D.h.

template<typename Element, class Alloc>
typedef array_impl::reference cml::dynamic_1D< Element, Alloc >::reference

Reimplemented in cml::vector< Element, dynamic< Alloc > >.

Definition at line 46 of file dynamic_1D.h.

template<typename Element, class Alloc>
typedef resizable_tag cml::dynamic_1D< Element, Alloc >::resizing_tag

Reimplemented in cml::vector< Element, dynamic< Alloc > >.

Definition at line 57 of file dynamic_1D.h.

template<typename Element, class Alloc>
typedef dynamic_size_tag cml::dynamic_1D< Element, Alloc >::size_tag

Reimplemented in cml::vector< Element, dynamic< Alloc > >.

Definition at line 54 of file dynamic_1D.h.

template<typename Element, class Alloc>
typedef array_impl::value_type cml::dynamic_1D< Element, Alloc >::value_type

Reimplemented in cml::vector< Element, dynamic< Alloc > >.

Definition at line 44 of file dynamic_1D.h.


Member Enumeration Documentation

template<typename Element, class Alloc>
anonymous enum

Dynamic arrays have no fixed size.

Enumerator:
array_size 

Definition at line 66 of file dynamic_1D.h.


Constructor & Destructor Documentation

template<typename Element, class Alloc>
cml::dynamic_1D< Element, Alloc >::dynamic_1D (  )  [inline]

Construct a dynamic array with no size.

Definition at line 72 of file dynamic_1D.h.

template<typename Element, class Alloc>
cml::dynamic_1D< Element, Alloc >::dynamic_1D ( size_t  size  )  [inline, explicit]

Construct a dynamic array given the size.

Definition at line 75 of file dynamic_1D.h.


Member Function Documentation

template<typename Element, class Alloc>
const_pointer cml::dynamic_1D< Element, Alloc >::data (  )  const [inline]

Return access to the data as a raw pointer.

Definition at line 105 of file dynamic_1D.h.

template<typename Element, class Alloc>
pointer cml::dynamic_1D< Element, Alloc >::data (  )  [inline]

Return access to the data as a raw pointer.

Definition at line 102 of file dynamic_1D.h.

template<typename Element, class Alloc>
const_reference cml::dynamic_1D< Element, Alloc >::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 99 of file dynamic_1D.h.

template<typename Element, class Alloc>
reference cml::dynamic_1D< Element, Alloc >::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 90 of file dynamic_1D.h.

template<typename Element, class Alloc>
void cml::dynamic_1D< Element, Alloc >::resize ( size_t  s  )  [inline]

Set the array size to the given value.

Warning:
This is not guaranteed to preserve the original data.

Definition at line 114 of file dynamic_1D.h.

template<typename Element, class Alloc>
size_t cml::dynamic_1D< Element, Alloc >::size (  )  const [inline]

Return the number of elements in the array.

Definition at line 81 of file dynamic_1D.h.


Member Data Documentation

template<typename Element, class Alloc>
array_impl cml::dynamic_1D< Element, Alloc >::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