Class xml_config_repository
Defined in File xml_config_repository.hpp
Inheritance Relationships
Base Type
public rcppsw::er::client< xml_config_repository >
(Template Class client)
Class Documentation
-
class xml_config_repository : public rcppsw::er::client<xml_config_repository>
A repository for multiple xml_config_parser objects and their parsed results; allows collective operations on multiple parsers.
Utilizes factory pattern for parser creation. Does not create any parsers on its own (how could it know which ones to create?). All created parsers must derive from xml_config_parser, and have a constructor with the same signature as the constructor for that class available, or cryptic compile errors will result.
Public Functions
-
inline xml_config_repository(void)
-
template<typename T>
inline const T *config_get(const std::string &name) const Get the parsed configuration associated with the parser of the specified name.
- Returns:
The parsed configuration (non-owning).
-
template<typename T>
inline const T *config_get(void) const Get the parsed configuration associated with the parser of the specified type (note that the name that the parser was registered with is not needed in this formulation).
- Returns:
The parsed configuration (non-owning), or NULL if an invalid type of configuration was requested.
-
void parse_all(const ticpp::Element &node)
Call the xml_config_parser::parse() function on all parsers in the repository, passing all parsers the same XML node.
-
template<typename T>
inline T *parser_find(const std::string &name) Get a registered parser by name (non-owning).
- Parameters:
name – The name of the parser.
- Returns:
Non-owning pointer to the requested parser, or NULL if no such parser was registered.
-
template<typename T, typename S>
inline void parser_register(const std::string &name) Register a parser of a given type (must be derived from xml_config_parser) and associate it with the specified name.
- Template Parameters:
T – The parser type.
S – The type of the configuration that the parser produces when parse() is called on it.
-
template<typename T>
inline void parser_register(const std::string &name) Register a parser of a given type (must be derived from xml_config_parser) and associate it with the specified name.
If you use this function, then you will have to refer to the parse results by type + name, rather than just by type.
- Template Parameters:
T – The parser type.
-
template<typename T, typename S>
inline void parser_unregister(const std::string &name) Register a parser of a given type (must be derived from xml_config_parser) and associate it with the specified name.
- Template Parameters:
T – The parser type.
S – The type of the configuration that the parser produces when parse() is called on it.
-
bool validate_all(void)
Call the xml_config_parser::validate() function on all parsers in the repository, and return whether or not ALL parsers report valid configuration.
- Returns:
TRUE
iff ALL parsers report valid configuration, andFALSE
otherwise.
-
inline xml_config_repository(void)