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

Represents an evio tree/event in memory. More...

#include <evioUtil.hxx>

Inheritance diagram for evio::evioDOMTree:
evio::evioStreamParserHandler evio::evioChannelBufferizable

Public Member Functions

 evioDOMTree ()
 No-arg constructor creates empty tree name="evio", root node is bank with tag=0, num=0. More...
 
 evioDOMTree (evioDictionary *dictionary)
 Constructor creates empty tree name="evio" with dictionary, root node is bank with tag=0, num=0. More...
 
 evioDOMTree (const evioChannel &channel, const string &name="evio")
 Constructor fills tree from contents of evioChannel object, gets dictionary from channel. More...
 
 evioDOMTree (const evioChannel *channel, const string &name="evio")
 Constructor fills tree from contents of evioChannel object, gets dictionary from channel. More...
 
 evioDOMTree (const uint32_t *buf, const string &name="evio")
 Constructor fills tree from contents of buffer. More...
 
 evioDOMTree (evioDOMNodeP node, const string &name="evio")
 Constructor creates tree using node as the root node. More...
 
 evioDOMTree (uint16_t tag, uint8_t num, ContainerType cType=BANK, const string &name="evio")
 Constructor creates new container node as root node. More...
 
 evioDOMTree (const string &bankName, ContainerType cType=BANK, const string &name="evio")
 Constructor creates new container node as root node. More...
 
 evioDOMTree (evioDictEntry tn, ContainerType cType=BANK, const string &name="evio")
 Constructor creates new container node as root node. More...
 
 evioDOMTree (const string &bankName, evioDictionary *dictionary, ContainerType cType=BANK, const string &name="evio")
 
virtual ~evioDOMTree ()
 Destructor deletes root node and contents. More...
 
void clear ()
 Removes and deletes tree root node and all its contents. More...
 
void addBank (evioDOMNodeP node)
 Makes node root if tree is empty, or adds node to root if a container. More...
 
template<typename T >
void addBank (uint16_t tag, uint8_t num, const vector< T > &dataVec)
 
template<typename T >
void addBank (uint16_t tag, uint8_t num, const T *dataBuf, int dataLen)
 
template<typename T >
void addBank (evioDictEntry tn, const vector< T > &dataVec)
 
template<typename T >
void addBank (evioDictEntry tn, const T *dataBuf, int dataLen)
 
template<typename T >
void addBank (const string &name, const vector< T > &dataVec)
 
template<typename T >
void addBank (const string &name, const T *dataBuf, int dataLen)
 
void addBank (uint16_t tag, uint8_t num, uint16_t formatTag, const string &formatString, uint16_t dataTag, uint8_t dataNum, const vector< uint32_t > &dataVec)
 Creates leaf node and adds it to tree root node. More...
 
void addBank (uint16_t tag, uint8_t num, uint16_t formatTag, const string &formatString, uint16_t dataTag, uint8_t dataNum, const uint32_t *t, int len)
 Creates leaf node and adds it to tree root node. More...
 
void addBank (evioDictEntry tn, uint16_t formatTag, const string &formatString, uint16_t dataTag, uint8_t dataNum, const vector< uint32_t > &dataVec)
 Creates leaf node and adds it to tree root node. More...
 
void addBank (evioDictEntry tn, uint16_t formatTag, const string &formatString, uint16_t dataTag, uint8_t dataNum, const uint32_t *t, int len)
 Creates leaf node and adds it to tree root node. More...
 
void addBank (const string &name, uint16_t formatTag, const string &formatString, uint16_t dataTag, uint8_t dataNum, const vector< uint32_t > &dataVec)
 Creates leaf node and adds it to tree root node. More...
 
void addBank (const string &name, uint16_t formatTag, const string &formatString, uint16_t dataTag, uint8_t dataNum, const uint32_t *t, int len)
 Creates leaf node and adds it to tree root node. More...
 
evioDOMNodeP createNode (const string &name, ContainerType cType=BANK) const
 Creates new container node. More...
 
