Flow123d
DF_patch_fe_data_tables-da7858b
|
Accessor to input data conforming to declared Array. More...
#include <accessors.hh>
Public Types | |
typedef ::Input::Type::Array | InputType |
Public Member Functions | |
Array () | |
Array (const Array &ar) | |
Array (const Address &address, const Type::Array type) | |
template<class ValueType > | |
Iterator< ValueType > | begin () const |
IteratorBase | end () const |
unsigned int | size () const |
template<class Container > | |
void | copy_to (Container &out) const |
bool | is_empty () const |
EI_Address | ei_address () const |
string | address_string () const |
Static Public Attributes | |
static StorageArray | empty_storage_ = StorageArray(0) |
Need persisting empty instance of StorageArray that can be used to create an empty Address. More... | |
Private Attributes | |
Input::Type::Array | array_type_ |
Corresponding Type::Array. More... | |
Address | address_ |
Contains address and relationships with array ancestor. More... | |
Accessor to input data conforming to declared Array.
There are two possible ways how to retrieve data from Array accessor. First, you can use generic copy_to
function to copy the data into a given container. Second, you can get an Iterator<Type> and iterate through the Array. Unfortunately, you have to provide Type to the begin() method so this implementation is not fully compliant with standard library. The reason is that in order to speed up compilation of many classes using input accessors we wouldn't have Input::Array a class template that it can be compiled only once. By this reason one can not use BOOST_FOREACH to iterate over Input::Array. TODO: Make Input::Array<Type> wrapper which is compliant with standard library.
In either case correspondence between resulting type (i.e. type of elements of the container or type of the Iterator) and the type of the data in the Array is checked only once.
Example of usage:
Definition at line 566 of file accessors.hh.
typedef ::Input::Type::Array Input::Array::InputType |
Definition at line 569 of file accessors.hh.
Input::Array::Array | ( | ) |
Default constructor, empty accessor.
Constructor uses empty Address which causes error in program, Address has to be filled.
Definition at line 296 of file accessors.cc.
Input::Array::Array | ( | const Array & | ar | ) |
Copy constructor.
Definition at line 301 of file accessors.cc.
Input::Array::Array | ( | const Address & | address, |
const Type::Array | type | ||
) |
Constructs the accessor providing pointer store
to storage node with list of data of the record and type specification of the record given by parameter type
.
Definition at line 306 of file accessors.cc.
string Input::Array::address_string | ( | ) | const |
Get address as string.
Definition at line 321 of file accessors.cc.
|
inline |
Returns iterator to the first element of input array. The template parameter is C++ type you want to read from the array. Only types supported by Input::Interface::Iterator can be used.
Definition at line 145 of file accessors_impl.hh.
void Input::Array::copy_to | ( | Container & | out | ) | const |
Method to fill the given container out
with data in the input Array. The container has to have methods clear
and push_back
. The C++ type of the values in the container has to be supported by Iterator<T>.
Definition at line 170 of file accessors_impl.hh.
Input::EI_Address Input::Array::ei_address | ( | ) | const |
Returns address error info.
Definition at line 314 of file accessors.cc.
|
inline |
Returns end iterator common to all iterators inner types.
Definition at line 157 of file accessors_impl.hh.
|
inline |
Returns true if the accessor is empty (after default constructor). TODO: have something similar for other accessors.
Definition at line 618 of file accessors.hh.
|
inline |
Actual size of the input array.
Definition at line 163 of file accessors_impl.hh.
|
private |
Contains address and relationships with array ancestor.
Definition at line 639 of file accessors.hh.
|
private |
Corresponding Type::Array.
Definition at line 636 of file accessors.hh.
|
static |
Need persisting empty instance of StorageArray that can be used to create an empty Address.
Definition at line 632 of file accessors.hh.