evio  5.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
evio::evioDictionary Class Reference

This class parses XML dictionary string and contains maps for looking up dictionary information. More...

#include <evioDictionary.hxx>

Public Member Functions

 evioDictionary ()
 No-arg constructor contains empty maps. More...
 
 evioDictionary (const string &dictXML, const string &sep=".")
 Constructor fills dictionary maps from string. More...
 
 evioDictionary (ifstream &dictIFS, const string &sep=".")
 Constructor fills dictionary maps from ifstream. More...
 
virtual ~evioDictionary ()
 Destructor. More...
 
bool parseDictionary (const string &dictionaryXML)
 Uses Expat to parse XML dictionary string and fill maps. More...
 
evioDictEntry getEntry (const string &name) const throw (evioException)
 Gets the dictionary entry (evioDictEntry) for a given name. More...
 
string getName (evioDictEntry &entry) const throw (evioException)
 Gets the name associated with an evioDictEntry. More...
 
string getName (uint16_t tag, uint8_t num, uint16_t tagEnd=0, bool haveParent=false, uint16_t parentTag=0, uint8_t parentNum=0, uint16_t parentTagEnd=0) const throw (evioException)
 Gets the name associated with an evioDictEntry which has the given tag, num, tagEnd, and parent tag, num, and tagEnd values. More...
 
string getDictionaryXML (void) const
 Gets dictionary XML. More...
 
void setSeparator (const string &sep)
 Sets separator character. More...
 
string getSeparator (void) const
 Gets separator character. More...
 
string toString (void) const throw (evioException)
 Converts dictionary into string. More...
 

Static Public Member Functions

static void startElementHandler (void *userData, const char *xmlname, const char **atts)
 Expat start element handler, must be static. More...
 
static void endElementHandler (void *userData, const char *xmlname)
 Expat end element handler, must be static. More...
 
static void charDataHandler (void *userData, const char *s, int len)
 Expat start character data handler, must be static. More...
 

Public Attributes

map< evioDictEntry, string > getNameMap
 This is the heart of the dictionary in which a key is composed of a tag/num pair and other entry data and its corresponding value is a name. More...
 
map< string, evioDictEntrygetTagNumMap
 This is a map in which the key is a name and the value is its corresponding dictionary entry. More...
 

Detailed Description

This class parses XML dictionary string and contains maps for looking up dictionary information.

Constructor & Destructor Documentation

evioDictionary::evioDictionary ( )

No-arg constructor contains empty maps.

evioDictionary::evioDictionary ( const string &  dictXML,
const string &  sep = "." 
)
explicit

Constructor fills dictionary maps from string.

Parameters
dictionaryXMLXML string parsed to create dictionary maps

References parseDictionary().

evioDictionary::evioDictionary ( ifstream &  dictIFS,
const string &  sep = "." 
)
explicit

Constructor fills dictionary maps from ifstream.

Parameters
dictionaryXMLXML string parsed to create dictionary maps

References parseDictionary().

evioDictionary::~evioDictionary ( )
virtual

Destructor.

Member Function Documentation

void evioDictionary::charDataHandler ( void *  userData,
const char *  s,
int  len 
)
static

Expat start character data handler, must be static.

Parameters
userDatavoid* pointer to evioDictionary instance
scharacter data string which is NOT zero terminated!
lennumber of valid characters returned at pointer

References evio::evioDictEntry::getEntryType(), getNameMap, getTagNumMap, evio::TAG_NUM, evio::TAG_ONLY, and evio::TAG_RANGE.

Referenced by parseDictionary().

void evioDictionary::endElementHandler ( void *  userData,
const char *  xmlname 
)
static

Expat end element handler, must be static.

Parameters
userDatavoid* pointer to evioDictionary instance
xmlnameName of current element

References evio::dictEntryTag, and evio::oldDictEntryTag.

Referenced by parseDictionary().

string evioDictionary::getDictionaryXML ( void  ) const

Gets dictionary XML.

Returns
dictionary XML
evioDictEntry evioDictionary::getEntry ( const string &  name) const
throw (evioException
)

