Converter Class Reference

Converter base class. More...

#include <GaudiKernel/Converter.h>

Inheritance diagram for Converter:
Collaboration diagram for Converter:

Public Types

typedef Gaudi::PluginService::Factory< IConverter *, ISvcLocator * > Factory
 
- Public Types inherited from implements< IConverter >
using base_class = implements< Interfaces...>
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces...>
 Typedef to the base of this class. More...
 
using iids = typename extend_interfaces_base::ext_iids
 
- Public Types inherited from extend_interfaces< Interfaces...>
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type
 take union of the ext_iids of all Interfaces... More...
 

Public Member Functions

StatusCode initialize () override
 Initialize the converter. More...
 
StatusCode finalize () override
 Initialize the converter. More...
 
StatusCode setDataProvider (IDataProviderSvc *svc) override
 Set Data provider service. More...
 
SmartIF< IDataProviderSvc > & dataProvider () const override
 Get Data provider service. More...
 
StatusCode setConversionSvc (IConversionSvc *svc) override
 Set conversion service the converter is connected to. More...
 
SmartIF< IConversionSvc > & conversionSvc () const override
 Get conversion service the converter is connected to. More...
 
StatusCode setAddressCreator (IAddressCreator *creator) override
 Set address creator facility. More...
 
SmartIF< IAddressCreator > & addressCreator () const override
 Retrieve address creator facility. More...
 
const CLIDobjType () const override
 Retrieve the class type of objects the converter produces. More...
 
virtual long i_repSvcType () const
 Retrieve the class type of the data store the converter uses. More...
 
StatusCode createObj (IOpaqueAddress *pAddress, DataObject *&refpObject) override
 Create the transient representation of an object. More...
 
StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
 Resolve the references of the created transient object. More...
 
StatusCode updateObj (IOpaqueAddress *pAddress, DataObject *refpObject) override
 Update the transient object from the other representation. More...
 
StatusCode updateObjRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
 Update the references of an updated transient object. More...
 
StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress) override
 Convert the transient object to the requested representation. More...
 
StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
 Resolve the references of the converted object. More...
 
StatusCode updateRep (IOpaqueAddress *pAddress, DataObject *pObject) override
 Update the converted representation of a transient object. More...
 
StatusCode updateRepRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
 Update the references of an already converted object. More...
 
 Converter (long storage_type, const CLID &class_type, ISvcLocator *svc=0)
 Standard Constructor. More...
 
template<class T >
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. More...
 
template<class T >
StatusCode service (const std::string &type, const std::string &name, T *&psvc) const
 Access a service by name, type creating it if it doesn't already exist. More...
 
SmartIF< IServiceservice (const std::string &name, const bool createIf=true) const
 Return a pointer to the service identified by name (or "type/name") More...
 
- Public Member Functions inherited from implements< IConverter >
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::stringgetInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 implements ()=default
 Default constructor. More...
 
 implements (const implements &)
 Copy constructor (zero the reference count) More...
 
implementsoperator= (const implements &)
 Assignment operator (do not touch the reference count). More...
 
 ~implements () override=default
 Virtual destructor. More...
 
unsigned long addRef () override
 Reference Interface instance. More...
 
unsigned long release () override
 Release Interface instance. More...
 
unsigned long refCount () const override
 Current reference count. More...
 
- Public Member Functions inherited from extend_interfaces< Interfaces...>
 ~extend_interfaces () override=default
 Virtual destructor. More...
 

Protected Member Functions

 ~Converter () override=default
 Standard Destructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const
 Retrieve pointer to service locator. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 Retrieve pointer to message service. More...
 
SmartIF< IMessageSvc > & messageService () const
 
SmartIF< IDataManagerSvc > & dataManager () const
 Get Data Manager service. More...
 

Private Member Functions

StatusCode service_i (const std::string &svcName, bool createIf, const InterfaceID &iid, void **ppSvc) const
 implementation of service method More...
 
StatusCode service_i (const std::string &svcType, const std::string &svcName, const InterfaceID &iid, void **ppSvc) const
 

Private Attributes

long m_storageType
 Storage type. More...
 
const CLID m_classType
 Class type the converter can handle. More...
 
SmartIF< IAddressCreatorm_addressCreator
 Pointer to the address creation service interface. More...
 
SmartIF< IDataProviderSvcm_dataProvider
 Pointer to data provider service. More...
 
SmartIF< IDataManagerSvcm_dataManager
 Pointer to data manager service. More...
 
SmartIF< IConversionSvcm_conversionSvc
 Pointer to the connected conversion service. More...
 