template<typename T >
evioDOMNodeP createNode (const string &name, const vector< T > &tVec) const
 
template<typename T >
evioDOMNodeP createNode (const string &name, const T *t, int len) const
 
evioDOMNodeP createNode (const string &name, const evioSerializable &o, ContainerType cType=BANK) const
 Creates new container node. More...
 
evioDOMNodeP createNode (const string &name, void(*f)(evioDOMNodeP c, void *userArg), void *userArg, ContainerType cType=BANK) const
 Creates new container node. More...
 
template<typename T >
evioDOMNodeP createNode (const string &name, T *t, void *userArg, ContainerType cType=BANK) const
 
template<typename T >
evioDOMNodeP createNode (const string &name, T *t, void *T::*mfp(evioDOMNodeP c, void *userArg), void *userArg, ContainerType cType=BANK) const
 
evioDOMNodeP createNode (const string &name, uint16_t formatTag, const string &formatString, uint16_t dataTag, uint8_t dataNum, const vector< uint32_t > &dataVec) const
 Creates new composite leaf node. More...
 
evioDOMNodeP createNode (const string &name, uint16_t formatTag, const string &formatString, uint16_t dataTag, uint8_t dataNum, const uint32_t *t, int len) const
 Creates new composite leaf node. More...
 
evioDOMTreeoperator<< (evioDOMNodeP node)
 Makes node root if tree is empty, or adds node to root if a container. More...
 
int getSerializedLength () const
 Gets serialized length of tree. More...
 
int toEVIOBuffer (uint32_t *buf, int size) const
 Serializes tree to buffer. More...
 
evioDOMNodeListP getNodeList ()
 Returns list of all nodes in tree. More...
 
evioDOMNodeListP getNodeList (const string &name)
 Returns list of all nodes in tree with particular name, evioDictEntry from dictionary. More...
 
template<class Predicate >
evioDOMNodeListP getNodeList (Predicate pred)
 
template<class Predicate >
evioDOMNodeP getFirstNode (Predicate pred)
 
template<typename T >
vector< T > * getVectorUnique ()
 
template<typename T , class Predicate >
vector< T > * getVectorUnique (Predicate pred)
 
string toString () const
 Returns XML string listing tree contents. More...
 
string toString (const evioToStringConfig *config) const
 Returns XML string listing tree contents. More...
 
string toString (const evioToStringConfig &config) const
 
const evioDictionarygetDictionary () const
 Sets dictionary to use by this tree. More...
 
void setDictionary (const evioDictionary *dict)
 Sets dictionary to use by this tree. More...
 
void setDictionary (const evioDictionary &dict)
 Sets dictionary to use by this tree. More...
 
- Public Member Functions inherited from evio::evioStreamParserHandler
virtual ~evioStreamParserHandler ()
 
- Public Member Functions inherited from evio::evioChannelBufferizable
virtual ~evioChannelBufferizable ()
 

Public Attributes

evioDOMNodeP root
 Pointer to root node of tree. More...
 
string name
 Name of tree. More...
 
const evioDictionarydictionary
 Dictionary to use for this tree. More...
 

Detailed Description

Represents an evio tree/event in memory.

Tree root is an evioDOMNode.

Constructor & Destructor Documentation

◆ evioDOMTree() [1/10]

evioDOMTree::evioDOMTree ( )

No-arg constructor creates empty tree name="evio", root node is bank with tag=0, num=0.

References evio::BANK, evio::evioDOMNode::createEvioDOMNode(), evio::evioDOMNode::parentTree, and root.

◆ evioDOMTree() [2/10]

evioDOMTree::evioDOMTree ( evioDictionary dict)

Constructor creates empty tree name="evio" with dictionary, root node is bank with tag=0, num=0.

Parameters
dictdictionary

References evio::BANK, evio::evioDOMNode::createEvioDOMNode(), evio::evioDOMNode::parentTree, and root.

