evio::evioDOMTree Class Reference

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

#include <evioUtil.hxx>

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

List of all members.

Public Member Functions

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

Public Attributes

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

Detailed Description

Represents an evio tree/event in memory.

Tree root is an evioDOMNode.


Constructor & Destructor Documentation

evioDOMTree::evioDOMTree ( void   )  throw (evioException)

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::evioDOMTree ( evioDictionary dict  )  throw (evioException)

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

Parameters:
dict dictionary

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

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

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

Parameters:
channel evioChannel object
name Name of tree
evioDOMTree::evioDOMTree ( const evioChannel channel,
const string &  name = "evio" 
) throw (evioException)

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

Parameters:
channel Pointer to evioChannel object
name Name of tree
evioDOMTree::evioDOMTree ( const uint32_t *  buf,
const string &  name = "evio" 
) throw (evioException)

Constructor fills tree from contents of buffer.

Parameters:
buf Buffer containing event
name Name of tree
evioDOMTree::evioDOMTree ( evioDOMNodeP  node,
const string &  name = "evio" 
) throw (evioException)

Constructor creates tree using node as the root node.

Parameters:
node Pointer to node that becomes the root node
name Name of tree
evioDOMTree::evioDOMTree ( uint16_t  tag,
uint8_t  num,
ContainerType  cType = BANK,
const string &  name = "evio" 
) throw (evioException)

Constructor creates new container node as root node.

Parameters:
tag Root node tag
num Root node num
cType Root node content type
name Name of tree

References evio::evioDOMNode::createEvioDOMNode().

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

Constructor creates new container node as root node.

Parameters:
tag Root node name
cType Root node content type
name Name of tree

References evio::evioDOMNode::createEvioDOMNode(), and evio::evioDictionary::getTagNum().

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

Constructor creates new container node as root node.

Parameters:
name Root node tagNum
cType Root node content type
name Name of tree

References evio::evioDOMNode::createEvioDOMNode().

evio::evioDOMTree::evioDOMTree ( const string &  bankName,
evioDictionary dictionary,
ContainerType  cType = BANK,
const string &  name = "evio" 
) throw (evioException)
evioDOMTree::~evioDOMTree ( void   )  [virtual]

Destructor deletes root node and contents.

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


Member Function Documentation

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

Creates leaf node and adds it to tree root node.

Parameters:
name Leaf node name
formatTag Format tag
formatString Format string
dataTag Data tag
dataNum Data num
t array of uint32_t data len Length of array

References evio::evioDictionary::getTagNum().

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

Creates leaf node and adds it to tree root node.

Parameters:
name Leaf node name
formatTag Format tag
formatString Format string
dataTag Data tag
dataNum Data num
dataVec vector<T> of data

References evio::evioDictionary::getTagNum().

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

Creates leaf node and adds it to tree root node.

Parameters:
tn Leaf tagNum
formatTag Format tag
formatString Format string
dataTag Data tag
dataNum Data num
t array of uint32_t data len Length of array
void evioDOMTree::addBank ( tagNum  tn,
uint16_t  formatTag,
const string &  formatString,
uint16_t  dataTag,
uint8_t  dataNum,
const vector< uint32_t > &  dataVec 
) throw (evioException)

Creates leaf node and adds it to tree root node.

Parameters:
tn Leaf tagNum
formatTag Format tag
formatString Format string
dataTag Data tag
dataNum Data num
dataVec vector<T> of data
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 
) throw (evioException)

Creates leaf node and adds it to tree root node.

Parameters:
tag Node tag
num Node num
formatTag Format tag
formatString Format string
dataTag Data tag
dataNum Data num
t array of uint32_t data len Length of array

References evio::evioDOMContainerNode::childList, evio::evioDOMNode::createEvioDOMNode(), and evio::evioDOMNode::parent.

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 
) throw (evioException)

Creates leaf node and adds it to tree root node.

Parameters:
tag Node tag
num Node num
formatTag Format tag
formatString Format string
dataTag Data tag
dataNum Data num
dataVec vector<T> of data

