The Gaudi Framework  v29r0 (ff2e7097)
Converter.cpp
Go to the documentation of this file.
1 // Include Files
12 
14 const CLID& Converter::objType() const { return m_classType; }
15 
17 long Converter::i_repSvcType() const { return m_storageType; }
18 
21 
24 
27 
30 
33 
36 
39 
42 
45 {
46  // Get a reference to the Message Service
47  if ( !msgSvc() ) {
48  return StatusCode::FAILURE;
49  }
50  return StatusCode::SUCCESS;
51 }
52 
55 {
56  // release services
57  m_messageSvc = nullptr;
58  m_dataManager = nullptr;
59  m_dataProvider = nullptr;
60  m_conversionSvc = nullptr;
61  m_addressCreator = nullptr;
62  return StatusCode::SUCCESS;
63 }
64 
67 {
68  m_dataProvider = svc;
69  m_dataManager = svc;
70  return StatusCode::SUCCESS;
71 }
72 
75 
78 
81 {
82  m_conversionSvc = svc;
83  return StatusCode::SUCCESS;
84 }
85 
88 
91 {
92  m_addressCreator = creator;
93  return StatusCode::SUCCESS;
94 }
95 
98 
101 
104 {
105  if ( !m_messageSvc ) {
107  if ( !m_messageSvc ) {
108  throw GaudiException( "Service [MessageSvc] not found", "Converter", StatusCode::FAILURE );
109  }
110  }
111  return m_messageSvc;
112 }
113 
115 Converter::Converter( long storage_type, const CLID& class_type, ISvcLocator* svc )
116  : m_storageType( storage_type ), m_classType( class_type ), m_svcLocator( svc )
117 {
118 }
119 
120 StatusCode Converter::service_i( const std::string& svcName, bool createIf, const InterfaceID& iid, void** ppSvc ) const
121 {
122  // Check for name of conversion service
124  if ( cnvsvc ) {
125  const ServiceLocatorHelper helper( *serviceLocator(), "Converter", cnvsvc->name() );
126  return helper.getService( svcName, createIf, iid, ppSvc );
127  }
128  return StatusCode::FAILURE;
129 }
130 
131 StatusCode Converter::service_i( const std::string& svcType, const std::string& svcName, const InterfaceID& iid,
132  void** ppSvc ) const
133 {
134  // Check for name of conversion service
136  if ( cnvsvc ) {
137  const ServiceLocatorHelper helper( *serviceLocator(), "Converter", cnvsvc->name() );
138  return helper.createService( svcType, svcName, iid, ppSvc );
139  }
140  return StatusCode::FAILURE;
141 }
142 
143 SmartIF<IService> Converter::service( const std::string& name, const bool createIf ) const
144 {
146  SmartIF<IService> svc;
147  if ( cnvsvc ) {
148  const ServiceLocatorHelper helper( *serviceLocator(), "Converter", cnvsvc->name() );
149  svc = helper.service( name, false, createIf );
150  }
151  return svc;
152 }
SmartIF< IAddressCreator > m_addressCreator
Pointer to the address creation service interface.
Definition: Converter.h:123
SmartIF< ISvcLocator > m_svcLocator
Service Locator reference.
Definition: Converter.h:131
an helper to share the implementation of service() among the various kernel base classes ...
Converter(long storage_type, const CLID &class_type, ISvcLocator *svc=0)
Standard Constructor.
Definition: Converter.cpp:115
Define general base for Gaudi exception.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
const CLID & objType() const override
Retrieve the class type of objects the converter produces.
Definition: Converter.cpp:14
StatusCode setConversionSvc(IConversionSvc *svc) override
Set conversion service the converter is connected to.
Definition: Converter.cpp:80
SmartIF< IDataManagerSvc > m_dataManager
Pointer to data manager service.
Definition: Converter.h:127
StatusCode initialize() override
Initialize the converter.
Definition: Converter.cpp:44
IAddressCreator interface definition.
SmartIF< IMessageSvc > & msgSvc() const
Retrieve pointer to message service.
Definition: Converter.cpp:103
StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Update the references of an already converted object.
Definition: Converter.cpp:41
SmartIF< IMessageSvc > m_messageSvc
MessageSvc reference.
Definition: Converter.h:133
StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject) override
Create the transient representation of an object.
Definition: Converter.cpp:20
SmartIF< IConversionSvc > & conversionSvc() const override
Get conversion service the converter is connected to.
Definition: Converter.cpp:87
Data provider interface definition.
STL class.
SmartIF< IConversionSvc > m_conversionSvc
Pointer to the connected conversion service.
Definition: Converter.h:129
StatusCode finalize() override
Initialize the converter.
Definition: Converter.cpp:54
Interface ID class.
Definition: IInterface.h:29
StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject) override
Update the converted representation of a transient object.
Definition: Converter.cpp:38
long m_storageType
Storage type.
Definition: Converter.h:119
StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Resolve the references of the created transient object.
Definition: Converter.cpp:23
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
StatusCode service(const std::string &name, T *&psvc, bool createIf=false) const
Access a service by name, creating it if it doesn&#39;t already exist.
Definition: Converter.h:91
StatusCode service_i(const std::string &svcName, bool createIf, const InterfaceID &iid, void **ppSvc) const
implementation of service method
Definition: Converter.cpp:120
const CLID m_classType
Class type the converter can handle.
Definition: Converter.h:121
StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress) override
Convert the transient object to the requested representation.
Definition: Converter.cpp:32
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Update the references of an updated transient object.
Definition: Converter.cpp:29
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Converter.cpp:100
StatusCode setAddressCreator(IAddressCreator *creator) override
Set address creator facility.
Definition: Converter.cpp:90
SmartIF< IDataProviderSvc > & dataProvider() const override
Get Data provider service.
Definition: Converter.cpp:74
virtual long i_repSvcType() const
Retrieve the class type of the data store the converter uses.
Definition: Converter.cpp:17
SmartIF< IAddressCreator > & addressCreator() const override
Retrieve address creator facility.
Definition: Converter.cpp:97
SmartIF< IDataManagerSvc > & dataManager() const
Get Data Manager service.
Definition: Converter.cpp:77
StatusCode setDataProvider(IDataProviderSvc *svc) override
Set Data provider service.
Definition: Converter.cpp:66
Opaque address interface definition.
StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Resolve the references of the converted object.
Definition: Converter.cpp:35
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
StatusCode getService(const std::string &name, bool createIf, const InterfaceID &iid, void **ppSvc) const
virtual const std::string & name() const =0
Retrieve the name of the instance.
SmartIF< IDataProviderSvc > m_dataProvider
Pointer to data provider service.
Definition: Converter.h:125
StatusCode createService(const std::string &name, const InterfaceID &iid, void **ppSvc) const
StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject) override
Update the transient object from the other representation.
Definition: Converter.cpp:26