◆ evioDOMTree() [3/10]

evioDOMTree::evioDOMTree ( const evioChannel channel,
const string &  name = "evio" 
)

Constructor fills tree from contents of evioChannel object, gets dictionary from channel.

Parameters
channelevioChannel object
nameName of tree

References dictionary, evio::evioChannel::getBuffer(), evio::evioChannel::getDictionary(), evio::evioChannel::getNoCopyBuffer(), evio::evioChannel::getRandomBuffer(), evio::evioDOMNode::parentTree, and root.

◆ evioDOMTree() [4/10]

evioDOMTree::evioDOMTree ( const evioChannel channel,
const string &  name = "evio" 
)

Constructor fills tree from contents of evioChannel object, gets dictionary from channel.

Parameters
channelPointer to evioChannel object
nameName of tree

References dictionary, evio::evioChannel::getBuffer(), evio::evioChannel::getDictionary(), evio::evioChannel::getNoCopyBuffer(), evio::evioChannel::getRandomBuffer(), evio::evioDOMNode::parentTree, and root.

◆ evioDOMTree() [5/10]

evioDOMTree::evioDOMTree ( const uint32_t *  buf,
const string &  name = "evio" 
)

Constructor fills tree from contents of buffer.

Parameters
bufBuffer containing event
nameName of tree

References evio::evioDOMNode::parentTree, and root.

◆ evioDOMTree() [6/10]

evioDOMTree::evioDOMTree ( evioDOMNodeP  node,
const string &  name = "evio" 
)

Constructor creates tree using node as the root node.

Parameters
nodePointer to node that becomes the root node
nameName of tree

References evio::evioDOMNode::parentTree, and root.

◆ evioDOMTree() [7/10]

evioDOMTree::evioDOMTree ( uint16_t  tag,
uint8_t  num,
ContainerType  cType = BANK,
const string &  name = "evio" 
)

Constructor creates new container node as root node.

Parameters
tagRoot node tag
numRoot node num
cTypeRoot node content type
nameName of tree

References evio::evioDOMNode::createEvioDOMNode(), evio::evioDOMNode::parentTree, and root.

◆ evioDOMTree() [8/10]

evioDOMTree::evioDOMTree ( const string &  bankName,
ContainerType  cType = BANK,
const string &  name = "evio" 
)

Constructor creates new container node as root node.

Parameters
tagRoot node name
cTypeRoot node content type
nameName of tree

References evio::evioDOMNode::createEvioDOMNode(), dictionary, evio::evioDictionary::getEntry(), evio::evioDictEntry::getNum(), evio::evioDictEntry::getTag(), evio::evioDOMNode::parentTree, and root.

◆ evioDOMTree() [9/10]

evioDOMTree::evioDOMTree ( evioDictEntry  tn,
ContainerType  cType = BANK,
const string &  name = "evio" 
)

Constructor creates new container node as root node.

Parameters
nameRoot node evioDictEntry
cTypeRoot node content type
nameName of tree

References evio::evioDOMNode::createEvioDOMNode(), evio::evioDictEntry::getNum(), evio::evioDictEntry::getTag(), evio::evioDOMNode::parentTree, and root.

◆ evioDOMTree() [10/10]

evio::evioDOMTree::evioDOMTree ( const string &  bankName,
evioDictionary dictionary,
ContainerType  cType = BANK,
const string &  name = "evio" 
)

◆ ~evioDOMTree()

evioDOMTree::~evioDOMTree ( )
virtual

Destructor deletes root node and contents.

References evio::evioDOMNode::cutAndDelete(), and root.

Member Function Documentation

◆ addBank() [1/13]

template<typename T >
void evio::evioDOMTree::addBank ( const string &  name,
const T *  dataBuf,
int  dataLen 
)

◆ addBank() [2/13]

template<typename T >
void evio::evioDOMTree::addBank ( const string &  name,
const vector< T > &  dataVec 
)

◆ addBank() [3/13]

