tue_config
Public Member Functions | Private Member Functions | Private Attributes | List of all members
tue::config::Reader Class Reference

#include <reader.h>

Public Member Functions

DataConstPointer data () const
 data get the data from the current reading/writing point More...
 
bool endArray ()
 endArray go to parrent of current array, wrapping end() for readibility More...
 
bool endGroup ()
 endGroup go to the parrent of current group, wrapping end() for readbility More...
 
bool hasArray (const std::string &name)
 hasArray check if current node has a child, which is an array, with the key 'name' More...
 
bool hasGroup (const std::string &name)
 hasGroup check if current node has a child, which is a group, with the key 'name' More...
 
bool nextArrayItem ()
 nextArrayItem go to the next item in the array, wrapping next() for readbility More...
 
bool readArray (const std::string &name, const RequiredOrOptional opt=OPTIONAL)
 readArray read the child with key 'name', which should be an array More...
 
 Reader (const DataConstPointer &ptr)
 
bool readGroup (const std::string &name, const RequiredOrOptional opt=OPTIONAL)
 readGroup read the child with key 'name', which should be a group More...
 
template<typename T >
bool value (const std::string &name, T &value, const RequiredOrOptional=REQUIRED) const
 value read value of child with key 'name' More...
 
virtual ~Reader ()
 

Private Member Functions

bool end ()
 end go to parent node. More...
 
bool hasChild (const std::string &name, NodeType type) const
 hasChild check if node has a child with key 'name' and type ARRAY or MAP More...
 
bool next ()
 next go to next item in an array More...
 
bool read (const std::string &name, const NodeType type, const RequiredOrOptional opt=OPTIONAL)
 read read child with key 'name' of type ARRAY or MAP More...
 

Private Attributes

boost::shared_ptr< const Datacfg_
 
NodeIdx idx_
 

Detailed Description

Definition at line 16 of file reader.h.

Constructor & Destructor Documentation

◆ Reader()

tue::config::Reader::Reader ( const DataConstPointer ptr)

Definition at line 12 of file reader.cpp.

◆ ~Reader()

tue::config::Reader::~Reader ( )
virtual

Definition at line 18 of file reader.cpp.

Member Function Documentation

◆ data()

DataConstPointer tue::config::Reader::data ( ) const
inline

data get the data from the current reading/writing point

Returns
DataConstPointer

Definition at line 101 of file reader.h.

◆ end()

bool tue::config::Reader::end ( )
private

end go to parent node.

Returns
indicates succes, can fail if current node doesn't have a parent

Definition at line 43 of file reader.cpp.

◆ endArray()

bool tue::config::Reader::endArray ( )
inline

endArray go to parrent of current array, wrapping end() for readibility

Returns
indicates succes, see end() for more information

Definition at line 69 of file reader.h.

◆ endGroup()

bool tue::config::Reader::endGroup ( )
inline

endGroup go to the parrent of current group, wrapping end() for readbility

Returns
indicates succes, see end() for more information

Definition at line 75 of file reader.h.

◆ hasArray()

bool tue::config::Reader::hasArray ( const std::string name)
inline

hasArray check if current node has a child, which is an array, with the key 'name'

Parameters
namekey of the possible child array
Returns
indicates succes, can fail if key isn't avalaible or child is an array instead of a group

Definition at line 88 of file reader.h.

◆ hasChild()

bool tue::config::Reader::hasChild ( const std::string name,
NodeType  type 
) const
private

hasChild check if node has a child with key 'name' and type ARRAY or MAP

Parameters
namekey of the child
typenode type of the child, ARRAY or MAP
Returns
indicates succes, can fail if key isn't avalaible or child is a group instead of an array

Definition at line 76 of file reader.cpp.

◆ hasGroup()

bool tue::config::Reader::hasGroup ( const std::string name)
inline

hasGroup check if current node has a child, which is a group, with the key 'name'

Parameters
namekey of the possible child group
Returns
indicates succes, can fail if key isn't avalaible or child is a group instead of an array

Definition at line 95 of file reader.h.

◆ next()

bool tue::config::Reader::next ( )
private

next go to next item in an array

Returns
indicates succes, can fail if current node isn't in an array or if it is the last item in the array

Definition at line 60 of file reader.cpp.

◆ nextArrayItem()

bool tue::config::Reader::nextArrayItem ( )
inline

nextArrayItem go to the next item in the array, wrapping next() for readbility

Returns
indicates succes, can fail if current node isn't in an array or if it is the last item in the array

Definition at line 81 of file reader.h.

◆ read()

bool tue::config::Reader::read ( const std::string name,
const NodeType  type,
const RequiredOrOptional  opt = OPTIONAL 
)
private

read read child with key 'name' of type ARRAY or MAP

Parameters
namekey of the child
typenode type of the child, ARRAY or MAP
optRequiredOrOptional
Returns
indicates succes, can fail if key isn't avalaible or child is of incorrect type

Definition at line 24 of file reader.cpp.

◆ readArray()

bool tue::config::Reader::readArray ( const std::string name,
const RequiredOrOptional  opt = OPTIONAL 
)
inline

readArray read the child with key 'name', which should be an array

Parameters
namekey of the array
optRequiredOrOptional
Returns
indicates succes, can fail if key isn't available or child is a group instead of an array

Definition at line 55 of file reader.h.

◆ readGroup()

bool tue::config::Reader::readGroup ( const std::string name,
const RequiredOrOptional  opt = OPTIONAL 
)
inline

readGroup read the child with key 'name', which should be a group

Parameters
namekey of the group
optRequiredOrOptional
Returns
indicates succes, can fail if key isn't avalaible or child is an array instead of a group

Definition at line 63 of file reader.h.

◆ value()

template<typename T >
bool tue::config::Reader::value ( const std::string name,
T &  value,
const  RequiredOrOptional = REQUIRED 
) const
inline

value read value of child with key 'name'

Parameters
namename of the key
valueobject to write the value to
optRequiredOrOptional
Returns
indicates succes, can fail if key not available or variable type isn't matching

Definition at line 33 of file reader.h.

Member Data Documentation

◆ cfg_

boost::shared_ptr<const Data> tue::config::Reader::cfg_
private

Definition at line 136 of file reader.h.

◆ idx_

NodeIdx tue::config::Reader::idx_
private

Definition at line 134 of file reader.h.


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