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