void evioDOMTree::addBank ( const string &  name,
uint16_t  formatTag,
const string &  formatString,
uint16_t  dataTag,
uint8_t  dataNum,
const uint32_t *  t,
int  len 
)

Creates leaf node and adds it to tree root node.

Parameters
nameLeaf node name
formatTagFormat tag
formatStringFormat string
dataTagData tag
dataNumData num
tarray of uint32_t data @parem len Length of array

References addBank(), dictionary, evio::evioDictionary::getEntry(), evio::evioDictEntry::getNum(), evio::evioDictEntry::getTag(), and name.

◆ addBank() [4/13]

void evioDOMTree::addBank ( const string &  name,
uint16_t  formatTag,
const string &  formatString,
uint16_t  dataTag,
uint8_t  dataNum,
const vector< uint32_t > &  dataVec 
)

Creates leaf node and adds it to tree root node.

Parameters
nameLeaf node name
formatTagFormat tag
formatStringFormat string
dataTagData tag
dataNumData num
dataVecvector<T> of data

References addBank(), dictionary, evio::evioDictionary::getEntry(), evio::evioDictEntry::getNum(), evio::evioDictEntry::getTag(), and name.

◆ addBank() [5/13]

template<typename T >
void evio::evioDOMTree::addBank ( evioDictEntry  tn,
const T *  dataBuf,
int  dataLen 
)

◆ addBank() [6/13]

template<typename T >
void evio::evioDOMTree::addBank ( evioDictEntry  tn,
const vector< T > &  dataVec 
)

◆ addBank() [7/13]

void evioDOMTree::addBank ( evioDictEntry  tn,
uint16_t  formatTag,
const string &  formatString,
uint16_t  dataTag,
uint8_t  dataNum,
const uint32_t *  t,
int  len 
)

Creates leaf node and adds it to tree root node.

Parameters
tnLeaf evioDictEntry
formatTagFormat tag
formatStringFormat string
dataTagData tag
dataNumData num
tarray of uint32_t data @parem len Length of array

References addBank(), evio::evioDictEntry::getNum(), and evio::evioDictEntry::getTag().

◆ addBank() [8/13]

void evioDOMTree::addBank ( evioDictEntry  tn,
uint16_t  formatTag,
const string &  formatString,
uint16_t  dataTag,
uint8_t  dataNum,
const vector< uint32_t > &  dataVec 
)

Creates leaf node and adds it to tree root node.

Parameters
tnLeaf evioDictEntry
formatTagFormat tag
formatStringFormat string
dataTagData tag
dataNumData num
dataVecvector<T> of data

References addBank(), evio::evioDictEntry::getNum(), and evio::evioDictEntry::getTag().

◆ addBank() [9/13]

void evioDOMTree::addBank ( evioDOMNodeP  node)

Makes node root if tree is empty, or adds node to root if a container.

Parameters
nodeNode to add to tree

References evio::evioDOMContainerNode::childList, evio::evioDOMNode::cut(), evio::evioDOMNode::isContainer(), evio::evioDOMNode::parent, evio::evioDOMNode::parentTree, and root.

Referenced by addBank(), and operator<<().

◆ addBank() [10/13]

template<typename T >
void evio::evioDOMTree::addBank ( uint16_t  tag,
uint8_t  num,
const T *  dataBuf,
int  dataLen 
)

◆ addBank() [11/13]

template<typename T >
void evio::evioDOMTree::addBank ( uint16_t  tag,
uint8_t  num,
const vector< T > &  dataVec 
)

◆ addBank() [12/13]

void evioDOMTree::addBank ( uint16_t  tag,
uint8_t  num,
uint16_t  formatTag,
const string &  formatString,
uint16_t  dataTag,
uint8_t  dataNum,
const uint32_t *  t,
int  len 
)

Creates leaf node and adds it to tree root node.

Parameters
tagNode tag
numNode num
formatTagFormat tag
formatStringFormat string
dataTagData tag
dataNumData num
tarray of uint32_t data @parem len Length of array

