pion::platform::VocabularyManager Class Reference

#include <VocabularyManager.hpp>

Inherits pion::platform::ConfigManager.

List of all members.


Detailed Description

VocabularyManager: maps URI identifiers to VocabularyConfig objects

Definition at line 42 of file VocabularyManager.hpp.

Public Member Functions

 VocabularyManager (void)
 constructs a new VocabularyManager instance
virtual ~VocabularyManager ()
 virtual destructor
virtual void createConfigFile (void)
 creates a new Vocabulary config file
virtual void openConfigFile (void)
 opens an existing Vocabulary config file and loads the data it contains
virtual void writeConfigXML (std::ostream &out) const
bool writeConfigXML (std::ostream &out, const std::string &vocab_id) const
bool writeTermConfigXML (std::ostream &out, const std::string &term_id) const
void writeTermConfigXML (std::ostream &out) const
void addVocabulary (const std::string &vocab_id, const std::string &vocab_name, const std::string &vocab_comment)
void addVocabulary (const std::string &vocab_id, const char *content_buf, std::size_t content_length)
void removeVocabulary (const std::string &vocab_id)
void setVocabularyPath (const std::string &vocab_path)
void setVocabularyConfig (const std::string &vocab_id, const xmlNodePtr config_ptr)
void setName (const std::string &vocab_id, const std::string &new_name)
void setComment (const std::string &vocab_id, const std::string &new_comment)
void setLocked (const std::string &vocab_id, bool locked_setting)
void addTerm (const std::string &vocab_id, const Vocabulary::Term &new_term)
void addTerm (const std::string &vocab_id, const std::string &term_id, const xmlNodePtr config_ptr)
void updateTerm (const std::string &vocab_id, const Vocabulary::Term &t)
void updateTerm (const std::string &vocab_id, const std::string &term_id, const xmlNodePtr config_ptr)
void removeTerm (const std::string &vocab_id, const std::string &term_id)
template<typename VocabularyUpdateFunction>
boost::signals::connection registerForUpdates (VocabularyUpdateFunction f) const
const std::string & getName (const std::string &vocab_id) const
const std::string & getComment (const std::string &vocab_id) const
bool hasVocabulary (const std::string &vocab_id) const
 returns true if a particular Vocabulary is defined
bool hasTerm (const std::string &term_id) const
 returns true if a particular Vocabulary Term is defined
VocabularyPtr getVocabulary (void) const
 returns a copy of the universal Vocabulary
std::string getVocabularyPath (void) const
 returns the path where new vocabulary config files are created
std::string getPermissionType (void) const
 returns the type attribute used for an XML Permission node pertaining to Vocabularies

Classes

class  AddVocabularyConfigException
 exception thrown if there is an error adding a Vocabulary to the config file More...
class  DuplicateVocabularyException
 exception thrown if you try loading a duplicate Vocabulary More...
class  EmptyVocabularyConfigException
 exception thrown if the config file contains an empty VocabularyConfig element More...
class  MissingVocabularyPathException
 exception thrown if the config file does not contain a VocabularyPath element More...
class  RemoveVocabularyConfigException
 exception thrown if there is an error removing a Vocabulary from the config file More...
class  UpdateVocabularyPathException
 exception thrown if there is an error updating the Vocabulary config file path More...
class  VocabularyNotFoundException
 exception thrown if you try referencing an unknown Vocabulary More...


Member Function Documentation

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

adds a new Term to a Vocabulary

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

Definition at line 256 of file VocabularyManager.hpp.

References pion::platform::VocabularyConfig::addTerm().

void pion::platform::VocabularyManager::addTerm ( const std::string &  vocab_id,
const Vocabulary::Term new_term 
) [inline]

adds a new Term to a Vocabulary

Parameters:
vocab_id the unique identifier for the Vocabulary to modify
new_term the new Term to define

Definition at line 241 of file VocabularyManager.hpp.

References pion::platform::VocabularyConfig::addTerm().

Referenced by pion::plugins::ConfigService::operator()().

void pion::platform::VocabularyManager::addVocabulary ( const std::string &  vocab_id,
const char *  content_buf,
std::size_t  content_length 
)

creates a new, empty vocabulary

Parameters:
vocab_id the unique identifier for the Vocabulary to create
content_buf pointer to buffer containing XML config for the Vocabulary
content_length size of the content buffer, in bytes

Definition at line 230 of file VocabularyManager.cpp.

