cml::dynamic_2D< Element, Layout, Alloc > Class Template Reference

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

#include <dynamic_2D.h>

Inheritance diagram for cml::dynamic_2D< Element, Layout, Alloc >:

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

Collaboration graph
[legend]

List of all members.

Public Types

enum  { array_rows = -1, array_cols = -1 }
typedef Alloc::template rebind
< Element >::other 
allocator_type
typedef std::vector< Element,
allocator_type
array_impl
typedef dynamic_1D< Element,
Alloc > 
col_array_type
typedef array_impl::const_pointer const_pointer
typedef array_impl::const_reference const_reference
typedef twod_tag dimension_tag
typedef dynamic< Alloc > generator_type
typedef Layout layout
typedef dynamic_memory_tag memory_tag
typedef array_impl::pointer pointer
typedef array_impl::reference reference
typedef resizable_tag resizing_tag
typedef dynamic_1D< Element,
Alloc > 
row_array_type
typedef dynamic_size_tag size_tag
typedef dynamic_2D< Element,
Layout, Alloc > 
transposed_type
typedef array_impl::value_type value_type

Public Member Functions

size_t cols () const
 Return the number of cols in the array.
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 row, size_t col) const
 Access the given element of the matrix.
reference operator() (size_t row, size_t col)
 Access the given element of the matrix.
void resize (size_t rows, size_t cols)
 Resize the array.
size_t rows () const
 Return the number of rows in the array.

Protected Member Functions

 dynamic_2D (size_t rows, size_t cols)
 Construct a dynamic matrix given the dimensions.
 dynamic_2D ()
 Construct a dynamic array with no size.
const_reference get_element (size_t row, size_t col, col_major) const
reference get_element (size_t row, size_t col, col_major)
const_reference get_element (size_t row, size_t col, row_major) const
reference get_element (size_t row, size_t col, row_major)

Protected Attributes

size_t m_cols
array_impl m_data
size_t m_rows


Detailed Description

template<typename Element, typename Layout, class Alloc>
class cml::dynamic_2D< Element, Layout, Alloc >

Dynamically-sized and allocated 2D array.

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

Definition at line 33 of file dynamic_2D.h.


Member Typedef Documentation

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

Definition at line 38 of file dynamic_2D.h.

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

Definition at line 44 of file dynamic_2D.h.

template<typename Element, typename Layout, class Alloc>
typedef dynamic_1D<Element,Alloc> cml::dynamic_2D< Element, Layout, Alloc >::col_array_type

Definition at line 73 of file dynamic_2D.h.

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

Definition at line 51 of file dynamic_2D.h.

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

Reimplemented in cml::matrix< Element, dynamic< Alloc >, BasisOrient, Layout >.

Definition at line 50 of file dynamic_2D.h.

template<typename Element, typename Layout, class Alloc>
typedef twod_tag cml::dynamic_2D< Element, Layout, Alloc >::dimension_tag

Definition at line 66 of file dynamic_2D.h.

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

Reimplemented in cml::matrix< Element, dynamic< Alloc >, BasisOrient, Layout >.

Definition at line 41 of file dynamic_2D.h.

template<typename Element, typename Layout, class Alloc>
typedef Layout cml::dynamic_2D< Element, Layout, Alloc >::layout

Reimplemented in cml::matrix< Element, dynamic< Alloc >, BasisOrient, Layout >.

Definition at line 54 of file dynamic_2D.h.

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

Reimplemented in cml::matrix< Element, dynamic< Alloc >, BasisOrient, Layout >.

Definition at line 57 of file dynamic_2D.h.

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

Definition at line 48 of file dynamic_2D.h.

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

Reimplemented in cml::matrix< Element, dynamic< Alloc >, BasisOrient, Layout >.

Definition at line 49 of file dynamic_2D.h.

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

Reimplemented in cml::matrix< Element, dynamic< Alloc >, BasisOrient, Layout >.

Definition at line 63 of file dynamic_2D.h.

template<typename Element, typename Layout, class Alloc>
typedef dynamic_1D<Element,Alloc> cml::dynamic_2D< Element, Layout, Alloc >::row_array_type

Definition at line 72 of file dynamic_2D.h.

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

Reimplemented in cml::matrix< Element, dynamic< Alloc >, BasisOrient, Layout >.

Definition at line 60 of file dynamic_2D.h.

template<typename Element, typename Layout, class Alloc>
typedef dynamic_2D<Element,Layout,Alloc> cml::dynamic_2D< Element, Layout, Alloc >::transposed_type