References evio::evioDOMNode::createEvioDOMNode(), evio::evioDOMNode::isContainer(), evio::evioDOMNode::parent, evio::evioDOMNode::parentTree, and root.

◆ addBank() [13/13]

void evioDOMTree::addBank ( uint16_t  tag,
uint8_t  num,
uint16_t  formatTag,
const string &  formatString,
uint16_t  dataTag,
uint8_t  dataNum,
const vector< uint32_t > &  dataVec 
)

Creates leaf node and adds it to tree root node.

Parameters
tagNode tag
numNode num
formatTagFormat tag
formatStringFormat string
dataTagData tag
dataNumData num
dataVecvector<T> of data

References evio::evioDOMNode::createEvioDOMNode(), evio::evioDOMNode::isContainer(), evio::evioDOMNode::parent, evio::evioDOMNode::parentTree, and root.

◆ clear()

void evioDOMTree::clear ( )

Removes and deletes tree root node and all its contents.

References evio::evioDOMNode::cutAndDelete(), and root.

◆ createNode() [1/9]

evioDOMNodeP evioDOMTree::createNode ( const string &  nName,
const evioSerializable o,
ContainerType  cType = BANK 
) const

Creates new container node.

Parameters
nNameNode name
ContainerTypeType of container node
Returns
Pointer to new node

References evio::evioDOMNode::createEvioDOMNode(), and dictionary.

◆ createNode() [2/9]

template<typename T >
evioDOMNodeP evio::evioDOMTree::createNode ( const string &  name,
const T *  t,
int  len 
) const

◆ createNode() [3/9]

template<typename T >
evioDOMNodeP evio::evioDOMTree::createNode ( const string &  name,
const vector< T > &  tVec 
) const

◆ createNode() [4/9]

evioDOMNodeP evioDOMTree::createNode ( const string &  nName,
ContainerType  cType = BANK 
) const

Creates new container node.

Parameters
nNameNode name
ContainerTypeType of container node
Returns
Pointer to new node

References evio::evioDOMNode::createEvioDOMNode(), and dictionary.

◆ createNode() [5/9]

template<typename T >
evioDOMNodeP evio::evioDOMTree::createNode ( const string &  name,
T *  t,
void *T::*  mfpevioDOMNodeP c, void *userArg,
void *  userArg,
ContainerType  cType = BANK 
) const

◆ createNode() [6/9]

template<typename T >
evioDOMNodeP evio::evioDOMTree::createNode ( const string &  name,
T *  t,
void *  userArg,
ContainerType  cType = BANK 
) const

◆ createNode() [7/9]

evioDOMNodeP evioDOMTree::createNode ( const string &  nName,
uint16_t  formatTag,
const string &  formatString,
uint16_t  dataTag,
uint8_t  dataNum,
const uint32_t *  t,
int  len 
) const

Creates new composite leaf node.

Parameters
nNameNode name
formatTagFormat tag
formatStringFormat string
dataTagData tag
dataNumData num
dataVecPointer to arry of uint32_t data
lenLength of array
Returns
Pointer to new node

References evio::evioDOMNode::createEvioDOMNode(), and dictionary.

◆ createNode() [8/9]

evioDOMNodeP evioDOMTree::createNode ( const string &  nName,
uint16_t  formatTag,
const string &  formatString,
uint16_t  dataTag,
uint8_t  dataNum,
const vector< uint32_t > &  dataVec 
) const

Creates new composite leaf node.

Parameters
nNameNode name
formatTagFormat tag
formatStringFormat string
dataTagData tag
dataNumData num
dataVecVector of uint32_t data
Returns
Pointer to new node

References evio::evioDOMNode::createEvioDOMNode(), and dictionary.

◆ createNode() [9/9]

evioDOMNodeP evioDOMTree::createNode ( const string &  nName,
void(*)(evioDOMNodeP c, void *userArg)  f,
void *  userArg,
ContainerType  cType = BANK 
) const

