libpniio
|
flat group adapter More...
#include <flat_group.hpp>
Public Types | |
typedef GTYPE | group_type |
the group type More... | |
typedef nxobject_trait < nximp_code_map< group_type > ::icode >::object_type | value_type |
nxobject is the value type of the flat_group container More... | |
typedef std::vector< value_type > | container_type |
the internal container type More... | |
typedef container_type::iterator | iterator |
the iterator type More... | |
typedef container_type::const_iterator | const_iterator |
the constant interator type More... | |
Public Member Functions | |
flat_group (const group_type &parent) | |
constructor More... | |
value_type | operator[] (size_t index) const noexcept |
get element More... | |
value_type & | operator[] (size_t index) noexcept |
get element reference More... | |
size_t | size () const noexcept |
get size More... | |
iterator | begin () noexcept |
get iterator to first More... | |
iterator | end () noexcept |
get iterator to last+1 More... | |
const_iterator | begin () const noexcept |
get iterator to first More... | |
const_iterator | end () const noexcept |
get iterator to last+1 More... | |
Private Member Functions | |
void | append_children (const group_type &parent) |
append children to container More... | |
Private Attributes | |
container_type | _container |
internal container holding the objects More... | |
The flat_group adapter provides a recursive view on a group and all its children. It is typically constructed with the utility function make_flat and can be used to iterate recursively over all child nodes below a group.
A typical example would be to list the path of every object stored below a particular group
Providing an STL compliant container interface it can be used to do all kind of search operations. For instance consider the case where we would like to find all instances of NXdetector in an entry:
GTYPE | group type |
typedef container_type::const_iterator pni::io::nx::flat_group< GTYPE >::const_iterator |
typedef std::vector<value_type> pni::io::nx::flat_group< GTYPE >::container_type |
typedef GTYPE pni::io::nx::flat_group< GTYPE >::group_type |
typedef container_type::iterator pni::io::nx::flat_group< GTYPE >::iterator |
typedef nxobject_trait<nximp_code_map<group_type>::icode>::object_type pni::io::nx::flat_group< GTYPE >::value_type |
|
inlineexplicit |
invalid_object_error | if parent is not valid |
type_error | if group conversion fails |
object_error | in case of any other error |
parent | the parent group from which all elements should be gahtered |
|
inlineprivate |
Function appending all children of a parent to the internal container. If a child is a group instance this function is called recursively.
invalid_object_error | if parent is not valid |
type_error | if group conversion fails |
object_error | in case of any other error |
parent | the parent group whose children are appended |
|
inlinenoexcept |
Return a non const iterator to the first element in the group
|
inlinenoexcept |
Return a const iterator to the first element in the group
|
inlinenoexcept |
Return a non const iterator to the last+1 element in the group.
|
inlinenoexcept |
Return a const iterator to the last+1 element in the group.
|
inlinenoexcept |
Return the element with index from the group.
index | the index of the child in the recursive group |
|
inlinenoexcept |
Return a reference to the element addressed by index in the recursive group.
index | the index of the child |
|
inlinenoexcept |
Return the total number of elements attached (recursively) below this group.
|
private |