XmlOdb.h

Go to the documentation of this file.
00001 //
00002 // Access ODB from the XML ODB dump file
00003 //
00004 // Name: XmlOdb.h
00005 // Author: K.Olchanski, 11-July-2006
00006 //
00007 // $Id$
00008 //
00009 
00010 #ifndef INCLUDE_XmlOdb_H
00011 #define INCLUDE_XmlOdb_H
00012 
00013 #include <stdlib.h>
00014 #include "TXMLNode.h"
00015 #include "TXMLAttr.h"
00016 #include "TDOMParser.h"
00017 #include "rootana_stdint.h"
00018 
00019 #include "VirtualOdb.h"
00020 
00021 /// Access to ODB saved in XML format inside midas .mid files
00022 
00023 struct XmlOdb : VirtualOdb
00024 {
00025   TDOMParser* fParser; ///< XML parser for the XML-encoded ODB data
00026   TXMLNode*   fOdb;    ///< Pointer to the root of the ODB tree
00027 
00028   /// Contructor from a string
00029   XmlOdb(const char*buf,int bufLength);
00030 
00031   /// Contructor from a file
00032   XmlOdb(const char* filename);
00033 
00034   /// Destructor
00035   virtual ~XmlOdb();
00036 
00037   /// Find node with given name anywhere inside the given ODB tree
00038   TXMLNode* FindNode(TXMLNode*node,const char*name);
00039 
00040   /// Print out the contents of the ODB tree
00041   void DumpTree(TXMLNode*node = NULL, int level = 0);
00042 
00043   /// Print out the directory structure of the ODB tree
00044   void DumpDirTree(TXMLNode*node = NULL, int level = 0);
00045 
00046   /// Return the value of the named attribute
00047   const char* GetAttrValue(TXMLNode*node,const char*attrName);
00048 
00049   /// Follow the ODB path through the XML DOM tree
00050   TXMLNode* FindPath(TXMLNode*node,const char* path);
00051 
00052   /// Same as FindPath(), but also index into an array
00053   TXMLNode* FindArrayPath(TXMLNode*node,const char* path,const char* type,int index);
00054 
00055   int      odbReadAny(   const char*name, int index, int tid,void* buf, int bufsize=0);
00056   int      odbReadInt(   const char*name, int index, int      defaultValue);
00057   uint32_t odbReadUint32(const char*name, int index, uint32_t defaultValue);
00058   bool     odbReadBool(  const char*name, int index, bool     defaultValue);
00059   double   odbReadDouble(const char*name, int index, double   defaultValue);
00060   float    odbReadFloat(const char*name, int index, float  defaultValue);
00061   const char* odbReadString(const char*name, int index, const char* defaultValue);
00062   int      odbReadArraySize(const char*name);
00063 };
00064 
00065 #endif
00066 //end

Generated on 12 Feb 2016 for ROOT Analyzer by  doxygen 1.6.1