GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TXMLOdb.h
Go to the documentation of this file.
1#ifndef TXMLODB_H
2#define TXMLODB_H
3
4/** \addtogroup Sorting
5 * @{
6 */
7
8/////////////////////////////////////////////////////////////////
9///
10/// \class TXMLOdb
11///
12/// Class to access ODB info from an XML ODB dump at either the begining of a run
13/// or from a seperate file.
14///
15/////////////////////////////////////////////////////////////////
16
17#include <cstdlib>
18#include <cstdio>
19
20#include <fstream>
21#include <string>
22#include <vector>
23
24#include "Globals.h"
25
26#ifdef HAS_XML
27#include "TXMLNode.h"
28#include "TXMLDocument.h"
29#include "TDOMParser.h"
30
31class TXMLOdb {
32public:
33 explicit TXMLOdb(char* buffer, int size = 0);
34 TXMLOdb(const TXMLOdb& rhs);
35 TXMLOdb(TXMLOdb&&) noexcept = default;
36 TXMLOdb& operator=(const TXMLOdb&) = default;
37 TXMLOdb& operator=(TXMLOdb&&) noexcept = default;
38 virtual ~TXMLOdb();
39
40 TXMLDocument* fDoc;
41 TDOMParser* fParser;
42 TXMLNode* fOdb;
43
44 const char* GetNodeName(TXMLNode*);
45 TXMLNode* FindNode(const char* name, TXMLNode* node = nullptr);
46 TXMLNode* FindPath(const char* path, TXMLNode* node = nullptr);
47
48 int ReadInt(const char* path, int index = 0, int defaultValue = 0xffffffff);
49 std::vector<int> ReadIntArray(TXMLNode* node);
50 std::vector<double> ReadDoubleArray(TXMLNode* node);
51 std::vector<std::string> ReadStringArray(TXMLNode* node);
52
53private:
54 static std::array<char, 256> fTextBuffer;
55
56 /// \cond CLASSIMP
57 ClassDef(TXMLOdb, 0) // NOLINT(readability-else-after-return)
58 /// \endcond
59};
60#endif
61/*! @} */
62#endif
std::vector< std::string > ReadStringArray(TXMLNode *node)
Definition TXMLOdb.cxx:169
TXMLDocument * fDoc
Definition TXMLOdb.h:40
TXMLOdb(char *buffer, int size=0)
Definition TXMLOdb.cxx:12
const char * GetNodeName(TXMLNode *)
Definition TXMLOdb.cxx:105
std::vector< double > ReadDoubleArray(TXMLNode *node)
Definition TXMLOdb.cxx:219
int ReadInt(const char *path, int index=0, int defaultValue=0xffffffff)
Definition TXMLOdb.cxx:117
TDOMParser * fParser
Definition TXMLOdb.h:41
TXMLNode * FindPath(const char *path, TXMLNode *node=nullptr)
Definition TXMLOdb.cxx:67
TXMLNode * FindNode(const char *name, TXMLNode *node=nullptr)
Definition TXMLOdb.cxx:41
std::vector< int > ReadIntArray(TXMLNode *node)
Definition TXMLOdb.cxx:127
static std::array< char, 256 > fTextBuffer
Definition TXMLOdb.h:54
TXMLOdb(TXMLOdb &&) noexcept=default
TXMLNode * fOdb
Definition TXMLOdb.h:42
TXMLOdb(const TXMLOdb &rhs)