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

#include <CalibXmlCnvSvc.h>

Inheritance diagram for CalibXmlCnvSvc:

Public Member Functions

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)
Public Member Functions inherited from ICalibXmlSvc
 DeclareInterfaceID (ICalibXmlSvc, 1, 0)
 DeclareInterfaceID (ICalibXmlSvc, 1, 0)
 DeclareInterfaceID (ICalibXmlSvc, 1, 0)

Protected Member Functions

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

Friends

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

Detailed Description


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

Author
J. Bogart
Date
November 2002

Definition at line 33 of file CalibXmlCnvSvc.h.

Constructor & Destructor Documentation

◆ CalibXmlCnvSvc()

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

Definition at line 24 of file CalibXmlCnvSvc.cxx.

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

◆ ~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 136 of file CalibXmlCnvSvc.cxx.

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

◆ finalize()

StatusCode CalibXmlCnvSvc::finalize ( )
virtual

Definition at line 130 of file CalibXmlCnvSvc.cxx.

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

◆ initialize()

StatusCode CalibXmlCnvSvc::initialize ( )
virtual

Definition at line 47 of file CalibXmlCnvSvc.cxx.

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

◆ 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 163 of file CalibXmlCnvSvc.cxx.

163 {
164 return m_parser->parse( filename );
165}

◆ 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: