tue_config
Classes | Typedefs | Enumerations | Functions | Variables
tue::config Namespace Reference

Classes

class  BinaryReader
 
class  BinaryWriter
 
class  Data
 
class  DataConstPointer
 
class  DataPointer
 
struct  Error
 
class  Map
 
class  Node
 
class  ParseException
 
class  Reader
 
class  ReaderWriter
 
class  ResolveConfig
 Class to config the resolve behaviour of a loader. More...
 
class  Sequence
 
class  Variant
 
class  Writer
 
struct  WriterImpl
 
class  YAMLEmitter
 

Typedefs

typedef boost::shared_ptr< const NodeNodeConstPtr
 
typedef unsigned int NodeIdx
 
typedef boost::shared_ptr< NodeNodePtr
 

Enumerations

enum  NodeType { MAP, ARRAY }
 
enum  RequiredOrOptional { REQUIRED, OPTIONAL }
 
enum  resolveResult { failed, success, skipped }
 
enum  WriteType { XML, YAML, JSON }
 

Functions

void argsToString (const std::vector< std::string > &args, std::string &output)
 
void data_merge (Data &c1, NodeIdx me_idx, const Data &c2, NodeIdx other_idx, std::string &error)
 
void emitRecursive (std::ostream &out, const tue::config::Data &cfg, const NodePtr &n, const std::string &indent, bool ignore_first_indent=false)
 
resolveResult executeResolvefunction (const std::vector< std::string > &args, const std::string &source, std::string &result, std::stringstream &error, const ResolveConfig &config)
 
DataPointer fromFile (const char *filename, const ResolveConfig &resolve_config=ResolveConfig::defaultConfig())
 
DataPointer fromFile (const std::string &filename, const ResolveConfig &resolve_config=ResolveConfig::defaultConfig())
 
DataPointer fromStream (std::istream &s, const ResolveConfig &resolve_config=ResolveConfig::defaultConfig())
 
DataPointer fromString (const std::string &s, const ResolveConfig &resolve_config=ResolveConfig::defaultConfig())
 
tue::config::NodeType getSDFNodeType (const std::string &element_name)
 
bool loadFromSDFDocument (const tinyxml2::XMLDocument &doc, ReaderWriter &config)
 
bool loadFromSDFElement (const tinyxml2::XMLElement &element, ReaderWriter &config, const NodeType node_type)
 
bool loadFromSDFFile (const std::string &filename, ReaderWriter &config)
 loadFromSDFFile loads a sdf file into a ReaderWriter class More...
 
bool loadFromSDFStream (std::istream &stream, ReaderWriter &config)
 loadFromSDFStream loads a sdf stream into a ReaderWriter class More...
 
bool loadFromSDFString (const std::string &string, ReaderWriter &config)
 loadFromSDFString loads a sdf string into a ReaderWriter class More...
 
bool loadFromXMLDocument (const tinyxml2::XMLDocument &doc, ReaderWriter &config)
 
bool loadFromXMLElement (const tinyxml2::XMLElement &element, ReaderWriter &config)
 
bool loadFromXMLFile (const std::string &filename, ReaderWriter &config)
 loadFromXMLFile loads a xml file into a ReaderWriter class More...
 
bool loadFromXMLStream (std::istream &stream, ReaderWriter &config)
 loadFromXMLStream loads a xml stream into a ReaderWriter class More...
 
bool loadFromXMLString (const std::string &string, ReaderWriter &config)
 loadFromXMLString loads a xml string into a ReaderWriter class More...
 
bool loadFromXMLText (const tinyxml2::XMLElement &element, ReaderWriter &config)
 loadFromXMLText writes a value from xml element into config object. Stored as double, int or string More...
 
bool loadFromYAMLFile (const std::string &filename, ReaderWriter &config, const ResolveConfig &resolve_config=ResolveConfig::defaultConfig())
 loadFromYAMLFile loads a yaml file into a ReaderWriter class More...
 
bool loadFromYAMLNode (const YAML::Node &node, ReaderWriter &config, const ResolveConfig &resolve_config)
 
bool loadFromYAMLStream (std::istream &stream, ReaderWriter &config, const ResolveConfig &resolve_config=ResolveConfig::defaultConfig())
 loadFromYAMLStream loads a yaml stream into a ReaderWriter class More...
 
