YAML Class Reference
[Configuration-related objects]

A configuration system for YAML configuration files. More...

#include <cfg_yaml.h>

Inheritance diagram for YAML:

Inheritance graph
[legend]
Collaboration diagram for YAML:

Collaboration graph
[legend]

List of all members.

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 YAMLinstance = NULL


Detailed Description

A configuration system for YAML configuration files.

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/

See also:
ConfigFactory
Syck provides a somewhat delicate parser, and it's not at all thread-safe. So, implement YAML as a singleton, just to attempt to guarantee that there won't be more than one syck parser existing at a time.

Definition at line 65 of file cfg_yaml.h.


Constructor & Destructor Documentation

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.

Here is the call graph for this function:

YAML::~YAML ( void   ) 

Definition at line 130 of file cfg_yaml.cc.

References mutex, parser, and PTHREAD_CHECK_AND_THROW.


Member Function Documentation

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().

Here is the call graph for this function:

Here is the caller graph for this function:

void YAML::error_handler ( SyckParser *  p,
char *  str 
) [static, private]

Definition at line 204 of file cfg_yaml.cc.

Referenced by YAML().

Here is the caller graph for this function:

SyckNode * YAML::bad_anchor_handler ( SyckParser *  p,
char *  anchor 
) [static, private]

Definition at line 210 of file cfg_yaml.cc.

Referenced by YAML().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

void YAML::load_from_map ( SYMID  mapid  )  [private]

Load the data from the relevant map.

Definition at line 302 of file cfg_yaml.cc.

References maps, and scalars.

Referenced by import_node().

Here is the caller graph for this function:


Member Data Documentation

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]

Definition at line 84 of file cfg_yaml.h.

Referenced by load_entry(), YAML(), and ~YAML().

FILE* YAML::filep [private]

FILE* used by the Syck parser.

Definition at line 85 of file cfg_yaml.h.

Referenced by YAML().

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]

Definition at line 88 of file cfg_yaml.h.

Referenced by import_node().


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

Generated on Tue May 13 11:32:51 2008 for consmgr by  doxygen 1.5.5