#include <cfg_yaml.h>
Public Member Functions | |
YAML (const string &) | |
~YAML (void) | |
void | load_entry (const string &) |
Load/cache the sequence for the relevant entry from the YAML file. | |
Private Member Functions | |
SYMID | import_node (SyckNode *) |
And these do the meat of the work from the above wrappers. | |
void | load_from_map (SYMID) |
Load the data from the relevant map. | |
Static Private Member Functions | |
static SYMID | node_handler (SyckParser *, SyckNode *) |
static void | error_handler (SyckParser *, char *) |
static SyckNode * | bad_anchor_handler (SyckParser *, char *) |
Private Attributes | |
pthread_mutex_t | mutex |
Mutex to protect the parser. | |
std::string | intended |
SyckParser * | parser |
FILE * | filep |
FILE* used by the Syck parser. | |
std::map< SYMID, string > | scalars |
Table of inner attributes. | |
std::map< SYMID, SyckNode * > | maps |
SYMIDs of saved maps. | |
SYMID | index |
Static Private Attributes | |
static YAML * | instance = NULL |
This class is intended to support YAML configuration files. In theory, multiple implementations of YAML parsers could be used, but the only one supported at the moment is Syck (aka libsyck). More information about Sync can be found at http://whytheluckystiff.net/syck/
Definition at line 65 of file cfg_yaml.h.
YAML::YAML | ( | const string & | filename | ) |
Definition at line 74 of file cfg_yaml.cc.
References bad_anchor_handler(), error_handler(), filep, instance, mutex, node_handler(), parser, and PTHREAD_CHECK_AND_THROW.
YAML::~YAML | ( | void | ) |
void YAML::load_entry | ( | const string & | name | ) | [virtual] |
Load/cache the sequence for the relevant entry from the YAML file.
Implements Config.
Definition at line 156 of file cfg_yaml.cc.
References Config::config_keys, intended, mutex, parser, and PTHREAD_CHECK_AND_THROW.
SYMID YAML::node_handler | ( | SyckParser * | p, | |
SyckNode * | n | |||
) | [static, private] |
These functions are static so they can be passed into the Syck library as function pointers.
Definition at line 198 of file cfg_yaml.cc.
References import_node().
Referenced by YAML().
void YAML::error_handler | ( | SyckParser * | p, | |
char * | str | |||
) | [static, private] |
Definition at line 204 of file cfg_yaml.cc.
Referenced by YAML().
SyckNode * YAML::bad_anchor_handler | ( | SyckParser * | p, | |
char * | anchor | |||
) | [static, private] |
Definition at line 210 of file cfg_yaml.cc.
Referenced by YAML().
SYMID YAML::import_node | ( | SyckNode * | n | ) | [private] |
And these do the meat of the work from the above wrappers.
Definition at line 221 of file cfg_yaml.cc.
References index, intended, load_from_map(), maps, and scalars.
Referenced by node_handler().
void YAML::load_from_map | ( | SYMID | mapid | ) | [private] |
Load the data from the relevant map.
Definition at line 302 of file cfg_yaml.cc.
Referenced by import_node().
pthread_mutex_t YAML::mutex [private] |
Mutex to protect the parser.
Definition at line 74 of file cfg_yaml.h.
Referenced by load_entry(), YAML(), and ~YAML().
YAML * YAML::instance = NULL [static, private] |
A static object, so that only one YAML object can ever be instantiated. Initialized to NULL if no object is constructed.
Definition at line 78 of file cfg_yaml.h.
Referenced by YAML().
std::string YAML::intended [private] |
The intended configuration element. Effectively, a cache of the argument to load_entry().
Definition at line 82 of file cfg_yaml.h.
Referenced by import_node(), and load_entry().
SyckParser* YAML::parser [private] |
FILE* YAML::filep [private] |
std::map<SYMID,string> YAML::scalars [private] |
Table of inner attributes.
Definition at line 86 of file cfg_yaml.h.
Referenced by import_node(), and load_from_map().
std::map<SYMID,SyckNode*> YAML::maps [private] |
SYMIDs of saved maps.
Definition at line 87 of file cfg_yaml.h.
Referenced by import_node(), and load_from_map().
SYMID YAML::index [private] |