All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 implements1< IConverter >
typedef implements1 base_class
 Typedef to this class. More...
 
typedef extend_interfaces1
< IConverter
extend_interfaces_base
 Typedef to the base of this class. More...
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from extend_interfaces1< IConverter >
typedef IConverter::iid::iids::type ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IConverter
enum  Status {
  INVALID_ADDRESS = IInterface::LAST_ERROR+1, INVALID_OBJECT, NO_MEMORY, BAD_STORAGE_TYPE,
  NO_SOURCE_OBJECT, ICONVERSIONSVC_LAST_ERROR
}
 Status code. More...
 
- Public Types inherited from IInterface
enum  Status { SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR }
 Return status. More...
 
typedef Gaudi::InterfaceId
< IInterface, 0, 0 > 
iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 

Public Member Functions

virtual StatusCode initialize ()
 Initialize the converter. More...
 
virtual StatusCode finalize ()
 Initialize the converter. More...
 
virtual StatusCode setDataProvider (IDataProviderSvc *svc)
 Set Data provider service. More...
 
virtual SmartIF
< IDataProviderSvc > & 
dataProvider () const
 Get Data provider service. More...
 
virtual StatusCode setConversionSvc (IConversionSvc *svc)
 Set conversion service the converter is connected to. More...
 
virtual SmartIF< IConversionSvc > & conversionSvc () const
 Get conversion service the converter is connected to. More...
 
virtual StatusCode setAddressCreator (IAddressCreator *creator)
 Set address creator facility. More...
 
virtual SmartIF
< IAddressCreator > & 
addressCreator () const
 Retrieve address creator facility. More...
 
virtual const CLIDobjType () const
 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...
 
virtual StatusCode createObj (IOpaqueAddress *pAddress, DataObject *&refpObject)
 Create the transient representation of an object. More...
 
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the created transient object. More...
 
virtual StatusCode updateObj (IOpaqueAddress *pAddress, DataObject *refpObject)
 Update the transient object from the other representation. More...
 
virtual StatusCode updateObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Update the references of an updated transient object. More...
 
virtual StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
 Convert the transient object to the requested representation. More...
 
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object. More...
 
virtual StatusCode updateRep (IOpaqueAddress *pAddress, DataObject *pObject)
 Update the converted representation of a transient object. More...
 
virtual StatusCode updateRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 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 extend_interfaces1< IConverter >
virtual ~extend_interfaces1 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IConverter
 DeclareInterfaceID (IConverter, 3, 0)
 InterfaceID. More...
 
virtual long repSvcType () const =0
 Retrieve the class type of the data store the converter uses. More...
 
virtual ~IConverter ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IInterface
virtual void * i_cast (const InterfaceID &) const =0
 main cast function More...
 
virtual std::vector< std::string > getInterfaceNames () const =0
 Returns a vector of strings containing the names of all the implemented interfaces. More...
 
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long release ()=0
 Release Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)=0
 Set the void** to the pointer to the requested interface of the instance. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 

Protected Member Functions

virtual ~Converter ()
 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

- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. 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 147 of file Converter.cpp.

147  :
148  m_storageType(storage_type),
149  m_classType(class_type),
150  m_svcLocator(svc)
151 {
152 }
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 ( )
protectedvirtual

Standard Destructor.

Definition at line 155 of file Converter.cpp.

155  {
156 }

Member Function Documentation

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

Retrieve address creator facility.

Access the transient store.

Implements IConverter.

Definition at line 121 of file Converter.cpp.

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

Get conversion service the converter is connected to.

Get data conversion service the converter is connected to.

Implements IConverter.

Definition at line 110 of file Converter.cpp.

110  {
111  return m_conversionSvc;
112 }
SmartIF< IConversionSvc > m_conversionSvc
Pointer to the connected conversion service.
Definition: Converter.h:131
StatusCode Converter::createObj ( IOpaqueAddress pAddress,
DataObject *&  refpObject 
)
virtual
StatusCode Converter::createRep ( DataObject pObject,
IOpaqueAddress *&  refpAddress 
)
virtual

Convert the transient object to the requested representation.

Implements IConverter.

Reimplemented in Gaudi::RootDirectoryCnv, Gaudi::RootConverter, Gaudi::RootNTupleCnv, RootHistCnv::RConverter, RootHistCnv::RFileCnv, RootHistCnv::RNTupleCnv, RootHistCnv::RDirectoryCnv, and RootHistCnv::DirectoryCnv.

Definition at line 47 of file Converter.cpp.

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

Get Data Manager service.

Get data manager service.

Definition at line 99 of file Converter.cpp.

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

Get Data provider service.

Get data provider service.

Implements IConverter.

Definition at line 94 of file Converter.cpp.

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

Resolve the references of the created transient object.

Implements IConverter.

Reimplemented in Gaudi::RootNTupleCnv, Gaudi::RootConverter, Gaudi::RootDirectoryCnv, and RootHistCnv::RDirectoryCnv.

Definition at line 32 of file Converter.cpp.

32  {
33  return StatusCode::SUCCESS;
34 }
StatusCode Converter::fillRepRefs ( IOpaqueAddress pAddress,
DataObject pObject 
)
virtual