References addVocabulary(), pion::platform::ConfigManager::COMMENT_ELEMENT_NAME, pion::platform::ConfigManager::createResourceConfig(), pion::platform::ConfigManager::getConfigOption(), pion::platform::VocabularyConfig::getVocabularyElementName(), and pion::platform::ConfigManager::NAME_ELEMENT_NAME.

void pion::platform::VocabularyManager::addVocabulary ( const std::string &  vocab_id,
const std::string &  vocab_name,
const std::string &  vocab_comment 
)

creates a new, empty vocabulary

Parameters:
vocab_id the unique identifier for the Vocabulary to create
vocab_name the descriptive name to assign to the Vocabulary
vocab_comment the descriptive comment to assign to the Vocabulary

Definition at line 179 of file VocabularyManager.cpp.

References pion::platform::ConfigManager::configIsOpen(), pion::platform::ConfigManager::createFilename(), pion::platform::ConfigManager::getConfigFile(), pion::platform::ConfigManager::ID_ATTRIBUTE_NAME, pion::platform::ConfigManager::m_config_node_ptr, pion::platform::ConfigManager::m_logger, and pion::platform::ConfigManager::saveConfigFile().

Referenced by addVocabulary(), and pion::plugins::ConfigService::operator()().

const std::string& pion::platform::VocabularyManager::getComment ( const std::string &  vocab_id  )  const [inline]

returns the descriptive comment assigned to a Vocabulary

Parameters:
vocab_id the unique identifier for the Vocabulary to search for
Returns:
const std::string& the comment assigned to the Vocabulary

Definition at line 338 of file VocabularyManager.hpp.

const std::string& pion::platform::VocabularyManager::getName ( const std::string &  vocab_id  )  const [inline]

returns the descriptive name assigned to a Vocabulary

Parameters:
vocab_id the unique identifier for the Vocabulary to search for
Returns:
const std::string& the descriptive name assigned to the Vocabulary

Definition at line 324 of file VocabularyManager.hpp.

template<typename VocabularyUpdateFunction>
boost::signals::connection pion::platform::VocabularyManager::registerForUpdates ( VocabularyUpdateFunction  f  )  const [inline]

registers a callback function to be executed whenever a Vocabulary is updated

Parameters:
f the callback function to register
Returns:
boost::signals::connection object representing the signal connection

Definition at line 313 of file VocabularyManager.hpp.

Referenced by pion::platform::PluginConfig< pion::platform::Protocol >::PluginConfig().

void pion::platform::VocabularyManager::removeTerm ( const std::string &  vocab_id,
const std::string &  term_id 
) [inline]

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

Parameters:
vocab_id the unique identifier for the Vocabulary to modify
term_id unique identifier for the Term to remove

Definition at line 299 of file VocabularyManager.hpp.

References pion::platform::VocabularyConfig::removeTerm().

Referenced by pion::plugins::ConfigService::operator()().

void pion::platform::VocabularyManager::removeVocabulary ( const std::string &  vocab_id  ) 

removes an existing vocabulary and deletes the associated config file

Parameters:
vocab_id the unique identifier for the Vocabulary to remove

Definition at line 252 of file VocabularyManager.cpp.

References pion::platform::ConfigManager::configIsOpen(), pion::platform::ConfigManager::findConfigNodeByAttr(), pion::platform::ConfigManager::getConfigFile(), pion::platform::ConfigManager::ID_ATTRIBUTE_NAME, pion::platform::ConfigManager::m_config_node_ptr, pion::platform::ConfigManager::m_logger, and pion::platform::ConfigManager::saveConfigFile().

Referenced by pion::plugins::ConfigService::operator()().

void pion::platform::VocabularyManager::setComment ( const std::string &  vocab_id,
const std::string &  new_comment 
) [inline]

changes the comment that describes a Vocabulary

Parameters:
vocab_id the unique identifier for the Vocabulary to modify
new_comment the new comment to assign to the Vocabulary

Definition at line 216 of file VocabularyManager.hpp.

References pion::platform::VocabularyConfig::setComment().

void pion::platform::VocabularyManager::setLocked ( const std::string &  vocab_id,
bool  locked_setting 
) [inline]

changes the locked setting for a Vocabulary

Parameters:
vocab_id the unique identifier for the Vocabulary to modify
locked_setting the new value to assign to the locked setting

Definition at line 229 of file VocabularyManager.hpp.

References pion::platform::VocabularyConfig::setLocked().