SmartIF< ISvcLocatorm_svcLocator
 Service Locator reference. More...
 
SmartIF< IMessageSvcm_messageSvc
 MessageSvc reference. More...
 

Additional Inherited Members

- Protected Attributes inherited from implements< IConverter >
std::atomic_ulong m_refCount
 Reference counter. More...
 

Detailed Description

Converter base class.

See interface for detailed description, arguments and return values

Author
Markus Frank
Version
1.0

Definition at line 24 of file Converter.h.

Member Typedef Documentation

Constructor & Destructor Documentation

Converter::Converter ( long  storage_type,
const CLID class_type,
ISvcLocator svc = 0 
)

Standard Constructor.

Definition at line 145 of file Converter.cpp.

145  :
146  m_storageType(storage_type),
147  m_classType(class_type),
148  m_svcLocator(svc)
149 {
150 }
SmartIF< ISvcLocator > m_svcLocator
Service Locator reference.
Definition: Converter.h:133
long m_storageType
Storage type.
Definition: Converter.h:121
const CLID m_classType
Class type the converter can handle.
Definition: Converter.h:123
Converter::~Converter ( )
overrideprotecteddefault

Standard Destructor.

Member Function Documentation

SmartIF< IAddressCreator > & Converter::addressCreator ( ) const
override

Retrieve address creator facility.

Access the transient store.

Definition at line 119 of file Converter.cpp.

119  {
120  return m_addressCreator;
121 }
SmartIF< IAddressCreator > m_addressCreator
Pointer to the address creation service interface.
Definition: Converter.h:125
SmartIF< IConversionSvc > & Converter::conversionSvc ( ) const
override

Get conversion service the converter is connected to.

Get data conversion service the converter is connected to.

Definition at line 108 of file Converter.cpp.

108  {
109  return m_conversionSvc;
110 }
SmartIF< IConversionSvc > m_conversionSvc
Pointer to the connected conversion service.
Definition: Converter.h:131
StatusCode Converter::createObj ( IOpaqueAddress pAddress,
DataObject *&  refpObject 
)
override

Create the transient representation of an object.

Definition at line 24 of file Converter.cpp.

24  {
25  return StatusCode::SUCCESS;
26 }
StatusCode Converter::createRep ( DataObject pObject,
IOpaqueAddress *&  refpAddress 
)
override

Convert the transient object to the requested representation.

Definition at line 45 of file Converter.cpp.

45  {
46  return StatusCode::SUCCESS;
47 }
SmartIF< IDataManagerSvc > & Converter::dataManager ( ) const
protected

Get Data Manager service.

Get data manager service.

Definition at line 97 of file Converter.cpp.

97  {
98  return m_dataManager;
99 }
SmartIF< IDataManagerSvc > m_dataManager
Pointer to data manager service.
Definition: Converter.h:129
SmartIF< IDataProviderSvc > & Converter::dataProvider ( ) const
override

Get Data provider service.

Get data provider service.

Definition at line 92 of file Converter.cpp.

92  {
93  return m_dataProvider;
94 }
SmartIF< IDataProviderSvc > m_dataProvider
Pointer to data provider service.
Definition: Converter.h:127
StatusCode Converter::fillObjRefs ( IOpaqueAddress pAddress,
DataObject pObject 
)
override

Resolve the references of the created transient object.

Definition at line 30 of file Converter.cpp.

30  {
31  return StatusCode::SUCCESS;
32 }
StatusCode Converter::fillRepRefs ( IOpaqueAddress pAddress,
DataObject pObject 
)
override

Resolve the references of the converted object.

Definition at line 50 of file Converter.cpp.

50  {
51  return StatusCode::SUCCESS;
52 }
StatusCode Converter::finalize ( )
override

Initialize the converter.

Finalize the converter.

Definition at line 74 of file Converter.cpp.

74  {
75  // release services
76  m_messageSvc = nullptr;
77  m_dataManager = nullptr;
78  m_dataProvider = nullptr;
79  m_conversionSvc = nullptr;
80  m_addressCreator = nullptr;
81  return StatusCode::SUCCESS;
82 }
SmartIF< IAddressCreator > m_addressCreator
Pointer to the address creation service interface.
Definition: Converter.h:125
SmartIF< IDataManagerSvc > m_dataManager
Pointer to data manager service.
Definition: Converter.h:129
SmartIF< IMessageSvc > m_messageSvc
MessageSvc reference.
Definition: Converter.h:135
SmartIF< IConversionSvc > m_conversionSvc
Pointer to the connected conversion service.
Definition: Converter.h:131
SmartIF< IDataProviderSvc > m_dataProvider
Pointer to data provider service.
Definition: Converter.h:127
long Converter::i_repSvcType ( ) const
virtual

