BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
XmlBaseCnv.h
Go to the documentation of this file.
1// $Header: /bes/bes/BossCvs/Calibration/CalibSvc/CalibXmlCnvSvc/src/cnv/XmlBaseCnv.h,v 1.1.1.1 2006/04/03 03:04:32 maqm Exp $
2#ifndef CalibData_XmlBaseCnv_h
3#define CalibData_XmlBaseCnv_h
4
5/** @class XmlBaseCnv
6
7 Base class for calibration converters from XML files to TCDS.
8 All such converters need to do certain things, which are
9 handled here.
10
11 @author J. Bogart
12*/
13#include <string>
14#include <vector>
15#include "GaudiKernel/Converter.h"
16#include "GaudiKernel/CnvFactory.h"
17#include <xercesc/dom/DOMElement.hpp>
18
19class ISvcLocator;
20class GenericAddress;
21class ICalibXmlSvc;
23class ITime;
24
25namespace CalibData {
26 class CalibTime;
27 class CalibBase;
28 class DacCol; // for now used only by calorimeter intNonLin calibration
29 class Xpos; // only of interest for some calorimeter calibrations
30 class ValSig;
31}
32
33using XERCES_CPP_NAMESPACE_QUALIFIER DOMElement;
34
35
36class XmlBaseCnv : public Converter {
37
38public:
39
40 virtual ~XmlBaseCnv();
41
42 virtual StatusCode initialize();
43
44 virtual StatusCode finalize();
45
46 /**
47 Create the transient representation of an object, given an opaque
48 address. This and the following update method comprise the core
49 functionality of calibration converters.
50 */
51 virtual StatusCode createObj(IOpaqueAddress* addr,
52 DataObject*& refpObject);
53
55 return m_xmlSvc;
56 }
57
58 static const unsigned char storageType();
59
60 /**
61 Constructor for this converter
62 @param svc a ISvcLocator interface to find services
63 @param clid the type of object the converter is able to convert
64 */
65 // XmlBaseCnv(ISvcLocator* svc, const CLID& clid = 0);
66 XmlBaseCnv(ISvcLocator* svc, const CLID& clid);
67
68protected:
69 /** This creates the transient representation of an object from the
70 * DOMElement representing it, then fills it and process it.
71 * This implementation actually only calls the i_* methods of the
72 * "right" converter to do the job; so the very first thing it
73 * does is get a pointer to the appropriate derived converter.
74 * Converters typically don't need to override this method
75 * but only to override/implement some of the i_* methods.
76 * @param element the DOMElement (typically the root element of the
77 * document) to be used to build the object
78 * @param refpObject the object to be built
79 * @param address the opaque address for this object
80 * @return status depending on the completion of the call
81 */
82 virtual StatusCode internalCreateObj (const DOMElement* element,
83 DataObject*& refpObject,
84 IOpaqueAddress* address);
85
86 /** This creates the transient representation of an object from the
87 * DOM_Element representing it. This actually does the "new" operation
88 * and deals with the attributes of the node. This base class implementation
89 * does nothing; it should not normally be called because it doesn't
90 * correspond to any TCDS class. Instead,
91 * i_createObj of some derived class will be called.
92 * @param element the DOM_Element (typically root element of document)
93 * to be used to builds the object
94 * @param refpObject the object to be built
95 * @return status depending on the completion of the call
96 */
97 virtual StatusCode i_createObj (const DOMElement* element,
98 DataObject*& refpObject);
99
100 /// In case there is additional work to do on the created object
101 virtual StatusCode i_processObj(DataObject* pObject,
102 IOpaqueAddress* address);
103
104 // Might want to verify that instrument, calType are correct,
105 // for example. If so, might as well provide the service in
106 // the base converter.
107 virtual StatusCode readHeader(const DOMElement*);
108
109
110 /// Find first range element. Derived classes which need it
111 /// must define their own implementation.
112 DOMElement* findFirstRange(const DOMElement* docElt) {
113 return 0;}
114
115
116 /// Still another one to navigate XML file and find next set of range data
117 DOMElement* findNextRange(const DOMElement* rangeElt) {
118 return 0;}
119
120 /// Another one to find first dac collection element
121 DOMElement* findFirstDacCol(const DOMElement* docElt);
122
123 /// Still another one to navigate XML file and find next dac collection
124 DOMElement* findNextDacCol(const DOMElement* rangeElt);
125
126 CalibData::DacCol* processDacCol(DOMElement* dacColElt, unsigned* range);
127
128 // maqm comment
129 //DOMElement* findXpos(const DOMElement* docElt);
130
131 // maqm comment CalibData::Xpos* processXpos(DOMElement* xposElt);
132
133 /// Read in what will become a CalibData::ValSig
134 CalibData::ValSig* processValSig(DOMElement* elt,
135 std::string valName, std::string sigName);
136
137 /// Read in what will become a vector of CalibData::ValSig
138 std::vector<CalibData::ValSig>* processValSigs(DOMElement* elt,
139 std::string valName,
140 std::string sigName);
141
142 /// Another convenience for derived classes: sets information belonging
143 /// to the calibration base class, namely validity interval and serial
144 /// number.
146
149
151 ITime* m_vstart;
152 ITime* m_vend;
153
154
155};
156
157#endif
ICalibMetaCnvSvc * m_metaSvc
Definition: XmlBaseCnv.h:148
CalibData::ValSig * processValSig(DOMElement *elt, std::string valName, std::string sigName)
Read in what will become a CalibData::ValSig.
Definition: XmlBaseCnv.cxx:288
ICalibXmlSvc * m_xmlSvc
Definition: XmlBaseCnv.h:147
ICalibXmlSvc * getCalibXmlSvc()
Definition: XmlBaseCnv.h:54
std::vector< CalibData::ValSig > * processValSigs(DOMElement *elt, std::string valName, std::string sigName)
Read in what will become a vector of CalibData::ValSig.
Definition: XmlBaseCnv.cxx:299
virtual StatusCode readHeader(const DOMElement *)
Definition: XmlBaseCnv.cxx:220
DOMElement * findNextRange(const DOMElement *rangeElt)
Still another one to navigate XML file and find next set of range data.
Definition: XmlBaseCnv.h:117
ITime * m_vend
Definition: XmlBaseCnv.h:152
virtual ~XmlBaseCnv()
Definition: XmlBaseCnv.cxx:40
virtual StatusCode initialize()
Definition: XmlBaseCnv.cxx:50
void setBaseInfo(CalibData::CalibBase *pObj)
Another utility for derived classes to use.
Definition: XmlBaseCnv.cxx:232
static const unsigned char storageType()
Definition: XmlBaseCnv.cxx:224
CalibData::DacCol * processDacCol(DOMElement *dacColElt, unsigned *range)
Definition: XmlBaseCnv.cxx:248
virtual StatusCode i_processObj(DataObject *pObject, IOpaqueAddress *address)
In case there is additional work to do on the created object.
Definition: XmlBaseCnv.cxx:198
DOMElement * findNextDacCol(const DOMElement *rangeElt)
Still another one to navigate XML file and find next dac collection.
Definition: XmlBaseCnv.cxx:242
DOMElement * findFirstRange(const DOMElement *docElt)
Definition: XmlBaseCnv.h:112
DOMElement * findFirstDacCol(const DOMElement *docElt)
Another one to find first dac collection element.
Definition: XmlBaseCnv.cxx:238
virtual StatusCode internalCreateObj(const DOMElement *element, DataObject *&refpObject, IOpaqueAddress *address)
Definition: XmlBaseCnv.cxx:141
ITime * m_vstart
Definition: XmlBaseCnv.h:151
virtual StatusCode finalize()
Definition: XmlBaseCnv.cxx:78
virtual StatusCode createObj(IOpaqueAddress *addr, DataObject *&refpObject)
Definition: XmlBaseCnv.cxx:84
virtual StatusCode i_createObj(const DOMElement *element, DataObject *&refpObject)
Definition: XmlBaseCnv.cxx:205