BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
CalibXmlCnvSvc Class Reference

#include <CalibXmlCnvSvc.h>

+ Inheritance diagram for CalibXmlCnvSvc:

Public Member Functions

virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
virtual StatusCode createAddress (unsigned char svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
 
virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * parse (const char *filename)
 
virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * parse (const char *filename)=0
 

Protected Member Functions

 CalibXmlCnvSvc (const std::string &name, ISvcLocator *svc)
 
virtual ~CalibXmlCnvSvc ()
 

Friends

class SvcFactory< CalibXmlCnvSvc >
 Only factories can access protected constructors.
 

Additional Inherited Members

- Static Public Member Functions inherited from ICalibXmlSvc
static const InterfaceID & interfaceID ()
 

Detailed Description


A conversion service for GLAST calibration bulk data in Xml format.

Author
J. Bogart
Date
November 2002

Definition at line 31 of file CalibXmlCnvSvc.h.

Constructor & Destructor Documentation

◆ CalibXmlCnvSvc()

CalibXmlCnvSvc::CalibXmlCnvSvc ( const std::string &  name,
ISvcLocator *  svc 
)
protected

Definition at line 23 of file CalibXmlCnvSvc.cxx.

24 :
25 ConversionSvc(name, svc, XML_StorageType),
26 m_detPersSvc(0), m_detDataSvc(0), m_parser(0) {
27
28 // Some day might have a property to declare having to do with path to
29 // xml files.
30}

◆ ~CalibXmlCnvSvc()

virtual CalibXmlCnvSvc::~CalibXmlCnvSvc ( )
inlineprotectedvirtual

Definition at line 39 of file CalibXmlCnvSvc.h.

39{}

Member Function Documentation

◆ createAddress()

StatusCode CalibXmlCnvSvc::createAddress ( unsigned char  svc_type,
const CLID &  clid,
const std::string *  par,
const unsigned long *  ip,
IOpaqueAddress *&  refpAddress 
)
virtual

Create an XML address using explicit arguments to identify a single object

Parameters
svc_typethe service type
CLIDthe CLID of the XML Element for which an address is created
paran array of three strings containing the format version, calibration type name and the flavor, in this order
iphas a single element, the serial number of the MySQL row which corresponds to this element
refpAddressthe new address created
Returns
a StatusCode giving the status of the address creation

Definition at line 134 of file CalibXmlCnvSvc.cxx.

138 {
139
140 MsgStream log( msgSvc(), name() );
141
142 if (svc_type != XML_StorageType) {
143 log << MSG::ERROR << "bad storage type" << (int)svc_type << endreq;
144 return StatusCode::FAILURE;
145 }
146
147 std::string dataIdent(par[0]); // file identifier for PDS version of data
148 std::string fullpath(par[1]); // path within TCDS for the object
149 std::string fmtVersion(par[2]);
150 int serNo = ip[0];
151
152 // for now have to ignore fmtVersion because of defective implementation
153 // of GenericAddress. If we want it, should probably write new
154 // opaque address implementation for this package to use. All
155 // dealings with (calibration) opaque addresses are confined to
156 // the CalibSvc package.
157 refpAddress = new GenericAddress(XML_StorageType,
158 clid,
159 dataIdent,
160 fullpath,
161 serNo);
162
163 return StatusCode::SUCCESS;
164
165}
IMessageSvc * msgSvc()

◆ finalize()

StatusCode CalibXmlCnvSvc::finalize ( )
virtual

Definition at line 128 of file CalibXmlCnvSvc.cxx.

128 {
129 delete m_parser;
130 m_parser = 0;
131 return ConversionSvc::finalize();
132}

◆ initialize()

StatusCode CalibXmlCnvSvc::initialize ( )
virtual

Definition at line 45 of file CalibXmlCnvSvc.cxx.

45 {
46 StatusCode sc = ConversionSvc::initialize();
47
48 MsgStream log(msgSvc(), "CalibXmlCnvSvc");
49
50 if (!sc.isSuccess()) return sc;
51
52 /* Paste in a bit of CalibMySQLCnvSvc::initialize */
53
54 // Locate the Calib Data Service. Since it inherits from DataSvc
55 // it has to implement IDataProviderSvc
56 IDataProviderSvc* pCDS = 0;
57 //sc = serviceLocator()->getService("CalibDataSvc", IID_IDataProviderSvc, (IInterface*&)pCDS);
58 sc = serviceLocator()->getService("CalibDataSvc", IDataProviderSvc::interfaceID(), (IInterface*&)pCDS)
59;
60 if ( !sc.isSuccess() ) {
61 log << MSG::ERROR << "Could not locate CalibDataSvc" << endreq;
62 return sc;
63 }
64
65 // Set the CalibDataSvc as data provider service
66 sc = setDataProvider(pCDS);
67 if ( !sc.isSuccess() ) {
68 log << MSG::ERROR << "Could not set data provider" << endreq;
69 return sc;
70 }
71
72 /* End of pasted bit */
73
74
75 /* Paste in more of CalibMySQLCnvSvc::initialize */
76 // Locate IConversionSvc interface of the DetectorPersistencySvc
77 sc = serviceLocator()->service
78 ("DetectorPersistencySvc", m_detPersSvc, true);
79 if ( !sc.isSuccess() ) {
80 log << MSG::ERROR
81 << "Cannot locate IConversionSvc interface of DetectorPersistencySvc"
82 << endreq;
83 return sc;
84 } else {
85 log << MSG::DEBUG
86 << "Retrieved IConversionSvc interface of DetectorPersistencySvc"
87 << endreq;
88 }
89
90 // Query the IAddressCreator interface of the detector persistency service
91 IAddressCreator* iAddrCreator;
92 //sc = m_detPersSvc->queryInterface(IID_IAddressCreator,
93// (void**) &iAddrCreator);
94 sc = m_detPersSvc->queryInterface(IAddressCreator::interfaceID(), (void**) &iAddrCreator);
95 if ( !sc.isSuccess() ) {
96 log << MSG::ERROR
97 << "Cannot query IAddressCreator interface of DetectorPersistencySvc"
98 << endreq;
99 return sc;
100 } else {
101 log << MSG::DEBUG
102 << "Retrieved IAddressCreator interface of DetectorPersistencySvc"
103 << endreq;
104 }
105 log << MSG::DEBUG
106 << "Set it as the address creator of the CalibXmlCnvSvc" << endreq;
107 sc = setAddressCreator(iAddrCreator);
108 if ( !sc.isSuccess() ) {
109 log << MSG::ERROR << "Cannot set the address creator" << endreq;
110 return sc;
111 }
112
113 // end of second pasted piece
114
115
116 m_parser = new xmlBase::XmlParser();
117
118 if (m_parser == 0) {
119 log << MSG::FATAL << "Unable to create XML parser instance \n"
120 << endreq;
121 }
122
123 // set properties if there are any??
124
125 return sc;
126}

◆ parse()

XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * CalibXmlCnvSvc::parse ( const char *  filename)
virtual

This method parses an xml file and produces the corresponding DOM document.

Parameters
fileNamethe name of the file to parse
Returns
the document issued from the parsing

Implements ICalibXmlSvc.

Definition at line 171 of file CalibXmlCnvSvc.cxx.

171 {
172 return m_parser->parse(filename);
173}
DOMDocument * parse(const char *const filename, const std::string &docType=std::string(""))
Parse an xml file, returning document node if successful.
Definition: XmlParser.cxx:108

◆ queryInterface()

StatusCode CalibXmlCnvSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvInterface 
)
virtual

Definition at line 32 of file CalibXmlCnvSvc.cxx.

33 {
34 if (IID_ICalibXmlSvc.versionMatch(riid)) {
35 *ppvInterface = (ICalibXmlSvc*)this;
36 }
37 else {
38 // Interface is not directly availible: try out a base class
39 return ConversionSvc::queryInterface(riid, ppvInterface);
40 }
41 addRef();
42 return StatusCode::SUCCESS;
43}

Friends And Related Function Documentation

◆ SvcFactory< CalibXmlCnvSvc >

friend class SvcFactory< CalibXmlCnvSvc >
friend

Only factories can access protected constructors.

Definition at line 1 of file CalibXmlCnvSvc.h.


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