pion::platform::VocabularyConfig Class Reference

#include <VocabularyConfig.hpp>

Inherits pion::platform::ConfigManager.

List of all members.


Detailed Description

VocabularyConfig: manages Vocabulary configuration & XML config files

Definition at line 41 of file VocabularyConfig.hpp.

Public Member Functions

 VocabularyConfig (void)
 constructs a new VocabularyConfig instance
virtual ~VocabularyConfig ()
 virtual destructor
virtual void createConfigFile (void)
 creates a new Vocabulary config file that includes the Pion "config" and "vocabulary" elements
virtual void openConfigFile (void)
 opens an existing Vocabulary config file and loads the data it contains
void setId (const std::string &new_id)
 sets the URI used to uniquely identify this Vocabulary
void setName (const std::string &new_name)
 sets the descriptive name assigned to this Vocabulary
void setComment (const std::string &new_comment)
 sets the comment that describes this Vocabulary
void setLocked (bool b)
 sets the locked boolean for this Vocabulary
void setConfig (const xmlNodePtr config_ptr)
 sets the general configuration for this Vocabulary
void addTerm (const Vocabulary::Term &new_term)
void addTerm (const std::string &term_id, const xmlNodePtr config_ptr)
void updateTerm (const Vocabulary::Term &t)
void updateTerm (const std::string &term_id, const xmlNodePtr config_ptr)
void removeTerm (const std::string &term_id)
void bind (Vocabulary &v)
const std::string & getId (void) const
 returns the URI used to uniquely identify this Vocabulary
const std::string & getName (void) const
 returns the descriptive name assigned to this Vocabulary
const std::string & getComment (void) const
 returns the comment that describes this Vocabulary
bool getLocked (void) const
 returns true if the Vocabulary is currently locked; false if it is not
const VocabularygetVocabulary (void) const
 returns a reference to the local Vocabulary configuration

Static Public Member Functions

static const std::string & getVocabularyElementName (void)
 returns the vocabulary (root) XML element name
static xmlNodePtr createVocabularyConfig (const char *buf, std::size_t len)
static xmlNodePtr createTermConfig (const char *buf, std::size_t len)
static void writeTermConfigXML (std::ostream &out, const Vocabulary::Term &t)
static void parseTermConfig (Vocabulary::Term &new_term, const xmlNodePtr config_ptr)

Classes

class  AddTermConfigException
 exception thrown if there is an error adding a term element to the config file More...
class  EmptyTypeException
 exception thrown if the config file contains an empty data type definition More...
class  EmptyVocabularyIdException
 exception thrown if the config file contains a vocabulary element with an empty or missing identifier More...
class  InitializeConfigException
 exception thrown if there is an error initializing a Vocabulary config file More...
class  MissingVocabularyException
 exception thrown if the config file does not contain a vocabulary element More...
class  RemoveTermConfigException
 exception thrown if there is an error removing a Term from the config file More...
class  UpdateTermConfigException
 exception thrown if there is an error updating a Term in the config file More...
class  UpdateVocabularyException
 exception thrown if an error occurs when trying to update Vocabulary configuration options More...
class  VocabularyIsLockedException
 exception thrown if the config file does not contain a vocabulary element More...


Member Function Documentation

void pion::platform::VocabularyConfig::addTerm ( const std::string &  term_id,
const xmlNodePtr  config_ptr 
) [inline]

adds a new Term to the Vocabulary

Parameters:
term_id unique identifier for the Term to add
config_ptr pointer to a list of XML nodes containing term configuration parameters

Definition at line 151 of file VocabularyConfig.hpp.

void pion::platform::VocabularyConfig::addTerm ( const Vocabulary::Term new_term  ) 

adds a new Term to the Vocabulary

Parameters:
new_term the new Term to define

Definition at line 269 of file VocabularyConfig.cpp.

References pion::platform::Vocabulary::addTerm(), pion::platform::ConfigManager::COMMENT_ELEMENT_NAME, pion::platform::ConfigManager::getConfigFile(), getId(), pion::platform::ConfigManager::ID_ATTRIBUTE_NAME, pion::platform::ConfigManager::m_logger, pion::platform::ConfigManager::saveConfigFile(), pion::platform::Vocabulary::Term::term_comment, and pion::platform::Vocabulary::Term::term_id.

Referenced by pion::platform::VocabularyManager::addTerm().

void pion::platform::VocabularyConfig::bind ( Vocabulary v  )  [inline]

binds a Vocabulary to this configuration manager and copies over terms

Parameters:
v the Vocabulary object to bind

Definition at line 189 of file VocabularyConfig.hpp.

References pion::platform::Vocabulary::addTerm(), pion::platform::Vocabulary::removeTerm(), and pion::platform::Vocabulary::updateTerm().

static xmlNodePtr pion::platform::VocabularyConfig::createTermConfig ( const char *  buf,
std::size_t  len 
) [inline, static]

uses a memory buffer to generate XML configuration data for a Vocabulary Term

Parameters:
buf pointer to a memory buffer containing configuration data
len number of bytes available in the memory buffer
Returns:
xmlNodePtr XML configuration list for the Vocabulary Term

