humoto
Public Member Functions | Private Member Functions | Private Attributes | List of all members
humoto::config::yaml::Writer Class Reference

Detailed Description

Configuration writer class.

Definition at line 22 of file writer.h.

#include <writer.h>

Public Member Functions

 Writer (const std::string &file_name)
 Constructor. More...
 
 ~Writer ()
 Destructor. More...
 
void ascend ()
 Ends a nested map in the configuration file. More...
 
void descend (const std::string &map_name, const std::size_t num_entries)
 Starts a nested map in the configuration file. More...
 
void flush ()
 Flush the configuration to the file. More...
 
void initRoot ()
 Starts a nested map in the configuration file. More...
 
template<typename t_Scalar , int t_rows, int t_flags>
void writeCompound (const Eigen::Matrix< t_Scalar, t_rows, 1, t_flags > &entry, const std::string &entry_name)
 Write a configuration entry (vector) More...
 
template<typename t_Scalar , int t_rows, int t_cols, int t_flags>
void writeCompound (const Eigen::Matrix< t_Scalar, t_rows, t_cols, t_flags > &entry, const std::string &entry_name)
 Write a configuration entry (matrix) More...
 
template<typename t_VectorEntryType >
void writeCompound (const std::vector< std::vector< t_VectorEntryType > > &entry, const std::string &entry_name) const
 Write configuration entry (std::vector<std::vector<std::string>>) More...
 
template<typename t_VectorEntryType >
void writeCompound (const std::vector< t_VectorEntryType > &entry, const std::string &entry_name)
 Read configuration entry (std::vector) More...
 
template<typename t_EnumType >
void writeEnum (const t_EnumType entry, const std::string &entry_name)
 Write a configuration entry (enum) More...
 
template<typename t_EntryType >
void writeScalar (const t_EntryType entry, const std::string &entry_name)
 Write a configuration entry (scalar template) More...
 

Private Member Functions

void destroyEmitter ()
 Destroy emitter. More...
 
void initEmitter ()
 Initialize emitter. More...
 

Private Attributes

std::ofstream config_ofs_
 output file stream More...
 
YAML::Emitter * emitter_
 instance of YAML emitter, is destroyed and reinitialized by flush() More...
 

Constructor & Destructor Documentation

◆ Writer()

humoto::config::yaml::Writer::Writer ( const std::string &  file_name)
inlineexplicit

Constructor.

Parameters
[in]file_name

Definition at line 65 of file writer.h.

◆ ~Writer()

humoto::config::yaml::Writer::~Writer ( )
inline

Destructor.

Definition at line 75 of file writer.h.

Member Function Documentation

◆ ascend()

void humoto::config::yaml::Writer::ascend ( )
inline

Ends a nested map in the configuration file.

Definition at line 106 of file writer.h.

◆ descend()

void humoto::config::yaml::Writer::descend ( const std::string &  map_name,
const std::size_t  num_entries 
)
inline

Starts a nested map in the configuration file.

Parameters
[in]map_namename of the map
[in]num_entriesnumber of child entries

Definition at line 87 of file writer.h.

◆ destroyEmitter()

void humoto::config::yaml::Writer::destroyEmitter ( )
inlineprivate

Destroy emitter.

Definition at line 51 of file writer.h.

◆ flush()

void humoto::config::yaml::Writer::flush ( )
inline

Flush the configuration to the file.

Definition at line 271 of file writer.h.

◆ initEmitter()

void humoto::config::yaml::Writer::initEmitter ( )
inlineprivate

Initialize emitter.

Definition at line 36 of file writer.h.

◆ initRoot()

void humoto::config::yaml::Writer::initRoot ( )
inline

Starts a nested map in the configuration file.

Definition at line 98 of file writer.h.

◆ writeCompound() [1/4]

template<typename t_Scalar , int t_rows, int t_flags>
void humoto::config::yaml::Writer::writeCompound ( const Eigen::Matrix< t_Scalar, t_rows, 1, t_flags > &  entry,
const std::string &  entry_name 
)
inline

Write a configuration entry (vector)

Template Parameters
t_DerivedEigen template parameter
Parameters
[in]entrydata
[in]entry_namename

Definition at line 123 of file writer.h.

◆ writeCompound() [2/4]

template<typename t_Scalar , int t_rows, int t_cols, int t_flags>
void humoto::config::yaml::Writer::writeCompound ( const Eigen::Matrix< t_Scalar, t_rows, t_cols, t_flags > &  entry,
const std::string &  entry_name 
)
inline

Write a configuration entry (matrix)

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

Definition at line 156 of file writer.h.

◆ writeCompound() [3/4]

template<typename t_VectorEntryType >
void humoto::config::yaml::Writer::writeCompound ( const std::vector< std::vector< t_VectorEntryType > > &  entry,
const std::string &  entry_name 
) const
inline

Write configuration entry (std::vector<std::vector<std::string>>)

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

Definition at line 192 of file writer.h.

◆ writeCompound() [4/4]

template<typename t_VectorEntryType >
void humoto::config::yaml::Writer::writeCompound ( const std::vector< t_VectorEntryType > &  entry,
const std::string &  entry_name 
)
inline

Read configuration entry (std::vector)

Template Parameters
t_VectorEntryTypetype of the entry of std::vector
Parameters
[in]entrydata
[in]entry_namename

Definition at line 220 of file writer.h.

◆ writeEnum()

template<typename t_EnumType >
void humoto::config::yaml::Writer::writeEnum ( const t_EnumType  entry,
const std::string &  entry_name 
)
inline

Write a configuration entry (enum)

Template Parameters
t_EnumTypetype of the enum
Parameters
[in]entrydata
[in]entry_namename

Definition at line 245 of file writer.h.

◆ writeScalar()

template<typename t_EntryType >
void humoto::config::yaml::Writer::writeScalar ( const t_EntryType  entry,
const std::string &  entry_name 
)
inline

Write a configuration entry (scalar template)

Template Parameters
t_EntryTypetype of the entry
Parameters
[in]entry_namename
[in]entrydata

Definition at line 261 of file writer.h.

Member Data Documentation

◆ config_ofs_

std::ofstream humoto::config::yaml::Writer::config_ofs_
private

output file stream

Definition at line 26 of file writer.h.

◆ emitter_

YAML::Emitter* humoto::config::yaml::Writer::emitter_
private

instance of YAML emitter, is destroyed and reinitialized by flush()

Definition at line 29 of file writer.h.


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