bool loadFromYAMLString (const std::string &string, ReaderWriter &config, const ResolveConfig &resolve_config=ResolveConfig::defaultConfig())
 loadFromYAMLString loads a yaml string into a ReaderWriter class More...
 
std::ostreamoperator<< (std::ostream &out, const DataConstPointer &d)
 
std::ostreamoperator<< (std::ostream &out, const DataPointer &d)
 
std::ostreamoperator<< (std::ostream &out, const ReaderWriter &rw)
 
resolveResult parseResolveFunction (const std::string &str, const std::string &source, std::size_t &i, std::string &result, std::stringstream &error, const ResolveConfig &config)
 
bool resolve (const std::string &str, const std::string &source, std::string &result, std::stringstream &error, const ResolveConfig &config)
 
bool setValue (const std::string &key, const std::string &value, ReaderWriter &config)
 setValue sets the value as a double, int or string More...
 
bool strToBool (std::string s, bool &rhs)
 strToBool Converts a string to a boolean of matches one of the following: y, n, yes, no, true, false, on, off More...
 
bool toFile (const char *filename, const DataConstPointer &data, WriteType write_type, int indent_size=0)
 
bool toFile (const std::string &filename, const DataConstPointer &data, WriteType write_type, int indent_size=0)
 
void toStream (std::ostream &s, const DataConstPointer &data, WriteType write_type, int indent_size=0)
 
bool yamlScalarToVariant (const std::string &key, const YAML::Node &n, ReaderWriter &config, const ResolveConfig &resolve_config)
 

Variables

static const std::set< std::stringSDF_ARRAY_SET
 
static const std::set< std::stringSDF_MAP_SET
 
static const std::set< std::stringSDF_VALUE_SET
 

Typedef Documentation

◆ NodeConstPtr

typedef boost::shared_ptr<const Node> tue::config::NodeConstPtr

Definition at line 23 of file types.h.

◆ NodeIdx

typedef unsigned int tue::config::NodeIdx

Definition at line 12 of file data_pointer.h.

◆ NodePtr

typedef boost::shared_ptr<Node> tue::config::NodePtr

Definition at line 21 of file types.h.

Enumeration Type Documentation

◆ NodeType

Enumerator
MAP 
ARRAY 

Definition at line 10 of file node_type.h.

◆ RequiredOrOptional

Enumerator
REQUIRED 
OPTIONAL 

Definition at line 15 of file types.h.

◆ resolveResult

Enumerator
failed 
success 
skipped 

Definition at line 18 of file resolve_functions.cpp.

◆ WriteType

Enumerator
XML 
YAML 
JSON 

Definition at line 12 of file write.h.

Function Documentation

◆ argsToString()

void tue::config::argsToString ( const std::vector< std::string > &  args,
std::string output 
)

Definition at line 27 of file resolve_functions.cpp.

◆ data_merge()

void tue::config::data_merge ( Data c1,
NodeIdx  me_idx,
const Data c2,
NodeIdx  other_idx,
std::string error 
)

Definition at line 16 of file data_pointer.cpp.

◆ emitRecursive()

void tue::config::emitRecursive ( std::ostream out,
const tue::config::Data cfg,
const NodePtr n,
const std::string indent,
bool  ignore_first_indent = false 
)

Definition at line 21 of file yaml_emitter.cpp.

◆ executeResolvefunction()

resolveResult tue::config::executeResolvefunction ( const std::vector< std::string > &  args,
const std::string source,
std::string result,
std::stringstream error,
const ResolveConfig config 
)

Definition at line 41 of file resolve_functions.cpp.

◆ fromFile() [1/2]

DataPointer tue::config::fromFile ( const char *  filename,
const ResolveConfig resolve_config = ResolveConfig::defaultConfig() 
)

Definition at line 49 of file read.cpp.

◆ fromFile() [2/2]

DataPointer tue::config::fromFile ( const std::string filename,
const ResolveConfig resolve_config = ResolveConfig::defaultConfig() 
)

Definition at line 38 of file read.cpp.

◆ fromStream()

DataPointer tue::config::fromStream ( std::istream s,
const ResolveConfig resolve_config = ResolveConfig::defaultConfig() 
)

Definition at line 25 of file read.cpp.

◆ fromString()

DataPointer tue::config::fromString ( const std::string s,
const ResolveConfig resolve_config = ResolveConfig::defaultConfig() 
)

Definition at line 14 of file read.cpp.

◆ getSDFNodeType()

