Inheritance diagram for code::Dim2D< X >:

Like the Data::D classes, copies made from a Dim2D will share the same copy of the data used by the source Dim2D. If you want a private copy (so that changes in one won't show up in the other), use clone() instead of the assignment operator or copy constructor.
Some common speedups: to initialize the grid, rather than using
for (int i=0; i<rows; ++i)
for (int j=0; j<cols; ++j)
var[i][j] = Constants::MissingData;
Use
var.fill (Constants::MissingData);
Also to walk through a grid, instead of using
for (int i=0; i<rows; ++i)
for (int j=0; j<cols; ++j)
sum += var[i][j];
it's faster to use
for (vartype::const_iterator it=var.begin(), end=var.end(); it!=end; ++it)
sum += *it;
Public Types | |
| typedef __normal_iterator< X > | iterator |
| typedef __normal_iterator< const X > | const_iterator |
Public Member Functions | |
| iterator | begin () |
| iterator | end () |
| iterator | get_iterator (size_t row, size_t col) |
| const_iterator | begin () const |
| const_iterator | end () const |
| const_iterator | get_iterator (size_t row, size_t col) const |
| Dim2D () | |
| Creates a 0x0 grid. | |
| Dim2D (size_t x, size_t y, const X &value=X()) | |
| Create an X x Y grid filled with copies of `value'. | |
| Dim2D (size_t x, size_t y, const X **values) | |
| Create an X x Y grid filled with a copy of `values'. | |
| virtual | ~Dim2D () |
| This class is meant to be subclassed. | |
| Dim2D | clone () const |
| Create a completely separate copy of this 2d. | |
| Dim2D< X > & | operator= (const Dim2D< X > &source) |
| Make `this' share source's data. | |
| X & | cell_ref (size_t row, size_t col) |
| Deprecated alternative to dim2d[row][col]. | |
| const X & | cell_ref (size_t row, size_t col) const |
| Deprecated alternative to dim2d[row][col]. | |
| X | get_val (size_t row, size_t col) const |
| Return a copy of the element in the specified coordinate. | |
| void | set_val (size_t row, size_t col, const X &value) |
| Slightly more efficient form of dim2d[row][col] = value. | |
| X * | operator[] (size_t row) |
| const X * | operator[] (size_t row) const |
| void | get_1d_bounds (size_t row, X *&setme_begin, X *&setme_end) |
| void | get_1d_bounds (size_t row, const X *&setme_begin, const X *&setme_end) const |
| void | push_back (const X *begin, const X *end) |
| Add a row of elements. | |
| void | push_back (const std::vector< X > &v) |
| Add a row of elements. | |
| void | replace_1d (size_t row, const X *first, const X *last) |
| Overwrite a 'row' of elements. | |
| void | replace_1d (int row, const std::vector< X > &v) |
| Overwrite a 'row' of elements. | |
| void | replace_2d (const Dim2D< X > &d) |
| Overwrite the entire 2D. | |
| void | set_2d (size_t x, size_t y, const X **values) |
| Repopulate the grid as an X x Y grid with a copy of `values'. | |
| void | fill (const X &val) |
| Set the entire grid to a value. | |
| void | fill (const X &val, size_t row_begin, size_t row_end, size_t col_begin, size_t col_end) |
| Fill a 2D range with the specified value. | |
| void | clear () |
| resets this object to a 0x0 matrix | |
| void | reserve (size_t rows, size_t cols) |
| ensure enough memory is allocated to populate an ROW x COL matrix. | |
| void | resize (size_t rows, size_t cols, const X &value=X()) |
| resizes to a ROW x COL grid and sets each cell to `value' | |
| void | replace (const X &old_value, const X &new_value) |
| replace every instance of old_value with new_value | |
| size_t | size_d () const |
| number of rows. | |
| size_t | size_d (size_t row) const |
| number of columns. | |
| int | dim_x () const |
| Number of rows. | |
| int | dim_y () const |
| Number of cols. | |
| Coord | size () const |
Protected Member Functions | |
| virtual void | shallow_copy (const Dim2D< X > &source) |
| virtual void | deep_copy (const Dim2D< X > &source) |
Protected Attributes | |
| InitSmartPtr< Impl > | _impl |
| The array of 1D types that is held. | |
Classes | |
| class | __normal_iterator |
| class | Coord |
| Dimension type for Dim2D. More... | |
| struct | Impl |
| typedef __normal_iterator<const X> code::Dim2D< X >::const_iterator |
| typedef __normal_iterator<X> code::Dim2D< X >::iterator |
| code::Dim2D< X >::Dim2D | ( | ) | [inline] |
Creates a 0x0 grid.
Use push_back() to fill this in.
| code::Dim2D< X >::Dim2D | ( | size_t | x, | |
| size_t | y, | |||
| const X & | value = X() | |||
| ) | [inline] |
Create an X x Y grid filled with copies of `value'.
| code::Dim2D< X >::Dim2D | ( | size_t | x, | |
| size_t | y, | |||
| const X ** | values | |||
| ) | [inline] |
Create an X x Y grid filled with a copy of `values'.
| virtual code::Dim2D< X >::~Dim2D | ( | ) | [inline, virtual] |
This class is meant to be subclassed.
| const_iterator code::Dim2D< X >::begin | ( | ) | const [inline] |
| iterator code::Dim2D< X >::begin | ( | ) | [inline] |
| const X& code::Dim2D< X >::cell_ref | ( | size_t | row, | |
| size_t | col | |||
| ) | const [inline] |
Deprecated alternative to dim2d[row][col].
| X& code::Dim2D< X >::cell_ref | ( | size_t | row, | |
| size_t | col | |||
| ) | [inline] |
Deprecated alternative to dim2d[row][col].
| void code::Dim2D< X >::clear | ( | ) | [inline] |
resets this object to a 0x0 matrix
| Dim2D code::Dim2D< X >::clone | ( | ) | const [inline] |
Create a completely separate copy of this 2d.
To create a copy that shares this data, use operator=
Reimplemented in code::CartesianGrid2D, code::Data2D< T3, T4, X >, code::Grid2D, code::Image< T >, code::LatLonGrid, code::Data2D< code::Angle, code::Angle, float >, code::Data2D< code::Length, code::Length, float >, code::Data2D< code::DLLH, code::DLLH, float >, code::Image< float >, and code::Image< int >.
| virtual void code::Dim2D< X >::deep_copy | ( | const Dim2D< X > & | source | ) | [inline, protected, virtual] |
| int code::Dim2D< X >::dim_x | ( | ) | const [inline] |
| int code::Dim2D< X >::dim_y | ( | ) | const [inline] |
| const_iterator code::Dim2D< X >::end | ( | ) | const [inline] |
| iterator code::Dim2D< X >::end | ( | ) | [inline] |
| void code::Dim2D< X >::fill | ( | const X & | val, | |
| size_t | row_begin, | |||
| size_t | row_end, | |||
| size_t | col_begin, | |||
| size_t | col_end | |||
| ) | [inline] |
Fill a 2D range with the specified value.
Equivalent, but more efficient, form of "for (i=ibegin; i<iend; ++i) for (j=jbegin; j<jend; ++j) d[i][j]=val;"
| void code::Dim2D< X >::fill | ( | const X & | val | ) | [inline] |
Set the entire grid to a value.
| void code::Dim2D< X >::get_1d_bounds | ( | size_t | row, | |
| const X *& | setme_begin, | |||
| const X *& | setme_end | |||
| ) | const [inline] |
| void code::Dim2D< X >::get_1d_bounds | ( | size_t | row, | |
| X *& | setme_begin, | |||
| X *& | setme_end | |||
| ) | [inline] |
| const_iterator code::Dim2D< X >::get_iterator | ( | size_t | row, | |
| size_t | col | |||
| ) | const [inline] |
| iterator code::Dim2D< X >::get_iterator | ( | size_t | row, | |
| size_t | col | |||
| ) | [inline] |
| X code::Dim2D< X >::get_val | ( | size_t | row, | |
| size_t | col | |||
| ) | const [inline] |
Return a copy of the element in the specified coordinate.
| Dim2D<X>& code::Dim2D< X >::operator= | ( | const Dim2D< X > & | source | ) | [inline] |
Make `this' share source's data.
To create a copy that doesn't share data, use clone()
Reimplemented in code::Data2D< T3, T4, X >, code::Data2D< code::Angle, code::Angle, float >, code::Data2D< code::Length, code::Length, float >, and code::Data2D< code::DLLH, code::DLLH, float >.
| const X* code::Dim2D< X >::operator[] | ( | size_t | row | ) | const [inline] |
| X* code::Dim2D< X >::operator[] | ( | size_t | row | ) | [inline] |
| void code::Dim2D< X >::push_back | ( | const std::vector< X > & | v | ) | [inline] |
Add a row of elements.
| void code::Dim2D< X >::push_back | ( | const X * | begin, | |
| const X * | end | |||
| ) | [inline] |
Add a row of elements.
| void code::Dim2D< X >::replace | ( | const X & | old_value, | |
| const X & | new_value | |||
| ) | [inline] |
replace every instance of old_value with new_value
| void code::Dim2D< X >::replace_1d | ( | int | row, | |
| const std::vector< X > & | v | |||
| ) | [inline] |
Overwrite a 'row' of elements.
The number of new and old elements must match.
| void code::Dim2D< X >::replace_1d | ( | size_t | row, | |
| const X * | first, | |||
| const X * | last | |||
| ) | [inline] |
Overwrite a 'row' of elements.
The number of old and new elements must match.
| void code::Dim2D< X >::replace_2d | ( | const Dim2D< X > & | d | ) | [inline] |
Overwrite the entire 2D.
This copies the elements from d, rather than sharing them. If you want to share them, use the assignment operator instead.
| void code::Dim2D< X >::reserve | ( | size_t | rows, | |
| size_t | cols | |||
| ) | [inline] |
ensure enough memory is allocated to populate an ROW x COL matrix.
| void code::Dim2D< X >::resize | ( | size_t | rows, | |
| size_t | cols, | |||
| const X & | value = X() | |||
| ) | [inline] |
resizes to a ROW x COL grid and sets each cell to `value'
| void code::Dim2D< X >::set_2d | ( | size_t | x, | |
| size_t | y, | |||
| const X ** | values | |||
| ) | [inline] |
Repopulate the grid as an X x Y grid with a copy of `values'.
| void code::Dim2D< X >::set_val | ( | size_t | row, | |
| size_t | col, | |||
| const X & | value | |||
| ) | [inline] |
Slightly more efficient form of dim2d[row][col] = value.
| virtual void code::Dim2D< X >::shallow_copy | ( | const Dim2D< X > & | source | ) | [inline, protected, virtual] |
| class Coord code::Dim2D< X >::size | ( | ) | const [inline] |
Reimplemented in code::CartesianGrid2D, code::Grid2D, and code::LatLonGrid.
| size_t code::Dim2D< X >::size_d | ( | size_t | row | ) | const [inline] |
number of columns.
| size_t code::Dim2D< X >::size_d | ( | ) | const [inline] |
number of rows.
InitSmartPtr< Impl > code::Dim2D< X >::_impl [protected] |
The array of 1D types that is held.
1.4.7