References evio::evioDOMContainerNode::childList, evio::evioDOMNode::createEvioDOMNode(), and evio::evioDOMNode::parent.

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

Creates leaf node and adds it to tree root node.

Parameters:
name Node name
dataBuf Pointer to array containg data of type T
dataLen Length of array
template<typename T >
void evio::evioDOMTree::addBank ( const string &  name,
const vector< T > &  dataVec 
) throw (evioException) [inline]

Creates leaf node and adds it to tree root node.

Parameters:
name Leaf node name
dataVec vector<T> of data
template<typename T >
void evio::evioDOMTree::addBank ( tagNum  tn,
const T *  dataBuf,
int  dataLen 
) throw (evioException) [inline]

Creates leaf node and adds it to tree root node.

Parameters:
tn Leaf node tagNum
dataBuf Pointer to array containg data of type T
dataLen Length of array
template<typename T >
void evio::evioDOMTree::addBank ( tagNum  tn,
const vector< T > &  dataVec 
) throw (evioException) [inline]

Creates leaf node and adds it to tree root node.

Parameters:
tn Leaf node tagNum
dataVec vector<T> of data
template<typename T >
void evio::evioDOMTree::addBank ( uint16_t  tag,
uint8_t  num,
const T *  dataBuf,
int  dataLen 
) throw (evioException) [inline]

Creates leaf node and adds it to tree root node.

Parameters:
tag Node tag
num Node num
dataBuf Pointer to array containg data of type T
dataLen Length of array
template<typename T >
void evio::evioDOMTree::addBank ( uint16_t  tag,
uint8_t  num,
const vector< T > &  dataVec 
) throw (evioException) [inline]

Creates leaf node and adds it to tree root node.

Parameters:
tag Node tag
num Node num
dataVec vector<T> of data
void evioDOMTree::addBank ( evioDOMNodeP  node  )  throw (evioException)

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

Parameters:
node Node to add to tree

References evio::evioDOMContainerNode::childList.

void evioDOMTree::clear ( void   )  throw (evioException)

Removes and deletes tree root node and all its contents.

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

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 throw (evioException)

Creates new composite leaf node.

Parameters:
nName Node name
formatTag Format tag
formatString Format string
dataTag Data tag
dataNum Data num
dataVec Pointer to arry of uint32_t data
len Length of array
Returns:
Pointer to new node

References evio::evioDOMNode::createEvioDOMNode().

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

Creates new composite leaf node.

Parameters:
nName Node name
formatTag Format tag
formatString Format string
dataTag Data tag
dataNum Data num
dataVec Vector of uint32_t data
Returns:
Pointer to new node

References evio::evioDOMNode::createEvioDOMNode().

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

Creates container node.

Parameters:
name Node name
t Pointer to object having serialize method
userArg User arg passed to serialize method cType Container node type
Returns:
Pointer to new node
template<typename T >
evioDOMNodeP evio::evioDOMTree::createNode ( const string &  name,
T *  t,
void *  userArg,
ContainerType  cType = BANK 
) const throw (evioException) [inline]

Creates container node.

Parameters:
name Node name
t Pointer to object having serialize method
userArg User arg passed to serialize method cType Container node type
Returns:
Pointer to new node
evioDOMNodeP evioDOMTree::createNode ( const string &  nName,
void(*)(evioDOMNodeP c, void *userArg)  f,
void *  userArg,
ContainerType  cType = BANK 
) const throw (evioException)

Creates new container node.

Parameters:
nName Node name
ContainerType Type of container node
Returns:
Pointer to new node

References evio::evioDOMNode::createEvioDOMNode().

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

Creates new container node.

Parameters:
nName Node name
ContainerType Type of container node
Returns:
Pointer to new node

References evio::evioDOMNode::createEvioDOMNode().

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

Creates leaf node.

Parameters:
name Node name
t Pointer to array of values
len Length of array
Returns:
Pointer to new node
template<typename T >
evioDOMNodeP evio::evioDOMTree::createNode ( const string &  name,
const vector< T > &  tVec 
) const throw (evioException) [inline]

Creates leaf node.