tue::config::NodeType tue::config::getSDFNodeType ( const std::string element_name)

Definition at line 41 of file sdf.cpp.

◆ loadFromSDFDocument()

bool tue::config::loadFromSDFDocument ( const tinyxml2::XMLDocument &  doc,
ReaderWriter config 
)

Definition at line 138 of file sdf.cpp.

◆ loadFromSDFElement()

bool tue::config::loadFromSDFElement ( const tinyxml2::XMLElement &  element,
ReaderWriter config,
const NodeType  node_type 
)

Definition at line 63 of file sdf.cpp.

◆ loadFromSDFFile()

bool tue::config::loadFromSDFFile ( const std::string filename,
ReaderWriter config 
)

loadFromSDFFile loads a sdf file into a ReaderWriter class

Parameters
filenameinput file
configobject in which the data is stored
Returns
indicates success

Definition at line 188 of file sdf.cpp.

◆ loadFromSDFStream()

bool tue::config::loadFromSDFStream ( std::istream stream,
ReaderWriter config 
)

loadFromSDFStream loads a sdf stream into a ReaderWriter class

Parameters
streaminput stream
configobject in which the data is stored
Returns
indicates success

Definition at line 152 of file sdf.cpp.

◆ loadFromSDFString()

bool tue::config::loadFromSDFString ( const std::string string,
ReaderWriter config 
)

loadFromSDFString loads a sdf string into a ReaderWriter class

Parameters
stringinput string (sdf)
configobject in which the data is stored
Returns
indicates success

Definition at line 171 of file sdf.cpp.

◆ loadFromXMLDocument()

bool tue::config::loadFromXMLDocument ( const tinyxml2::XMLDocument &  doc,
ReaderWriter config 
)

Definition at line 109 of file xml.cpp.

◆ loadFromXMLElement()

bool tue::config::loadFromXMLElement ( const tinyxml2::XMLElement &  element,
ReaderWriter config 
)

Definition at line 62 of file xml.cpp.

◆ loadFromXMLFile()

bool tue::config::loadFromXMLFile ( const std::string filename,
ReaderWriter config 
)

loadFromXMLFile loads a xml file into a ReaderWriter class

Parameters
filenameinput file
configobject in which the data is stored
Returns
indicates success

Definition at line 159 of file xml.cpp.

◆ loadFromXMLStream()

bool tue::config::loadFromXMLStream ( std::istream stream,
ReaderWriter config 
)

loadFromXMLStream loads a xml stream into a ReaderWriter class

Parameters
streaminput stream
configobject in which the data is stored
Returns
indicates success

Definition at line 123 of file xml.cpp.

◆ loadFromXMLString()

bool tue::config::loadFromXMLString ( const std::string string,
ReaderWriter config 
)

loadFromXMLString loads a xml string into a ReaderWriter class

Parameters
stringinput string (xml)
configobject in which the data is stored
Returns
indicates success

Definition at line 142 of file xml.cpp.

◆ loadFromXMLText()

bool tue::config::loadFromXMLText ( const tinyxml2::XMLElement &  element,
ReaderWriter config 
)

loadFromXMLText writes a value from xml element into config object. Stored as double, int or string

Parameters
elementTinyXML2 element
configobject in which the data is stored
Returns
indicates succes

Definition at line 48 of file xml.cpp.

◆ loadFromYAMLFile()

bool tue::config::loadFromYAMLFile ( const std::string filename,
ReaderWriter config,
const ResolveConfig resolve_config = ResolveConfig::defaultConfig() 
)

loadFromYAMLFile loads a yaml file into a ReaderWriter class

Parameters
filenameinput file
configobject in which the data is stored
Returns
indicates success

Definition at line 185 of file yaml.cpp.

◆ loadFromYAMLNode()

bool tue::config::loadFromYAMLNode ( const YAML::Node &  node,
ReaderWriter config,
const ResolveConfig resolve_config 
)

Definition at line 89 of file yaml.cpp.

◆ loadFromYAMLStream()

bool tue::config::loadFromYAMLStream ( std::istream stream,
ReaderWriter config,
const ResolveConfig resolve_config = ResolveConfig::defaultConfig() 
)

loadFromYAMLStream loads a yaml stream into a ReaderWriter class

Parameters
streaminput stream
configobject in which the data is stored
Returns
indicates success

Definition at line 149 of file yaml.cpp.