Definition at line 236 of file VocabularyConfig.hpp.

References pion::platform::ConfigManager::createResourceConfig().

static xmlNodePtr pion::platform::VocabularyConfig::createVocabularyConfig ( const char *  buf,
std::size_t  len 
) [inline, static]

uses a memory buffer to generate XML configuration data for a Vocabulary

Parameters:
buf pointer to a memory buffer containing configuration data
len number of bytes available in the memory buffer
Returns:
xmlNodePtr XML configuration list for the Vocabulary

Definition at line 224 of file VocabularyConfig.hpp.

References pion::platform::ConfigManager::createResourceConfig().

void pion::platform::VocabularyConfig::parseTermConfig ( Vocabulary::Term new_term,
const xmlNodePtr  config_ptr 
) [static]

parses Term configuration information from an XML tree

Parameters:
new_term this Term will be updated with the XML configuration info
config_ptr pointer to a list of XML nodes containing term configuration parameters

Definition at line 473 of file VocabularyConfig.cpp.

References pion::platform::ConfigManager::COMMENT_ELEMENT_NAME, pion::platform::ConfigManager::findConfigNodeByName(), pion::platform::ConfigManager::getConfigOption(), pion::platform::Vocabulary::parseDataType(), pion::platform::Vocabulary::Term::term_comment, pion::platform::Vocabulary::Term::term_format, pion::platform::Vocabulary::Term::term_id, pion::platform::Vocabulary::Term::term_size, pion::platform::Vocabulary::Term::term_type, pion::platform::Vocabulary::TYPE_CHAR, and pion::platform::Vocabulary::TYPE_NULL.

Referenced by openConfigFile().

void pion::platform::VocabularyConfig::removeTerm ( const std::string &  term_id  ) 

removes a Term from the Vocabulary (use with caution!!!)

Parameters:
term_id unique identifier for the Term to remove

Definition at line 418 of file VocabularyConfig.cpp.

References pion::platform::ConfigManager::findConfigNodeByAttr(), pion::platform::ConfigManager::getConfigFile(), getId(), pion::platform::ConfigManager::ID_ATTRIBUTE_NAME, pion::platform::ConfigManager::m_logger, pion::platform::Vocabulary::removeTerm(), and pion::platform::ConfigManager::saveConfigFile().

Referenced by pion::platform::VocabularyManager::removeTerm().

void pion::platform::VocabularyConfig::updateTerm ( const std::string &  term_id,
const xmlNodePtr  config_ptr 
) [inline]

update the settings for a Term

Parameters:
term_id unique identifier for the Term to modify
config_ptr pointer to a list of XML nodes containing term configuration parameters

Definition at line 171 of file VocabularyConfig.hpp.

void pion::platform::VocabularyConfig::updateTerm ( const Vocabulary::Term t  ) 

update the settings for a Term

Parameters:
t the Term to update (t.term_id is used to find the Term to change)

Definition at line 316 of file VocabularyConfig.cpp.

References pion::platform::ConfigManager::COMMENT_ELEMENT_NAME, pion::platform::ConfigManager::findConfigNodeByAttr(), pion::platform::ConfigManager::findConfigNodeByName(), pion::platform::ConfigManager::getConfigFile(), pion::platform::Vocabulary::getDataTypeAsString(), getId(), pion::platform::ConfigManager::ID_ATTRIBUTE_NAME, pion::platform::ConfigManager::m_logger, pion::platform::ConfigManager::saveConfigFile(), pion::platform::Vocabulary::Term::term_comment, pion::platform::Vocabulary::Term::term_format, pion::platform::Vocabulary::Term::term_id, pion::platform::Vocabulary::Term::term_size, pion::platform::Vocabulary::Term::term_type, pion::platform::Vocabulary::TYPE_NULL, pion::platform::Vocabulary::updateTerm(), and pion::platform::ConfigManager::xml_encode().

Referenced by pion::platform::VocabularyManager::updateTerm().

void pion::platform::VocabularyConfig::writeTermConfigXML ( std::ostream &  out,
const Vocabulary::Term t 
) [static]

writes Term configuration info to an output stream (as XML)

Parameters:
out the ostream to write the Term configuration info into
t the term to use for configuration information

Definition at line 447 of file VocabularyConfig.cpp.

References pion::platform::ConfigManager::COMMENT_ELEMENT_NAME, pion::platform::Vocabulary::getDataTypeAsString(), pion::platform::ConfigManager::ID_ATTRIBUTE_NAME, pion::platform::Vocabulary::Term::term_comment, pion::platform::Vocabulary::Term::term_format, pion::platform::Vocabulary::Term::term_id, pion::platform::Vocabulary::Term::term_size, pion::platform::Vocabulary::Term::term_type, pion::platform::Vocabulary::TYPE_CHAR, and pion::platform::ConfigManager::xml_encode().

Referenced by pion::platform::VocabularyManager::writeTermConfigXML().


The documentation for this class was generated from the following files:
Generated on Wed Apr 13 16:38:36 2011 for pion-platform by  doxygen 1.4.7