Retrieve the class type of the data store the converter uses.

Definition at line 19 of file Converter.cpp.

19  {
20  return m_storageType;
21 }
long m_storageType
Storage type.
Definition: Converter.h:121
StatusCode Converter::initialize ( )
override

Initialize the converter.

Definition at line 65 of file Converter.cpp.

65  {
66  // Get a reference to the Message Service
67  if ( !msgSvc() ) {
68  return StatusCode::FAILURE;
69  }
70  return StatusCode::SUCCESS;
71 }
SmartIF< IMessageSvc > & msgSvc() const
Retrieve pointer to message service.
Definition: Converter.cpp:129
SmartIF< IMessageSvc > & Converter::messageService ( ) const
protected

Definition at line 140 of file Converter.cpp.

140  {
141  return msgSvc();
142 }
SmartIF< IMessageSvc > & msgSvc() const
Retrieve pointer to message service.
Definition: Converter.cpp:129
SmartIF< IMessageSvc > & Converter::msgSvc ( ) const
protected

Retrieve pointer to message service.

— Retrieve pointer to message service

Definition at line 129 of file Converter.cpp.

129  {
130  if ( !m_messageSvc ) {
132  if( !m_messageSvc ) {
133  throw GaudiException("Service [MessageSvc] not found", "Converter", StatusCode::FAILURE);
134  }
135  }
136  return m_messageSvc;
137 }
Define general base for Gaudi exception.
SmartIF< IMessageSvc > m_messageSvc
MessageSvc reference.
Definition: Converter.h:135
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Converter.cpp:124
const CLID & Converter::objType ( ) const
override

Retrieve the class type of objects the converter produces.

Definition at line 14 of file Converter.cpp.

14  {
15  return m_classType;
16 }
const CLID m_classType
Class type the converter can handle.
Definition: Converter.h:123
template<class T >
StatusCode Converter::service ( const std::string name,
T *&  psvc,
bool  createIf = false 
) const
inline

Access a service by name, creating it if it doesn't already exist.

Definition at line 91 of file Converter.h.

91  {
92  return service_i(name, createIf, T::interfaceID(), (void**)&psvc);
93  }
StatusCode service_i(const std::string &svcName, bool createIf, const InterfaceID &iid, void **ppSvc) const
implementation of service method
Definition: Converter.cpp:153
template<class T >
StatusCode Converter::service ( const std::string type,
const std::string name,
T *&  psvc 
) const
inline

Access a service by name, type creating it if it doesn't already exist.

Definition at line 97 of file Converter.h.

97  {
98  return service_i(type, name, T::interfaceID(), (void**)&psvc);
99  }
StatusCode service_i(const std::string &svcName, bool createIf, const InterfaceID &iid, void **ppSvc) const
implementation of service method
Definition: Converter.cpp:153
SmartIF< IService > Converter::service ( const std::string name,
const bool  createIf = true 
) const

Return a pointer to the service identified by name (or "type/name")

Definition at line 176 of file Converter.cpp.

176  {
178  SmartIF<IService> svc;
179  if (cnvsvc) {
180  const ServiceLocatorHelper helper(*serviceLocator(), "Converter", cnvsvc->name());
181  svc = helper.service(name, false, createIf);
182  }
183  return svc;
184 }
an helper to share the implementation of service() among the various kernel base classes ...
SmartIF< IConversionSvc > & conversionSvc() const override
Get conversion service the converter is connected to.
Definition: Converter.cpp:108
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Converter.cpp:124
StatusCode Converter::service_i ( const std::string svcName,
bool  createIf,
const InterfaceID iid,
void **  ppSvc 
) const
private

implementation of service method

Definition at line 153 of file Converter.cpp.

154  {
155  // Check for name of conversion service
157  if (cnvsvc) {
158  const ServiceLocatorHelper helper(*serviceLocator(), "Converter", cnvsvc->name());
159  return helper.getService(svcName, createIf, iid, ppSvc);
160  }
161  return StatusCode::FAILURE;
162 }
an helper to share the implementation of service() among the various kernel base classes ...
SmartIF< IConversionSvc > & conversionSvc() const override
Get conversion service the converter is connected to.
Definition: Converter.cpp:108
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Converter.cpp:124
StatusCode getService(const std::string &name, bool createIf, const InterfaceID &iid, void **ppSvc) const
StatusCode Converter::service_i ( const std::string svcType,
const std::string svcName,
const InterfaceID iid,
void **  ppSvc 
) const
private

Definition at line 165 of file Converter.cpp.

166  {
167  // Check for name of conversion service
169  if (cnvsvc) {
170  const ServiceLocatorHelper helper(*serviceLocator(), "Converter", cnvsvc->name());
171  return helper.createService(svcType, svcName, iid, ppSvc);
172  }
173  return StatusCode::FAILURE;
174 }
an helper to share the implementation of service() among the various kernel base classes ...
SmartIF< IConversionSvc > & conversionSvc() const override
Get conversion service the converter is connected to.
Definition: Converter.cpp:108
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Converter.cpp:124
StatusCode createService(const std::string &name, const InterfaceID &iid, void **ppSvc) const
SmartIF< ISvcLocator > & Converter::serviceLocator ( ) const
protected

Retrieve pointer to service locator.

— Retrieve pointer to service locator

Definition at line 124 of file Converter.cpp.

124  {
125  return m_svcLocator;
126 }
SmartIF< ISvcLocator > m_svcLocator
Service Locator reference.
Definition: Converter.h:133
StatusCode Converter::setAddressCreator ( IAddressCreator creator)
override

Set address creator facility.

Definition at line 113 of file Converter.cpp.

113  {
114  m_addressCreator = creator;
115  return StatusCode::SUCCESS;
116 }
SmartIF< IAddressCreator > m_addressCreator
Pointer to the address creation service interface.
Definition: Converter.h:125
StatusCode Converter::setConversionSvc ( IConversionSvc svc)
override

Set conversion service the converter is connected to.

Definition at line 102 of file Converter.cpp.

102  {
103  m_conversionSvc = svc;
104  return StatusCode::SUCCESS;
105 }
SmartIF< IConversionSvc > m_conversionSvc
Pointer to the connected conversion service.
Definition: Converter.h:131
StatusCode Converter::setDataProvider ( IDataProviderSvc svc)
override

Set Data provider service.

Set data provider service.

Definition at line 85 of file Converter.cpp.

85  {
86  m_dataProvider = svc;
87  m_dataManager = svc;
88  return StatusCode::SUCCESS;
89 }
SmartIF< IDataManagerSvc > m_dataManager
Pointer to data manager service.
Definition: Converter.h:129
SmartIF< IDataProviderSvc > m_dataProvider
Pointer to data provider service.
Definition: Converter.h:127
StatusCode Converter::updateObj ( IOpaqueAddress pAddress,
DataObject refpObject 
)
override

Update the transient object from the other representation.

Definition at line 35 of file Converter.cpp.

35  {
36  return StatusCode::SUCCESS;
37 }
StatusCode Converter::updateObjRefs ( IOpaqueAddress pAddress,
DataObject pObject 
)
override

Update the references of an updated transient object.

Definition at line 40 of file Converter.cpp.

40  {
41  return StatusCode::SUCCESS;
42 }
StatusCode Converter::updateRep ( IOpaqueAddress pAddress,
DataObject pObject 
)
override

Update the converted representation of a transient object.

Definition at line 55 of file Converter.cpp.

55  {
56  return StatusCode::SUCCESS;
57 }
StatusCode Converter::updateRepRefs ( IOpaqueAddress pAddress,
DataObject pObject 
)
override

Update the references of an already converted object.

Definition at line 60 of file Converter.cpp.

60  {
61  return StatusCode::SUCCESS;
62 }

Member Data Documentation

SmartIF<IAddressCreator> Converter::m_addressCreator
mutableprivate

Pointer to the address creation service interface.

Definition at line 125 of file Converter.h.

const CLID Converter::m_classType
private

Class type the converter can handle.

Definition at line 123 of file Converter.h.

SmartIF<IConversionSvc> Converter::m_conversionSvc
mutableprivate

Pointer to the connected conversion service.

Definition at line 131 of file Converter.h.

SmartIF<IDataManagerSvc> Converter::m_dataManager
mutableprivate

Pointer to data manager service.

Definition at line 129 of file Converter.h.

SmartIF<IDataProviderSvc> Converter::m_dataProvider
mutableprivate

Pointer to data provider service.

Definition at line 127 of file Converter.h.

SmartIF<IMessageSvc> Converter::m_messageSvc
mutableprivate

MessageSvc reference.

Definition at line 135 of file Converter.h.

long Converter::m_storageType
private

Storage type.

Definition at line 121 of file Converter.h.

SmartIF<ISvcLocator> Converter::m_svcLocator
mutableprivate

Service Locator reference.

Definition at line 133 of file Converter.h.


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