◆ loadFromYAMLString()

bool tue::config::loadFromYAMLString ( const std::string string,
ReaderWriter config,
const ResolveConfig resolve_config = ResolveConfig::defaultConfig() 
)

loadFromYAMLString loads a yaml string into a ReaderWriter class

Parameters
stringinput string (yaml)
configobject in which the data is stored
Returns
indicates success

Definition at line 176 of file yaml.cpp.

◆ operator<<() [1/3]

std::ostream& tue::config::operator<< ( std::ostream out,
const DataConstPointer d 
)

Definition at line 128 of file data_pointer.cpp.

◆ operator<<() [2/3]

std::ostream& tue::config::operator<< ( std::ostream out,
const DataPointer d 
)

Definition at line 137 of file data_pointer.cpp.

◆ operator<<() [3/3]

std::ostream& tue::config::operator<< ( std::ostream out,
const ReaderWriter rw 
)
Parameters
out
rwReaderWriter object
Returns

Definition at line 361 of file reader_writer.cpp.

◆ parseResolveFunction()

resolveResult tue::config::parseResolveFunction ( const std::string str,
const std::string source,
std::size_t i,
std::string result,
std::stringstream error,
const ResolveConfig config 
)

Definition at line 108 of file resolve_functions.cpp.

◆ resolve()

bool tue::config::resolve ( const std::string str,
const std::string source,
std::string result,
std::stringstream error,
const ResolveConfig config 
)

Definition at line 185 of file resolve_functions.cpp.

◆ setValue()

bool tue::config::setValue ( const std::string key,
const std::string value,
ReaderWriter config 
)

setValue sets the value as a double, int or string

Parameters
keyname of the node
valuevalue of the node
configReaderWriter object to add it to
Returns
indicates succes

Definition at line 18 of file xml.cpp.

◆ strToBool()

bool tue::config::strToBool ( std::string  s,
bool &  rhs 
)

strToBool Converts a string to a boolean of matches one of the following: y, n, yes, no, true, false, on, off

Parameters
sstring to convert
rhsbool to set to true or false
Returns
indicates succes, rhs should only be used if return is true.

Definition at line 10 of file loader_functions.cpp.

◆ toFile() [1/2]

bool tue::config::toFile ( const char *  filename,
const DataConstPointer data,
WriteType  write_type,
int  indent_size = 0 
)

Definition at line 207 of file write.cpp.

◆ toFile() [2/2]

bool tue::config::toFile ( const std::string filename,
const DataConstPointer data,
WriteType  write_type,
int  indent_size = 0 
)

Definition at line 200 of file write.cpp.

◆ toStream()

void tue::config::toStream ( std::ostream s,
const DataConstPointer data,
WriteType  write_type,
int  indent_size = 0 
)

Definition at line 169 of file write.cpp.

◆ yamlScalarToVariant()

bool tue::config::yamlScalarToVariant ( const std::string key,
const YAML::Node &  n,
ReaderWriter config,
const ResolveConfig resolve_config 
)

Definition at line 25 of file yaml.cpp.

Variable Documentation

◆ SDF_ARRAY_SET

const std::set<std::string> tue::config::SDF_ARRAY_SET
static
Initial value:
{"collision", "include", "joint", "link", "model", "point", "visual",
"virtual_volume"}

Definition at line 22 of file sdf.cpp.

◆ SDF_MAP_SET

const std::set<std::string> tue::config::SDF_MAP_SET
static
Initial value:
{"atmosphere", "audio", "blend", "box", "camera", "cylinder", "geometry",
"gripper", "gui", "heightmap", "image", "mesh", "plane", "plugin",
"polyline", "pose", "sdf", "sphere", "texture", "track_visual", "wind",
"world" }

Definition at line 26 of file sdf.cpp.

◆ SDF_VALUE_SET

const std::set<std::string> tue::config::SDF_VALUE_SET
static
Initial value:
{"device", "diffuse", "empty", "fade_dist", "filename", "fullscreen",
"gravity", "height", "inherit_yaw", "length", "linear_velocity",
"magnetic_field", "max_dist", "min_dist", "min_height", "name",
"normal", "pos", "pose", "pressure", "projection_type", "radius",
"sampling", "size", "static", "temperature", "temperature_gradient",
"type", "uri", "use_model_frame", "view_controller", "xyz" }

Definition at line 31 of file sdf.cpp.