void pion::platform::VocabularyManager::setName ( const std::string &  vocab_id,
const std::string &  new_name 
) [inline]

changes the descriptive name assigned to a Vocabulary

Parameters:
vocab_id the unique identifier for the Vocabulary to modify
new_name the new descriptive name to assign to the Vocabulary

Definition at line 203 of file VocabularyManager.hpp.

References pion::platform::VocabularyConfig::setName().

void pion::platform::VocabularyManager::setVocabularyConfig ( const std::string &  vocab_id,
const xmlNodePtr  config_ptr 
) [inline]

sets configuration parameters for an existing vocabulary

Parameters:
vocab_id the unique identifier for the Vocabulary to update
config_ptr pointer to a list of XML nodes containing vocabulary configuration parameters

Definition at line 190 of file VocabularyManager.hpp.

References pion::platform::VocabularyConfig::setConfig().

Referenced by pion::plugins::ConfigService::operator()().

void pion::platform::VocabularyManager::setVocabularyPath ( const std::string &  vocab_path  ) 

sets the default path where new vocabulary config files will be created

Parameters:
vocab_path the new path where config files will be created

Definition at line 289 of file VocabularyManager.cpp.

References pion::platform::ConfigManager::configIsOpen(), pion::platform::ConfigManager::getConfigFile(), getVocabularyPath(), pion::platform::ConfigManager::m_config_node_ptr, pion::platform::ConfigManager::m_logger, pion::platform::ConfigManager::resolveRelativePath(), pion::platform::ConfigManager::saveConfigFile(), and pion::platform::ConfigManager::updateConfigOption().

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

update the settings for a Term

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

Definition at line 285 of file VocabularyManager.hpp.

References pion::platform::VocabularyConfig::updateTerm().

void pion::platform::VocabularyManager::updateTerm ( const std::string &  vocab_id,
const Vocabulary::Term t 
) [inline]

update the settings for a Term

Parameters:
vocab_id the unique identifier for the Vocabulary to modify
t the Term to update (t.term_id is used to find the Term to change)

Definition at line 270 of file VocabularyManager.hpp.

References pion::platform::VocabularyConfig::updateTerm().

Referenced by pion::plugins::ConfigService::operator()().

bool pion::platform::VocabularyManager::writeConfigXML ( std::ostream &  out,
const std::string &  vocab_id 
) const

writes the configuration data for a particular Vocabulary (as XML)

Parameters:
out the ostream to write the configuration tree into
vocab_id the unique identifier for the Vocabulary
Returns:
true if the Vocabulary was successfully found

Definition at line 135 of file VocabularyManager.cpp.

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

virtual void pion::platform::VocabularyManager::writeConfigXML ( std::ostream &  out  )  const [inline, virtual]

writes the entire configuration tree to an output stream (as XML)

Parameters:
out the ostream to write the configuration tree into

Reimplemented from pion::platform::ConfigManager.

Definition at line 114 of file VocabularyManager.hpp.

References pion::platform::ConfigManager::writeConfigXML(), and pion::platform::ConfigManager::writeConfigXMLHeader().

Referenced by pion::plugins::ConfigService::operator()().

void pion::platform::VocabularyManager::writeTermConfigXML ( std::ostream &  out  )  const

writes configuration info for all Terms to an output stream (as XML)

Parameters:
out the ostream to write the Term configuration info into

Definition at line 167 of file VocabularyManager.cpp.

References pion::platform::Vocabulary::size(), pion::platform::Vocabulary::UNDEFINED_TERM_REF, pion::platform::ConfigManager::writeBeginPionConfigXML(), pion::platform::ConfigManager::writeEndPionConfigXML(), and pion::platform::VocabularyConfig::writeTermConfigXML().

bool pion::platform::VocabularyManager::writeTermConfigXML ( std::ostream &  out,
const std::string &  term_id 
) const

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

Parameters:
out the ostream to write the Term configuration info into
term_id include only the Term that matches this unique identifier, or include all Terms if it is empty
Returns:
true if the Term was successfully found

Definition at line 151 of file VocabularyManager.cpp.

References pion::platform::Vocabulary::findTerm(), pion::platform::Vocabulary::UNDEFINED_TERM_REF, pion::platform::ConfigManager::writeBeginPionConfigXML(), pion::platform::ConfigManager::writeEndPionConfigXML(), and pion::platform::VocabularyConfig::writeTermConfigXML().

Referenced by pion::plugins::ConfigService::operator()().


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