Gets the dictionary entry (evioDictEntry) for a given name.

Parameters
namename of dictionary entry
Returns
dictionary entry
Exceptions
evioExceptionif entry not found

Referenced by evio::evioDOMTree::addBank(), evio::evioDOMNode::createEvioDOMNode(), and evio::evioDOMTree::evioDOMTree().

string evioDictionary::getName ( evioDictEntry entry) const
throw (evioException
)

Gets the name associated with an evioDictEntry.

Since
5.2
Parameters
entrydictionary entry
Returns
name associated with entry
Exceptions
evioExceptionif entry not found
string evioDictionary::getName ( uint16_t  tag,
uint8_t  num,
uint16_t  tagEnd = 0,
bool  haveParent = false,
uint16_t  parentTag = 0,
uint8_t  parentNum = 0,
uint16_t  parentTagEnd = 0 
) const
throw (evioException
)

Gets the name associated with an evioDictEntry which has the given tag, num, tagEnd, and parent tag, num, and tagEnd values.

Since
5.2
Parameters
tagdictionary entry's tag value.
numdictionary entry's num value.
tagEnddictionary entry's tagEnd value (ending value of a range of tags and > tag). Defaults to 0.
haveParenttrue if entry has a parent entry, else false. Defaults to false.
parentTagparent entry's tag value. Defaults to 0.
parentNumparent entry's num value. Defaults to 0.
parentTagEndparent entry's tagEnd value. Defaults to 0.
Returns
name associated with arguments
Exceptions
evioExceptionif entry not found

References evio::EVIO_UNKNOWN32, evio::evioDictEntry::getEntryType(), evio::evioDictEntry::inRange(), evio::TAG_NUM, evio::TAG_ONLY, and evio::TAG_RANGE.

string evioDictionary::getSeparator ( void  ) const

Gets separator character.

Returns
Separator character
bool evioDictionary::parseDictionary ( const string &  dictionaryXML)

Uses Expat to parse XML dictionary string and fill maps.

Parameters
dictionaryXMLXML string
Returns
True if parsing succeeded

References charDataHandler(), endElementHandler(), and startElementHandler().

Referenced by evioDictionary().

void evioDictionary::setSeparator ( const string &  sep)

Sets separator character.

Parameters
sepSeparator character
void evioDictionary::startElementHandler ( void *  userData,
const char *  xmlname,
const char **  atts 
)
static

Expat start element handler, must be static.

Parameters
userDatavoid* pointer to evioDictionary instance
xmlnameName of current element
attsArray of attributes for this element

References evio::dictEntryTag, evio::EVIO_UNKNOWN32, evio::evioDictEntry::getDataType(), evio::evioDictEntry::getEntryType(), getNameMap, getTagNumMap, evio::oldDictEntryTag, evio::TAG_NUM, evio::TAG_ONLY, and evio::TAG_RANGE.

Referenced by parseDictionary().

string evioDictionary::toString ( void  ) const
throw (evioException
)

Converts dictionary into string.

Returns
String containing dictionary keys and values

References evio::evioDictEntry::getDescription(), evio::evioDictEntry::getFormat(), evio::evioDictEntry::getNum(), evio::evioDictEntry::getTag(), and getTagNumMap.

Member Data Documentation

map<evioDictEntry, string> evio::evioDictionary::getNameMap

This is the heart of the dictionary in which a key is composed of a tag/num pair and other entry data and its corresponding value is a name.

This map contains all entries whether tag/num, tag-only, or tag-range.Gets node name given tag/num.

Referenced by charDataHandler(), evio::evioDOMContainerNode::getFooter(), evio::evioDOMContainerNode::getHeader(), and startElementHandler().

map<string, evioDictEntry> evio::evioDictionary::getTagNumMap

This is a map in which the key is a name and the value is its corresponding dictionary entry.

It's the reverse of the getNameMap map. This map contains all entries whether tag/num, tag-only, or tag-range.Gets tag/num given node name.

Referenced by charDataHandler(), evio::evioDOMTree::getNodeList(), startElementHandler(), and toString().


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