Resolve the references of the converted object.

Implements IConverter.

Reimplemented in Gaudi::RootDirectoryCnv, Gaudi::RootConverter, and Gaudi::RootNTupleCnv.

Definition at line 52 of file Converter.cpp.

52  {
53  return StatusCode::SUCCESS;
54 }
StatusCode Converter::finalize ( )
virtual

Initialize the converter.

Finalize the converter.

Implements IConverter.

Reimplemented in Gaudi::RootStatCnv, and RootHistCnv::RNTupleCnv.

Definition at line 76 of file Converter.cpp.

76  {
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 }
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 21 of file Converter.cpp.

21  {
22  return m_storageType;
23 }
long m_storageType
Storage type.
Definition: Converter.h:121
StatusCode Converter::initialize ( )
virtual

Initialize the converter.

Implements IConverter.

Reimplemented in Gaudi::RootStatCnv, RootHistCnv::RFileCnv, and RootHistCnv::RNTupleCnv.

Definition at line 67 of file Converter.cpp.

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

Definition at line 142 of file Converter.cpp.

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

Retrieve pointer to message service.

— Retrieve pointer to message service

Definition at line 131 of file Converter.cpp.

131  {
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 }
Define general base for Gaudi exception.
SmartIF< IMessageSvc > m_messageSvc
MessageSvc reference.
Definition: Converter.h:135
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Converter.cpp:126
const CLID & Converter::objType ( ) const
virtual

Retrieve the class type of objects the converter produces.

Implements IConverter.

Definition at line 16 of file Converter.cpp.

16  {
17  return m_classType;
18 }
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:159
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  }
string type
Definition: gaudirun.py:126
StatusCode service_i(const std::string &svcName, bool createIf, const InterfaceID &iid, void **ppSvc) const
implementation of service method
Definition: Converter.cpp:159
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 182 of file Converter.cpp.

182  {
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 }
an helper to share the implementation of service() among the various kernel base classes $Id: ...
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:14
virtual SmartIF< IConversionSvc > & conversionSvc() const
Get conversion service the converter is connected to.
Definition: Converter.cpp:110
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Converter.cpp:126
StatusCode Converter::service_i ( const std::string &  svcName,
bool  createIf,
const InterfaceID iid,
void **  ppSvc 
) const
private

implementation of service method

Definition at line 159 of file Converter.cpp.

160  {
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 }
an helper to share the implementation of service() among the various kernel base classes $Id: ...
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:14
virtual SmartIF< IConversionSvc > & conversionSvc() const
Get conversion service the converter is connected to.
Definition: Converter.cpp:110
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Converter.cpp:126
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 171 of file Converter.cpp.

172  {
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 }
an helper to share the implementation of service() among the various kernel base classes $Id: ...
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:14
virtual SmartIF< IConversionSvc > & conversionSvc() const
Get conversion service the converter is connected to.
Definition: Converter.cpp:110
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Converter.cpp:126
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 126 of file Converter.cpp.

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

Set address creator facility.

Implements IConverter.

Definition at line 115 of file Converter.cpp.

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

Set conversion service the converter is connected to.

Implements IConverter.

Definition at line 104 of file Converter.cpp.

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

Set Data provider service.

Set data provider service.

Implements IConverter.

Definition at line 87 of file Converter.cpp.

87  {
88  m_dataProvider = svc;
89  m_dataManager = svc;
90  return StatusCode::SUCCESS;
91 }
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 
)
virtual

Update the transient object from the other representation.

Implements IConverter.

Reimplemented in Gaudi::RootNTupleCnv, Gaudi::RootDirectoryCnv, RootHistCnv::RHistogramCnv< T, S, Q >, and RootHistCnv::RNTupleCnv.

Definition at line 37 of file Converter.cpp.

37  {
38  return StatusCode::SUCCESS;
39 }
StatusCode Converter::updateObjRefs ( IOpaqueAddress pAddress,
DataObject pObject 
)
virtual

Update the references of an updated transient object.

Implements IConverter.

Reimplemented in Gaudi::RootNTupleCnv, and Gaudi::RootDirectoryCnv.

Definition at line 42 of file Converter.cpp.

42  {
43  return StatusCode::SUCCESS;
44 }
StatusCode Converter::updateRep ( IOpaqueAddress pAddress,
DataObject pObject 
)
virtual

Update the converted representation of a transient object.

Implements IConverter.

Reimplemented in Gaudi::RootNTupleCnv, Gaudi::RootDirectoryCnv, RootHistCnv::RFileCnv, RootHistCnv::RNTupleCnv, and RootHistCnv::RDirectoryCnv.

Definition at line 57 of file Converter.cpp.

57  {
58  return StatusCode::SUCCESS;
59 }
StatusCode Converter::updateRepRefs ( IOpaqueAddress pAddress,
DataObject pObject 
)
virtual

Update the references of an already converted object.

Implements IConverter.

Reimplemented in Gaudi::RootNTupleCnv, and Gaudi::RootDirectoryCnv.

Definition at line 62 of file Converter.cpp.

62  {
63  return StatusCode::SUCCESS;
64 }

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: