evio
5.2
|
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, evioDictEntry > | getTagNumMap |
This is a map in which the key is a name and the value is its corresponding dictionary entry. More... | |
This class parses XML dictionary string and contains maps for looking up dictionary information.
evioDictionary::evioDictionary | ( | ) |
No-arg constructor contains empty maps.
|
explicit |
Constructor fills dictionary maps from string.
dictionaryXML | XML string parsed to create dictionary maps |
References parseDictionary().
|
explicit |
Constructor fills dictionary maps from ifstream.
dictionaryXML | XML string parsed to create dictionary maps |
References parseDictionary().
|
virtual |
Destructor.
|
static |
Expat start character data handler, must be static.
userData | void* pointer to evioDictionary instance |
s | character data string which is NOT zero terminated! |
len | number 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().
|
static |
Expat end element handler, must be static.
userData | void* pointer to evioDictionary instance |
xmlname | Name of current element |
References evio::dictEntryTag, and evio::oldDictEntryTag.
Referenced by parseDictionary().
string evioDictionary::getDictionaryXML | ( | void | ) | const |
Gets dictionary XML.
evioDictEntry evioDictionary::getEntry | ( | const string & | name | ) | const |
throw | ( | evioException | |||
) |
Gets the dictionary entry (evioDictEntry) for a given name.
name | name of dictionary entry |
evioException | if 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.
entry | dictionary entry |
evioException | if 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.
tag | dictionary entry's tag value. |
num | dictionary entry's num value. |
tagEnd | dictionary entry's tagEnd value (ending value of a range of tags and > tag). Defaults to 0. |
haveParent | true if entry has a parent entry, else false. Defaults to false. |
parentTag | parent entry's tag value. Defaults to 0. |
parentNum | parent entry's num value. Defaults to 0. |
parentTagEnd | parent entry's tagEnd value. Defaults to 0. |
evioException | if 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.
bool evioDictionary::parseDictionary | ( | const string & | dictionaryXML | ) |
Uses Expat to parse XML dictionary string and fill maps.
dictionaryXML | XML string |
References charDataHandler(), endElementHandler(), and startElementHandler().
Referenced by evioDictionary().
void evioDictionary::setSeparator | ( | const string & | sep | ) |
Sets separator character.
sep | Separator character |
|
static |
Expat start element handler, must be static.
userData | void* pointer to evioDictionary instance |
xmlname | Name of current element |
atts | Array 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.
References evio::evioDictEntry::getDescription(), evio::evioDictEntry::getFormat(), evio::evioDictEntry::getNum(), evio::evioDictEntry::getTag(), and getTagNumMap.
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().