DUECA/DUSIME
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Friends | List of all members
dueca::ElementReader Class Reference

ElementReader an object to read a member of a DCO object. More...

#include <CommObjectElementReader.hxx>

Public Member Functions

void read (std::string &s, std::string &k)
 read a value.
 
void read (boost::any &a, boost::any &k)
 read a value.
 
void read (std::string &s)
 read a value, no provision for returning a key if it exists.
 
void read (boost::any &a)
 read a value, no provision for returning a key if it exists.
 
void peek (std::string &s)
 read a value, but do not step/iterate/invalidate.
 
void peek (boost::any &a)
 read a value, but do not step/iterate/invalidate.
 
CommObjectReader recurse (std::string &k)
 recursively access a nested object.
 
CommObjectReader recurse (boost::any &k)
 recursively access a nested object.
 
bool isEnd ()
 returns true if the last value has been read.
 
bool isNested ()
 returns whether the object can be recursed or not
 
MemberArity getArity ()
 returns what type of "Arity" the object has; either a single object, an iterable object, or a mapped object, i.e.
 
size_t size () const
 Returns the current size of an array, map, list, if applicable.
 

Static Public Attributes

static const size_t RESERVE = 3*sizeof(void*)
 Dirty use of memory; reserve empty space here.
 

Friends

template<typename C , typename T >
class CommObjectMemberAccess
 Make this (templated class) a friend, for constructor and placement of the internal ReadElement object.
 

Detailed Description

ElementReader an object to read a member of a DCO object.

The ElementReader enables a generic level (based on std::string or boost::any) interaction with a member of a DCO object. Generally, the ElementReader will be provided by a dueca::CommObjectReader, which in turn may be supplied by a channel through its descendant dueca::DCOReader.

If the member is iterable, it may be read multiple times by read calls, each read call will set an iterator to point to the next element of the member. The isEnd() call can be used to test whether the iteration has ended. If a type is not iterable, there will be only one read until isEnd() returns true.

Single members may be read in std::string or boost::any form, compound members (themselves DCO objects) may be recursively inspected using the recurse() call, producing new ElementReader objects. When attempting to read a single member, but the object is compound, a dueca::ConversionNotDefined exception will be thrown. When attempting to recurse into a compound member, but the member is single, a dueca::TypeIsNotNested exception will be thrown.

The isEnd() call indicates whether all elements of a member have been read.

Member Function Documentation

◆ read() [1/2]

void dueca::ElementReader::read ( std::string & s,
std::string & k )
inline

read a value.

If the read value is a map, the key k will return a non-null value

◆ read() [2/2]

void dueca::ElementReader::read ( boost::any & a,
boost::any & k )
inline

read a value.

If the read value is a map, the key k will return a non-null value

◆ recurse() [1/2]

CommObjectReader dueca::ElementReader::recurse ( std::string & k)
inline

recursively access a nested object.

k returns the key if it exists

◆ recurse() [2/2]

CommObjectReader dueca::ElementReader::recurse ( boost::any & k)
inline

recursively access a nested object.

k returns the key if it exists

◆ getArity()

MemberArity dueca::ElementReader::getArity ( )
inline

returns what type of "Arity" the object has; either a single object, an iterable object, or a mapped object, i.e.

iterable with key


The documentation for this class was generated from the following file: