humoto
Public Member Functions | Private Member Functions | Private Attributes | List of all members
humoto::config::msgpack::Reader Class Reference

Detailed Description

Configuration reader class.

Definition at line 21 of file reader.h.

#include <reader.h>

Public Member Functions

 Reader (const std::string &file_name)
 Constructor. More...
 
 Reader ()
 Default constructor. More...
 
void ascend ()
 Ascend from the current entry to its parent. More...
 
bool descend (const std::string &child_name)
 Descend to the entry with the given name. More...
 
template<typename t_Scalar , int t_rows, int t_flags>
void readCompound (Eigen::Matrix< t_Scalar, t_rows, 1, t_flags > &entry, const std::string &entry_name, const bool crash_on_missing_entry=false)
 Read configuration entry (vector) More...
 
template<typename t_Scalar , int t_rows, int t_cols, int t_flags>
void readCompound (Eigen::Matrix< t_Scalar, t_rows, t_cols, t_flags > &entry, const std::string &entry_name, const bool crash_on_missing_entry=false)
 Read a configuration entry (matrix) More...
 
template<typename t_VectorEntryType >
void readCompound (std::vector< t_VectorEntryType > &entry, const std::string &entry_name, const bool crash_on_missing_entry=false)
 Read configuration entry (std::vector) More...
 
template<typename t_EnumerationType >
void readEnum (t_EnumerationType &entry, const std::string &entry_name, const bool crash_on_missing_entry=false)
 Read configuration entry (an enum). This method is added since an explicit casting to integer is needed. More...
 
template<typename t_EntryType >
void readScalar (t_EntryType &entry, const std::string &entry_name, const bool crash_on_missing_entry=false)
 Read configuration entry (scalar template) More...
 

Private Member Functions

const ::msgpack::object * getCurrentNode () const
 Get current node. More...
 
void openFile (const std::string &file_name)
 open configuration file More...
 

Private Attributes

std::string buffer_
 
std::vector< boost::shared_ptr< ::msgpack::object_handle > > handles_
 
std::stack< const ::msgpack::object *> node_stack_
 Stack of nodes. More...
 

Constructor & Destructor Documentation

◆ Reader() [1/2]

humoto::config::msgpack::Reader::Reader ( const std::string &  file_name)
inlineexplicit

Constructor.

Parameters
[in]file_name

Definition at line 95 of file reader.h.

◆ Reader() [2/2]

humoto::config::msgpack::Reader::Reader ( )
inline

Default constructor.

Definition at line 104 of file reader.h.

Member Function Documentation

◆ ascend()

void humoto::config::msgpack::Reader::ascend ( )
inline

Ascend from the current entry to its parent.

Definition at line 158 of file reader.h.

◆ descend()

bool humoto::config::msgpack::Reader::descend ( const std::string &  child_name)
inline

Descend to the entry with the given name.

Parameters
[in]child_namechild node name
Returns
true if successful.

Definition at line 117 of file reader.h.

◆ getCurrentNode()

const ::msgpack::object* humoto::config::msgpack::Reader::getCurrentNode ( ) const
inlineprivate

Get current node.

Returns
pointer to the current node

Definition at line 83 of file reader.h.

◆ openFile()

void humoto::config::msgpack::Reader::openFile ( const std::string &  file_name)
inlineprivate

open configuration file

Parameters
[in]file_name

Definition at line 38 of file reader.h.

◆ readCompound() [1/3]

template<typename t_Scalar , int t_rows, int t_flags>
void humoto::config::msgpack::Reader::readCompound ( Eigen::Matrix< t_Scalar, t_rows, 1, t_flags > &  entry,
const std::string &  entry_name,
const bool  crash_on_missing_entry = false 
)
inline

Read configuration entry (vector)

Template Parameters
t_ScalarEigen template parameter
t_rowsEigen template parameter
t_flagsEigen template parameter
Parameters
[out]entryconfiguration parameter
[in]entry_namename of the configuration parameter
[in]crash_on_missing_entry

Definition at line 178 of file reader.h.

◆ readCompound() [2/3]

template<typename t_Scalar , int t_rows, int t_cols, int t_flags>
void humoto::config::msgpack::Reader::readCompound ( Eigen::Matrix< t_Scalar, t_rows, t_cols, t_flags > &  entry,
const std::string &  entry_name,
const bool  crash_on_missing_entry = false 
)
inline

Read a configuration entry (matrix)

Template Parameters
t_ScalarEigen template parameter
t_rowsEigen template parameter
t_colsEigen template parameter
t_flagsEigen template parameter
Parameters
[out]entrydata
[in]entry_namename
[in]crash_on_missing_entry

Definition at line 231 of file reader.h.

◆ readCompound() [3/3]

template<typename t_VectorEntryType >
void humoto::config::msgpack::Reader::readCompound ( std::vector< t_VectorEntryType > &  entry,
const std::string &  entry_name,
const bool  crash_on_missing_entry = false 
)
inline

Read configuration entry (std::vector)

Template Parameters
t_VectorEntryTypetype of the entry of std::vector
Parameters
[out]entryconfiguration parameter
[in]entry_namename of the configuration parameter
[in]crash_on_missing_entry

Definition at line 280 of file reader.h.

◆ readEnum()

template<typename t_EnumerationType >
void humoto::config::msgpack::Reader::readEnum ( t_EnumerationType &  entry,
const std::string &  entry_name,
const bool  crash_on_missing_entry = false 
)
inline

Read configuration entry (an enum). This method is added since an explicit casting to integer is needed.

Template Parameters
t_EnumerationTypeenumeration type
Parameters
[out]entryconfiguration parameter
[in]entry_namename of the configuration parameter
[in]crash_on_missing_entry

Definition at line 349 of file reader.h.

◆ readScalar()

template<typename t_EntryType >
void humoto::config::msgpack::Reader::readScalar ( t_EntryType &  entry,
const std::string &  entry_name,
const bool  crash_on_missing_entry = false 
)
inline

Read configuration entry (scalar template)

Template Parameters
t_EntryTypetype of the entry
Parameters
[out]entryconfiguration parameter
[in]entry_namename of the configuration parameter
[in]crash_on_missing_entry

Definition at line 319 of file reader.h.

Member Data Documentation

◆ buffer_

std::string humoto::config::msgpack::Reader::buffer_
private

Definition at line 24 of file reader.h.

◆ handles_

std::vector< boost::shared_ptr< ::msgpack::object_handle > > humoto::config::msgpack::Reader::handles_
private

Definition at line 26 of file reader.h.

◆ node_stack_

std::stack< const ::msgpack::object * > humoto::config::msgpack::Reader::node_stack_
private

Stack of nodes.

Definition at line 29 of file reader.h.


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