1#include "GaudiKernel/SmartDataPtr.h"
2#include "GaudiKernel/SmartIF.h"
3#include "GaudiKernel/SvcFactory.h"
4#include "GaudiKernel/CnvFactory.h"
5#include "GaudiKernel/MsgStream.h"
7#include "GaudiKernel/ISvcLocator.h"
8#include "GaudiKernel/IDataProviderSvc.h"
9#include "GaudiKernel/IDataManagerSvc.h"
10#include "GaudiKernel/RegistryEntry.h"
11#include "GaudiKernel/GenericAddress.h"
13#include "RawDataCnvBase/RawDataBaseCnv.h"
14#include "RawDataCnvBase/RawDataCnvSvc.h"
15#include "EventModel/EventModel.h"
18static const InterfaceID IID_IRawDataCnvSvc(
"IRawDataCnvSvc", 1 , 0);
24: ConversionSvc(name, svc, storageType)
33 MsgStream log(messageService(), name());
36 StatusCode status = ConversionSvc::initialize();
37 if ( status.isSuccess() ) {
39 IDataProviderSvc *pIDP = 0;
41 status = service(
"EventDataSvc", pIDP,
true);
42 if ( status.isSuccess() ) {
43 status = setDataProvider ( pIDP );
51 if ( !status.isSuccess() ) {
52 log << MSG::ERROR <<
"Unable to add converters to the service" << endreq;
59 for (LeafMap::iterator k = m_leaves.begin(); k != m_leaves.end(); k++ ) {
60 std::string path = (*k).first;
61 for (LeafMap::iterator j = m_leaves.begin(); j != m_leaves.end(); j++ ) {
62 std::string pp = (*j).first.substr(0, (*j).first.rfind(
"/"));
63 if ( path == pp && path != (*j).first ) {
64 (*k).second->push_back((*j).second);
75 StatusCode status = ConversionSvc::finalize();
76 for (LeafMap::iterator k = m_leaves.begin(); k != m_leaves.end(); k++ ) {
79 m_leaves.erase(m_leaves.begin(), m_leaves.end());
87 std::pair<LeafMap::iterator, bool> p = m_leaves.insert(LeafMap::value_type( leaf.
path, ll) );
89 return StatusCode::SUCCESS;
92 return StatusCode::FAILURE;
99 MsgStream log(
msgSvc(), name());
101 StatusCode status = INVALID_ADDRESS;
102 IRegistry* ent = pAddress->registry();
105 SmartIF<IDataManagerSvc> iaddrReg( dataProvider());
107 status = StatusCode::SUCCESS;
108 std::string path = ent->identifier();
110 LeafMap::iterator itm = m_leaves.find(path);
111 if ( itm != m_leaves.end() ) {
115 for ( Leaf::iterator il = leaf->begin(); il != leaf->end(); il++ ) {
116 IOpaqueAddress* newAddr = 0;
117 unsigned long ipars[2] = {0, 0};
118 const std::string spars[2] = {
"",
""};
132 if ( ir.isSuccess() ) {
133 ir = iaddrReg->registerAddress((*il)->path, newAddr);
134 if ( !ir.isSuccess() ) {
144 status = NO_INTERFACE;
151 if ( IID_IRawDataCnvSvc == riid ) {
156 return ConversionSvc::queryInterface(riid, ppvInterface);
159 return StatusCode::SUCCESS;
165 const unsigned long*,
166 IOpaqueAddress*& refpAddress)
168 MsgStream log(
msgSvc(), name() );
170 if (storageType != repSvcType() ) {
171 log << MSG::ERROR <<
"bad storage type" << storageType << endreq;
172 return StatusCode::FAILURE;
175 refpAddress =
new GenericAddress(storageType,
181 return StatusCode::SUCCESS;
187 IOpaqueAddress*& refpAddress)
189 return createAddress(storageType, clid, NULL, NULL, refpAddress);
StatusCode updateServiceState(IOpaqueAddress *pAddress)
Update state of the service.
virtual StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
virtual StatusCode initialize()
virtual StatusCode finalize()
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvInterface)
Override inherited queryInterface due to enhanced interface.
virtual StatusCode addConverters()=0
virtual StatusCode declareObject(const IRawDataCnvSvc::Leaf &leaf)
Associates a path on TDS with a particular converter.
RawDataCnvSvc(const std::string &name, ISvcLocator *svc, long storageTyp)