Reimplemented in cml::matrix< Element, dynamic< Alloc >, BasisOrient, Layout >.

Definition at line 69 of file dynamic_2D.h.

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

Reimplemented in cml::matrix< Element, dynamic< Alloc >, BasisOrient, Layout >.

Definition at line 47 of file dynamic_2D.h.


Member Enumeration Documentation

template<typename Element, typename Layout, class Alloc>
anonymous enum

Enumerator:
array_rows 
array_cols 

Definition at line 96 of file dynamic_2D.h.


Constructor & Destructor Documentation

template<typename Element, typename Layout, class Alloc>
cml::dynamic_2D< Element, Layout, Alloc >::dynamic_2D (  )  [inline, protected]

Construct a dynamic array with no size.

Definition at line 79 of file dynamic_2D.h.

template<typename Element, typename Layout, class Alloc>
cml::dynamic_2D< Element, Layout, Alloc >::dynamic_2D ( size_t  rows,
size_t  cols 
) [inline, explicit, protected]

Construct a dynamic matrix given the dimensions.

This constructor is guaranteed to throw only if the allocator throws. If the array implementation guarantees that the array data structure is not modified after an exception, then this constructor is exception-safe.

Exceptions:
only if the allocator throws during an allocation.

Definition at line 90 of file dynamic_2D.h.


Member Function Documentation

template<typename Element, typename Layout, class Alloc>
size_t cml::dynamic_2D< Element, Layout, Alloc >::cols (  )  const [inline]

Return the number of cols in the array.

Definition at line 105 of file dynamic_2D.h.

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

Return access to the data as a raw pointer.

Definition at line 134 of file dynamic_2D.h.

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

Return access to the data as a raw pointer.

Definition at line 131 of file dynamic_2D.h.

template<typename Element, typename Layout, class Alloc>
const_reference cml::dynamic_2D< Element, Layout, Alloc >::get_element ( size_t  row,
size_t  col,
col_major   
) const [inline, protected]

Definition at line 162 of file dynamic_2D.h.

template<typename Element, typename Layout, class Alloc>
reference cml::dynamic_2D< Element, Layout, Alloc >::get_element ( size_t  row,
size_t  col,
col_major   
) [inline, protected]

Definition at line 158 of file dynamic_2D.h.

template<typename Element, typename Layout, class Alloc>
const_reference cml::dynamic_2D< Element, Layout, Alloc >::get_element ( size_t  row,
size_t  col,
row_major   
) const [inline, protected]

Definition at line 154 of file dynamic_2D.h.

template<typename Element, typename Layout, class Alloc>
reference cml::dynamic_2D< Element, Layout, Alloc >::get_element ( size_t  row,
size_t  col,
row_major   
) [inline, protected]

Definition at line 150 of file dynamic_2D.h.

Referenced by cml::dynamic_2D< Element, Layout, Alloc >::operator()().

Here is the caller graph for this function:

template<typename Element, typename Layout, class Alloc>
const_reference cml::dynamic_2D< Element, Layout, Alloc >::operator() ( size_t  row,
size_t  col 
) const [inline]

Access the given element of the matrix.

Parameters:
row row of element.
col column of element.
Returns:
const reference.

Definition at line 126 of file dynamic_2D.h.

template<typename Element, typename Layout, class Alloc>
reference cml::dynamic_2D< Element, Layout, Alloc >::operator() ( size_t  row,
size_t  col 
) [inline]

Access the given element of the matrix.

Parameters:
row row of element.
col column of element.
Returns:
mutable reference.

Definition at line 116 of file dynamic_2D.h.

template<typename Element, typename Layout, class Alloc>
void cml::dynamic_2D< Element, Layout, Alloc >::resize ( size_t  rows,
size_t  cols 
) [inline]

Resize the array.

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

Definition at line 143 of file dynamic_2D.h.

template<typename Element, typename Layout, class Alloc>
size_t cml::dynamic_2D< Element, Layout, Alloc >::rows (  )  const [inline]

Return the number of rows in the array.

Definition at line 102 of file dynamic_2D.h.


Member Data Documentation

template<typename Element, typename Layout, class Alloc>
size_t cml::dynamic_2D< Element, Layout, Alloc >::m_cols [protected]

template<typename Element, typename Layout, class Alloc>
array_impl cml::dynamic_2D< Element, Layout, Alloc >::m_data [protected]

template<typename Element, typename Layout, class Alloc>
size_t cml::dynamic_2D< Element, Layout, Alloc >::m_rows [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