Parameters:
name Node name
tVec Vector of values
Returns:
Pointer to new node
evioDOMNodeP evioDOMTree::createNode ( const string &  nName,
ContainerType  cType = BANK 
) const throw (evioException)

Creates new container node.

Parameters:
nName Node name
ContainerType Type of container node
Returns:
Pointer to new node

References evio::evioDOMNode::createEvioDOMNode().

const evioDictionary * evioDOMTree::getDictionary ( void   )  const

Sets dictionary to use by this tree.

Returns:
Const pointer to dictionary
template<class Predicate >
evioDOMNodeP evio::evioDOMTree::getFirstNode ( Predicate  pred  )  throw (evioException) [inline]

Returns pointer to first node in tree satisfying predicate.

Consider that the order of the search is undefined, so if there is more than one bank satisfying predicate this method may not return the same thing each time. Currently it does a depth-first search, but this could change. I.e. to be safe only use this method when you are sure there is only one bank that satisfies predicate.

Parameters:
pred Function object true if node meets predicate criteria
Returns:
Pointer to node
template<class Predicate >
evioDOMNodeListP evio::evioDOMTree::getNodeList ( Predicate  pred  )  throw (evioException) [inline]

Returns list of nodes in tree satisfying predicate.

Parameters:
pred Function object true if node meets predicate criteria
Returns:
Pointer to node list (actually auto_ptr<>)
evioDOMNodeListP evioDOMTree::getNodeList ( const string &  nName  )  throw (evioException)

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

Parameters:
name Name of banks to find
Returns:
Pointer to list of nodes in tree (actually auto_ptr<>)

References evio::evioDictionary::getTagNumMap.

evioDOMNodeListP evioDOMTree::getNodeList ( void   )  throw (evioException)

Returns list of all nodes in tree.

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

References root.

int evioDOMTree::getSerializedLength ( void   )  const throw (evioException)

Gets serialized length of tree.

Returns:
Size of serialized tree in 4-byte words

References root.

template<typename T , class Predicate >
vector< T > * evio::evioDOMTree::getVectorUnique ( Predicate  pred  )  throw (evioException) [inline]

Returns vector<T> from single node in tree that is of type T AND satisfies predicate.

Throws exception if more than one node satisfies predicate.

Parameters:
pred Function object true if node satisfies predicate
Returns:
Pointer to vector<T>, NULL if no node containing vector<T> satisfies predicate
template<typename T >
vector< T > * evio::evioDOMTree::getVectorUnique ( void   )  throw (evioException) [inline]

Returns vector<T> from single node in tree containing vector<T>.

Throws exception if more than one node contains vector<T>.

Returns:
Pointer to vector, NULL if no node contains vector<T>
evioDOMTree & evioDOMTree::operator<< ( evioDOMNodeP  node  )  throw (evioException)

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

Parameters:
node Node to add to root
Returns:
Pointer to this
void evioDOMTree::setDictionary ( const evioDictionary dict  ) 

Sets dictionary to use by this tree.

Parameters:
dict Ref to dictionary
void evioDOMTree::setDictionary ( const evioDictionary dict  ) 

Sets dictionary to use by this tree.

Parameters:
dict Pointer to dictionary
int evioDOMTree::toEVIOBuffer ( uint32_t *  buf,
int  size 
) const throw (evioException) [virtual]

Serializes tree to buffer.

Parameters:
buf Buffer that receives serialized tree
size Size of buffer
Returns:
Size of serialized buffer in 4-byte words

Implements evio::evioChannelBufferizable.

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

References toString().

string evioDOMTree::toString ( const evioToStringConfig config  )  const

Returns XML string listing tree contents.

Parameters:
config Pointer to evioToStringConfig contains options that control string creation
Returns:
XML string listing contents

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

string evioDOMTree::toString ( void   )  const

Returns XML string listing tree contents.

Returns:
XML string listing contents

References root.

Referenced by toString().


Member Data Documentation

Dictionary to use for this tree.

Name of tree.


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

Generated on 4 Feb 2014 for evio by  doxygen 1.6.1