All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Converter.cpp
Go to the documentation of this file.
1 // $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiKernel/src/Lib/Converter.cpp,v 1.17 2007/12/12 16:02:32 marcocle Exp $
2 
3 // Include Files
14 
16 const CLID& Converter::objType() const {
17  return m_classType;
18 }
19 
22  return m_storageType;
23 }
24 
27  return StatusCode::SUCCESS;
28 }
29 
30 
33  return StatusCode::SUCCESS;
34 }
35 
38  return StatusCode::SUCCESS;
39 }
40 
43  return StatusCode::SUCCESS;
44 }
45 
48  return StatusCode::SUCCESS;
49 }
50 
53  return StatusCode::SUCCESS;
54 }
55 
58  return StatusCode::SUCCESS;
59 }
60 
63  return StatusCode::SUCCESS;
64 }
65 
68  // Get a reference to the Message Service
69  if ( !msgSvc().isValid() ) {
70  return StatusCode::FAILURE;
71  }
72  return StatusCode::SUCCESS;
73 }
74 
77  // release services
78  m_messageSvc = 0;
79  m_dataManager = 0;
80  m_dataProvider = 0;
81  m_conversionSvc = 0;
82  m_addressCreator = 0;
83  return StatusCode::SUCCESS;
84 }
85 
88  m_dataProvider = svc;
89  m_dataManager = svc;
90  return StatusCode::SUCCESS;
91 }
92 
95  return m_dataProvider;
96 }
97 
100  return m_dataManager;
101 }
102 
105  m_conversionSvc = svc;
106  return StatusCode::SUCCESS;
107 }
108 
111  return m_conversionSvc;
112 }
113 
116  m_addressCreator = creator;
117  return StatusCode::SUCCESS;
118 }
119 
122  return m_addressCreator;
123 }
124 
127  return m_svcLocator;
128 }
129 
132  if ( !m_messageSvc.isValid() ) {
134  if( !m_messageSvc.isValid() ) {
135  throw GaudiException("Service [MessageSvc] not found", "Converter", StatusCode::FAILURE);
136  }
137  }
138  return m_messageSvc;
139 }
140 
141 // Obsoleted name, kept due to the backwards compatibility
143  return msgSvc();
144 }
145 
147 Converter::Converter(long storage_type, const CLID& class_type, ISvcLocator* svc) :
148  m_storageType(storage_type),
149  m_classType(class_type),
150  m_svcLocator(svc)
151 {
152 }
153 
156 }
157 
159 Converter::service_i(const std::string& svcName, bool createIf,
160  const InterfaceID& iid, void** ppSvc) const {
161  // Check for name of conversion service
163  if (cnvsvc.isValid()) {
164  const ServiceLocatorHelper helper(*serviceLocator(), "Converter", cnvsvc->name());
165  return helper.getService(svcName, createIf, iid, ppSvc);
166  }
167  return StatusCode::FAILURE;
168 }
169 
171 Converter::service_i(const std::string& svcType, const std::string& svcName,
172  const InterfaceID& iid, void** ppSvc) const {
173  // Check for name of conversion service
175  if (cnvsvc.isValid()) {
176  const ServiceLocatorHelper helper(*serviceLocator(), "Converter", cnvsvc->name());
177  return helper.createService(svcType, svcName, iid, ppSvc);
178  }
179  return StatusCode::FAILURE;
180 }
181 
182 SmartIF<IService> Converter::service(const std::string& name, const bool createIf) const {
184  SmartIF<IService> svc;
185  if (cnvsvc.isValid()) {
186  const ServiceLocatorHelper helper(*serviceLocator(), "Converter", cnvsvc->name());
187  svc = helper.service(name, false, createIf);
188  }
189  return svc;
190 }
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)
Create the transient representation of an object.
Definition: Converter.cpp:26
SmartIF< IAddressCreator > m_addressCreator
Pointer to the address creation service interface.
Definition: Converter.h:125
SmartIF< ISvcLocator > m_svcLocator
Service Locator reference.
Definition: Converter.h:133
an helper to share the implementation of service() among the various kernel base classes $Id: ...
Converter(long storage_type, const CLID &class_type, ISvcLocator *svc=0)
Standard Constructor.
Definition: Converter.cpp:147
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:26
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)
Resolve the references of the created transient object.
Definition: Converter.cpp:32
virtual StatusCode finalize()
Initialize the converter.
Definition: Converter.cpp:76
virtual SmartIF< IConversionSvc > & conversionSvc() const
Get conversion service the converter is connected to.
Definition: Converter.cpp:110
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
Definition: Converter.cpp:47
virtual StatusCode initialize()
Initialize the converter.
Definition: Converter.cpp:67
SmartIF< IDataManagerSvc > m_dataManager
Pointer to data manager service.
Definition: Converter.h:129
IAddressCreator interface definition.
SmartIF< IMessageSvc > & msgSvc() const
Retrieve pointer to message service.
Definition: Converter.cpp:131
SmartIF< IMessageSvc > m_messageSvc
MessageSvc reference.
Definition: Converter.h:135
virtual StatusCode setDataProvider(IDataProviderSvc *svc)
Set Data provider service.
Definition: Converter.cpp:87
virtual StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)
Update the references of an already converted object.
Definition: Converter.cpp:62
Data provider interface definition.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)
Resolve the references of the converted object.
Definition: Converter.cpp:52
SmartIF< IConversionSvc > m_conversionSvc
Pointer to the connected conversion service.
Definition: Converter.h:131
Gaudi::InterfaceId< IInterface, 0, 0 > iid
Interface ID.
Definition: IInterface.h:164
virtual ~Converter()
Standard Destructor.
Definition: Converter.cpp:155
Interface ID class.
Definition: IInterface.h:55
long m_storageType
Storage type.
Definition: Converter.h:121
virtual const CLID & objType() const
Retrieve the class type of objects the converter produces.
Definition: Converter.cpp:16
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)
Update the transient object from the other representation.
Definition: Converter.cpp:37
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
SmartIF< IMessageSvc > & messageService() const
Definition: Converter.cpp:142
StatusCode service(const std::string &name, T *&psvc, bool createIf=false) const
Access a service by name, creating it if it doesn'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:159
const CLID m_classType
Class type the converter can handle.
Definition: Converter.h:123
unsigned int CLID
Class ID definition.
Definition: ClassID.h:9
virtual SmartIF< IDataProviderSvc > & dataProvider() const
Get Data provider service.
Definition: Converter.cpp:94
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Converter.cpp:126
virtual long i_repSvcType() const
Retrieve the class type of the data store the converter uses.
Definition: Converter.cpp:21
SmartIF< IDataManagerSvc > & dataManager() const
Get Data Manager service.
Definition: Converter.cpp:99
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)
Update the references of an updated transient object.
Definition: Converter.cpp:42
virtual StatusCode setConversionSvc(IConversionSvc *svc)
Set conversion service the converter is connected to.
Definition: Converter.cpp:104
virtual StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject)
Update the converted representation of a transient object.
Definition: Converter.cpp:57
Opaque address interface definition.
virtual StatusCode setAddressCreator(IAddressCreator *creator)
Set address creator facility.
Definition: Converter.cpp:115
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:31
StatusCode getService(const std::string &name, bool createIf, const InterfaceID &iid, void **ppSvc) const
SmartIF< IDataProviderSvc > m_dataProvider
Pointer to data provider service.
Definition: Converter.h:127
StatusCode createService(const std::string &name, const InterfaceID &iid, void **ppSvc) const
virtual SmartIF< IAddressCreator > & addressCreator() const
Retrieve address creator facility.
Definition: Converter.cpp:121