OpenTracker

An Open Architecture for Reconfigurable Tracking based on XML | Contact

ot::ConfigurationParser Class Reference
[Core Classes]

parses the XML configuration file. More...

#include <ConfigurationParser.h>

Collaboration diagram for ot::ConfigurationParser:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ConfigurationParser (Context &context_)
virtual ~ConfigurationParser ()
NodeparseConfigurationFile (const std::string &filename)

Protected Member Functions

ConfigNodebuildConfigTree (OT_DOMELEMENT *element)
NodebuildTree (OT_DOMELEMENT *element)
StringTableparseElement (OT_DOMELEMENT *element)

Protected Attributes

Contextcontext
NodeMap references
OT_DOMDOCUMENT * document

Detailed Description

parses the XML configuration file.

This class reads the configuration file using DOM and builds the tracker tree. It is not part of the public API of OpenTracker, therefore do not use it !

Author:
Gerhard Reitmayr

Definition at line 69 of file ConfigurationParser.h.


Constructor & Destructor Documentation

ot::ConfigurationParser::ConfigurationParser ( Context context_  ) 

constructor method.

The Xerces XML parser library is initialized here.

Parameters:
factory_ pointer to set the member factory

Definition at line 131 of file ConfigurationParser.cxx.

References LOG_ACE_ERROR().

ot::ConfigurationParser::~ConfigurationParser (  )  [virtual]

Destructor method.

Definition at line 150 of file ConfigurationParser.cxx.

References references.


Member Function Documentation

ConfigNode * ot::ConfigurationParser::buildConfigTree ( OT_DOMELEMENT *  element  )  [protected]

builds a tree of configuration nodes.

This is just mirroring the structure of the XML document with ConfigNodes that just hold the element names and attributes. The resulting tree is a parameter to the initialization method of modules.

Parameters:
elements pointer to the XML element to be parsed.
Returns:
pointer to the hew ConfigNode or NULL, if something went wrong.

Definition at line 157 of file ConfigurationParser.cxx.

References parseElement(), and ot::Node::setParent().

Referenced by parseConfigurationFile().

Node * ot::ConfigurationParser::buildTree ( OT_DOMELEMENT *  element  )  [protected]

builds the tracker tree starting from a certain DOM_Element.

Is used recoursively to walk the DOMTree and create new nodes.

Parameters:
element pointer to the element to be parsed.
Returns:
pointer to the new Node or NULL

Definition at line 197 of file ConfigurationParser.cxx.

References context, ot::NodeFactoryContainer::createNode(), ot::Context::factory, LOG_ACE_ERROR(), LOG_ACE_INFO(), ot::Node::name, parseElement(), references, and ot::Node::setParent().

Referenced by parseConfigurationFile().

Node * ot::ConfigurationParser::parseConfigurationFile ( const std::string &  filename  ) 

This method parses an XML configuration file.

It returns a Node as root with all the root nodes defined in the configuration file.

Parameters:
filename the name and path of the configuration file
Returns:
pointer to the root Node or NULL

Definition at line 300 of file ConfigurationParser.cxx.

References buildConfigTree(), buildTree(), context, document, DOMTreeErrorReporter::errorsEncountered(), ot::Context::getModule(), ot::Module::init(), LOG_ACE_ERROR(), LOG_ACE_INFO(), parseElement(), and ot::Node::setParent().

StringTable * ot::ConfigurationParser::parseElement ( OT_DOMELEMENT *  element  )  [protected]

parses an Elements attributes and returns a StringTable describing them.

Parameters:
element pointer to the element
Returns:
a StringMap mapping attribute names to attribute values. This map was created on the heap and it is now owned by the caller.

Definition at line 516 of file ConfigurationParser.cxx.

References ot::StringTable::put().

Referenced by buildConfigTree(), buildTree(), and parseConfigurationFile().


Member Data Documentation

reference to the Context to use its modules and factories

Definition at line 74 of file ConfigurationParser.h.

Referenced by buildTree(), and parseConfigurationFile().

OT_DOMDOCUMENT* ot::ConfigurationParser::document [protected]

stores the parsed document tree

Definition at line 78 of file ConfigurationParser.h.

Referenced by parseConfigurationFile().

maps IDs to nodes

Definition at line 76 of file ConfigurationParser.h.

Referenced by buildTree(), and ~ConfigurationParser().


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

copyright (c) 2006 Graz University of Technology