A class to hold data on a regular 2D grid. More...
#include <mia/2d/datafield.hh>
Data Structures | |
class | ConstRange |
class | Range |
Public Types | |
typedef ::std::vector< typename __holder_type_dispatch< T >::type > | data_array |
type for the flat reprentation of the 2D data field More... | |
Public Member Functions | |
const_iterator | begin () const |
iterator | begin () |
const_iterator | begin_at (size_t x, size_t y) const |
iterator | begin_at (size_t x, size_t y) |
range_iterator | begin_range (const C2DBounds &begin, const C2DBounds &end) |
const_range_iterator | begin_range (const C2DBounds &begin, const C2DBounds &end) const |
void | clear () |
const_iterator | end () const |
iterator | end () |
range_iterator | end_range (const C2DBounds &begin, const C2DBounds &end) |
const_range_iterator | end_range (const C2DBounds &begin, const C2DBounds &end) const |
void | get_data_line_x (size_t y, std::vector< T > &buffer) const |
void | get_data_line_y (size_t x, std::vector< T > &buffer) const |
Range | get_range (const C2DBounds &start, const C2DBounds &end) |
ConstRange | get_range (const C2DBounds &start, const C2DBounds &end) const |
const C2DBounds & | get_size () const |
void | make_single_ref () __attribute__((deprecated)) |
const_reference | operator() (size_t x, size_t y) const |
reference | operator() (size_t x, size_t y) |
const_reference | operator() (const C2DBounds &l) const |
reference | operator() (const C2DBounds &l) |
T2DDatafield< T > & | operator= (const T2DDatafield< T > &org) |
T2DDatafield< T > & | operator= (T2DDatafield< T > &&org) |
const_reference | operator[] (size_t idx) const |
reference | operator[] (size_t idx) |
void | put_data_line_x (size_t y, const std::vector< T > &buffer) |
void | put_data_line_y (size_t x, const std::vector< T > &buffer) |
size_type | size () const |
T2DDatafield () | |
T2DDatafield (const C2DBounds &size) | |
T2DDatafield (const C2DBounds &size, const T *_data) | |
T2DDatafield (const C2DBounds &size, const std::vector< T > &data) | |
T2DDatafield (const T2DDatafield< T > &org) | |
T2DDatafield (T2DDatafield< T > &&org) | |
virtual | ~T2DDatafield () |
A class to hold data on a regular 2D grid.
This class is the base for all kind of 2D data that is stored over a regular grid. The data it hols is stored in a shared pointer.
T | the data type of the values hold at the grid points. |
Definition at line 89 of file 2d/datafield.hh.
typedef ::std::vector<typename __holder_type_dispatch<T>::type> T2DDatafield< T >::data_array |
type for the flat reprentation of the 2D data field
Definition at line 94 of file 2d/datafield.hh.
T2DDatafield< T >::T2DDatafield | ( | ) |
|
explicit |
Create a 2D data field with the given size
size |
T2DDatafield< T >::T2DDatafield | ( | const C2DBounds & | size, |
const T * | _data | ||
) |
Create a 2D data field with the given size and initialize it with the given data
size | |
_data | must at least be of size (size.x*size.y) |
T2DDatafield< T >::T2DDatafield | ( | const C2DBounds & | size, |
const std::vector< T > & | data | ||
) |
Create a 2D data field with the given size and initialize it with the given data
size | |
data | must at least be of size (size.x*size.y) |
T2DDatafield< T >::T2DDatafield | ( | const T2DDatafield< T > & | org | ) |
copy constructor, it does a deep copy.
T2DDatafield< T >::T2DDatafield | ( | T2DDatafield< T > && | org | ) |
move constructor
|
virtual |
|
inline |
Definition at line 298 of file 2d/datafield.hh.
Referenced by T2DDatafield< C2DFVector >::begin_at(), and FDeformer2D::operator()().
|
inline |
Get a read-write iterator to iterate over the whole field. The functions ensures that the data will only be referenced by this object.
Definition at line 311 of file 2d/datafield.hh.
|
inline |
Get a read-write iterator to iterate over the field staring from the given position. The functions ensures that the data will only be referenced by this object.
x | |
y |
Definition at line 330 of file 2d/datafield.hh.
|
inline |
Get a read-only iterator to iterate over the field staring from the given position.
x | |
y |
Definition at line 343 of file 2d/datafield.hh.
range_iterator T2DDatafield< T >::begin_range | ( | const C2DBounds & | begin, |
const C2DBounds & | end | ||
) |
Referenced by T2DDatafield< C2DFVector >::begin_at().
const_range_iterator T2DDatafield< T >::begin_range | ( | const C2DBounds & | begin, |
const C2DBounds & | end | ||
) | const |
void T2DDatafield< T >::clear | ( | ) |
This function sets the elements of data to T().
|
inline |
Definition at line 303 of file 2d/datafield.hh.
Referenced by T2DDatafield< C2DFVector >::begin_at().
|
inline |
Get a read-write iterator to iterate over the whole field. The functions ensures that the data will only be referenced by this object.
Definition at line 320 of file 2d/datafield.hh.
range_iterator T2DDatafield< T >::end_range | ( | const C2DBounds & | begin, |
const C2DBounds & | end | ||
) |
Referenced by T2DDatafield< C2DFVector >::begin_at().
const_range_iterator T2DDatafield< T >::end_range | ( | const C2DBounds & | begin, |
const C2DBounds & | end | ||
) | const |
void T2DDatafield< T >::get_data_line_x | ( | size_t | y, |
std::vector< T > & | buffer | ||
) | const |
Read a data row from the data field to the provided buffer
[in] | y | row to be copied from |
[out] | buffer | to copy the data to. It will be resized to fit the data |
Referenced by T2DDatafield< C2DFVector >::operator[]().
void T2DDatafield< T >::get_data_line_y | ( | size_t | x, |
std::vector< T > & | buffer | ||
) | const |
Read a data column from the data field to the provided buffer
[in] | x | column to be copied from |
[out] | buffer | to copy the data to. It will be resized to fit the data |
Referenced by T2DDatafield< C2DFVector >::operator[]().
Range T2DDatafield< T >::get_range | ( | const C2DBounds & | start, |
const C2DBounds & | end | ||
) |
Referenced by T2DDatafield< C2DFVector >::begin_at().
ConstRange T2DDatafield< T >::get_range | ( | const C2DBounds & | start, |
const C2DBounds & | end | ||
) | const |
const C2DBounds& T2DDatafield< T >::get_size | ( | ) | const |
void T2DDatafield< T >::make_single_ref | ( | ) |
Since the data is internally stored by a shared pointer, this function ensures that the data is not shared with any other object
const_reference T2DDatafield< T >::operator() | ( | size_t | x, |
size_t | y | ||
) | const |
returns a read-only reference to the data element at (x,y). If the index is outside the image domain, the function returns the Zero element.
x | |
y |
Referenced by T2DDatafield< C2DFVector >::operator[]().
reference T2DDatafield< T >::operator() | ( | size_t | x, |
size_t | y | ||
) |
returns a writable reference to the data element at (x,y). If the index is outside the image domain, the function throws a std::invalid_argument exception.
const_reference T2DDatafield< T >::operator() | ( | const C2DBounds & | l | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
reference T2DDatafield< T >::operator() | ( | const C2DBounds & | l | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
T2DDatafield<T>& T2DDatafield< T >::operator= | ( | const T2DDatafield< T > & | org | ) |
Assignment operator, does a deep copy.
T2DDatafield<T>& T2DDatafield< T >::operator= | ( | T2DDatafield< T > && | org | ) |
Assignment move operator
|
inline |
Direct index into the underlying data array - this access is usually faster then calling operator()(size_t x, size_t y) and corresponds to \(idx= x + y * m_size.x\) but is doesn't test whether the index is inside the image domain.
idx |
Definition at line 241 of file 2d/datafield.hh.
|
inline |
Direct index into the underlying data array - this access is usually faster then calling operator()(size_t x, size_t y) and corresponds to \(idx= x + y * m_size.x\) but is doesn't test whether the index is inside the image domain.
idx |
Definition at line 253 of file 2d/datafield.hh.
void T2DDatafield< T >::put_data_line_x | ( | size_t | y, |
const std::vector< T > & | buffer | ||
) |
Write a data row to the data field. The function ensures that tha data is not shared with some other object.
[in] | y | row to be copied to |
[in] | buffer | data buffer, must be of the same size as the row size of the data field |
Referenced by T2DDatafield< C2DFVector >::operator[]().
void T2DDatafield< T >::put_data_line_y | ( | size_t | x, |
const std::vector< T > & | buffer | ||
) |
Write a data column to the data field. The function ensures that tha data is not shared with some other object.
[in] | x | column to be copied to |
[in] | buffer | data buffer, must be of the same size as the column size of the data field |
Referenced by T2DDatafield< C2DFVector >::operator[]().
size_type T2DDatafield< T >::size | ( | ) | const |
Referenced by T2DDatafield< C2DFVector >::operator[]().