Creates new container node.

Parameters
nNameNode name
ContainerTypeType of container node
Returns
Pointer to new node

References evio::evioDOMNode::createEvioDOMNode(), and dictionary.

◆ getDictionary()

const evioDictionary * evioDOMTree::getDictionary ( ) const

Sets dictionary to use by this tree.

Returns
Const pointer to dictionary

References dictionary.

◆ getFirstNode()

template<class Predicate >
evioDOMNodeP evio::evioDOMTree::getFirstNode ( Predicate  pred)

◆ getNodeList() [1/3]

evioDOMNodeListP evioDOMTree::getNodeList ( )

Returns list of all nodes in tree.

Returns
Pointer to list of nodes in tree (actually unique_ptr<>)

References root.

◆ getNodeList() [2/3]

evioDOMNodeListP evioDOMTree::getNodeList ( const string &  nName)

Returns list of all nodes in tree with particular name, evioDictEntry from dictionary.

Parameters
nameName of banks to find
Returns
Pointer to list of nodes in tree (actually unique_ptr<>)

References dictionary, evio::evioDictionary::getTagNumMap, and root.

◆ getNodeList() [3/3]

template<class Predicate >
evioDOMNodeListP evio::evioDOMTree::getNodeList ( Predicate  pred)

◆ getSerializedLength()

int evioDOMTree::getSerializedLength ( ) const

Gets serialized length of tree.

Returns
Size of serialized tree in 4-byte words

References root.

◆ getVectorUnique() [1/2]

template<typename T >
vector<T>* evio::evioDOMTree::getVectorUnique ( )

◆ getVectorUnique() [2/2]

template<typename T , class Predicate >
vector<T>* evio::evioDOMTree::getVectorUnique ( Predicate  pred)

◆ operator<<()

evioDOMTree & evioDOMTree::operator<< ( evioDOMNodeP  node)

Makes node root if tree is empty, or adds node to root if a container.

Parameters
nodeNode to add to root
Returns
Pointer to this

References addBank().

◆ setDictionary() [1/2]

void evioDOMTree::setDictionary ( const evioDictionary dict)

Sets dictionary to use by this tree.

Parameters
dictRef to dictionary

References dictionary.

◆ setDictionary() [2/2]

void evioDOMTree::setDictionary ( const evioDictionary dict)

Sets dictionary to use by this tree.

Parameters
dictPointer to dictionary

References dictionary.

◆ toEVIOBuffer()

int evioDOMTree::toEVIOBuffer ( uint32_t *  buf,
int  size 
) const
virtual

Serializes tree to buffer.

Parameters
bufBuffer that receives serialized tree
sizeSize of buffer
Returns
Size of serialized buffer in 4-byte words

Implements evio::evioChannelBufferizable.

References root.

◆ toString() [1/3]

string evioDOMTree::toString ( ) const

Returns XML string listing tree contents.

Returns
XML string listing contents

References dictionary, and root.

Referenced by toString().

◆ toString() [2/3]

string evioDOMTree::toString ( const evioToStringConfig config) const
Parameters
configPointer to config Returns XML string listing tree contents.
Returns
XML string listing contents

References toString().

◆ toString() [3/3]

string evioDOMTree::toString ( const evioToStringConfig config) const

Returns XML string listing tree contents.

Parameters
configPointer to evioToStringConfig contains options that control string creation
Returns
XML string listing contents

References dictionary, root, evio::evioToStringConfig::setDictionary(), and evio::evioToStringConfig::toStringDictionary.

Member Data Documentation

◆ dictionary

const evioDictionary* evio::evioDOMTree::dictionary

Dictionary to use for this tree.

Referenced by addBank(), createNode(), evioDOMTree(), getDictionary(), getNodeList(), setDictionary(), and toString().

◆ name

string evio::evioDOMTree::name

Name of tree.

Referenced by addBank().

◆ root

evioDOMNodeP evio::evioDOMTree::root

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