| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
ConversionSvc Class Reference

Base class for all conversion services. More...

`#include <GaudiKernel/ConversionSvc.h>`

Inheritance diagram for ConversionSvc:
[legend]
Collaboration diagram for ConversionSvc:
[legend]

## Classes
class | CnvTest
class | WorkerEntry

## Public Member Functions
virtual StatusCode | initialize ()
| Initialize the service. More...
virtual StatusCode | finalize ()
| stop the service. More...
virtual long | repSvcType () const
| Retrieve the class type of the data store the converter uses. More...
const CLID & | objType () const
| Implementation of IConverter: dummy call. More...
virtual StatusCode | setDataProvider (IDataProviderSvc *pService)
| Implementation of IConverter: Set Data provider service. More...
virtual SmartIF< IDataProviderSvc > & | dataProvider () const
| Implementation of IConverter: Get Data provider service. More...
virtual StatusCode | setConversionSvc (IConversionSvc *svc)
| Implementation of IConverter: Set conversion service the converter is connected to. More...
virtual SmartIF< IConversionSvc > & | conversionSvc () const
| Implementation of IConverter: 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 StatusCode | createObj (IOpaqueAddress *pAddress, DataObject *&refpObject)
| Implementation of IConverter: Create the transient representation of an object. More...
virtual StatusCode | fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
| Implementation of IConverter: Resolve the references of the created transient object. More...
virtual StatusCode | updateObj (IOpaqueAddress *pAddress, DataObject *refpObject)
| Implementation of IConverter: Update the transient object from the other representation. More...
virtual StatusCode | updateObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
| Implementation of IConverter: Update the references of an updated transient object. More...
virtual StatusCode | createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
| Implementation of IConverter: Convert the transient object to the requested representation. More...
virtual StatusCode | fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
| Implementation of IConverter: Resolve the references of the converted object. More...
virtual StatusCode | updateRep (IOpaqueAddress *pAddress, DataObject *pObject)
| Implementation of IConverter: Update the converted representation of a transient object. More...
virtual StatusCode | updateRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
| Implementation of IConverter: Update the references of an already converted object. More...
virtual StatusCode | addConverter (const CLID &clid)
| Add converter object to conversion service. More...
virtual StatusCode | addConverter (IConverter *pConverter)
| Add converter object to conversion service. More...
virtual StatusCode | removeConverter (const CLID &clid)
| Remove converter object from conversion service (if present). More...
virtual IConverter * | converter (const CLID &wanted)
| Retrieve converter from list. More...
virtual StatusCode | connectOutput (const std::string &outputFile, const std::string &openMode)
| Connect the output file to the service with open mode. More...
virtual StatusCode | connectOutput (const std::string &output)
| Connect the output file to the service. More...
virtual StatusCode | commitOutput (const std::string &output, bool do_commit)
| Commit pending output. More...
virtual StatusCode | createAddress (long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
| Create a Generic address using explicit arguments to identify a single object. More...
virtual StatusCode | convertAddress (const IOpaqueAddress *pAddress, std::string &refAddress)
| Convert an address to string form. More...
virtual StatusCode | createAddress (long svc_type, const CLID &clid, const std::string &refAddress, IOpaqueAddress *&refpAddress)
| Convert an address in string form to object form. More...
virtual StatusCode | updateServiceState (IOpaqueAddress *pAddress)
| Update state of the service. More...
| ConversionSvc (const std::string &name, ISvcLocator *svc, long type)
| Standard Constructor. More...
Public Member Functions inherited from extends< Service, IConversionSvc, IAddressCreator >
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::string > | getInterfaceNames () const override
| Implementation of IInterface::getInterfaceNames. More...
| ~extends () override=default
| Virtual destructor. More...
Public Member Functions inherited from Service
const std::string & | name () const override
| Retrieve name of the service. More...
StatusCode | configure () override
StatusCode | initialize () override
StatusCode | start () override
StatusCode | stop () override
StatusCode | finalize () override
StatusCode | terminate () override
Gaudi::StateMachine::State | FSMState () const override
Gaudi::StateMachine::State | targetFSMState () const override
StatusCode | reinitialize () override
StatusCode | restart () override
StatusCode | sysInitialize () override
| Initialize Service. More...
StatusCode | sysStart () override
| Initialize Service. More...
StatusCode | sysStop () override
| Initialize Service. More...
StatusCode | sysFinalize () override
| Finalize Service. More...
StatusCode | sysReinitialize () override
| Re-initialize the Service. More...
StatusCode | sysRestart () override
| Re-initialize the Service. More...
StatusCode | setProperty (const Property &p) override
StatusCode | setProperty (const std::string &s) override
StatusCode | setProperty (const std::string &n, const std::string &v) override
StatusCode | getProperty (Property *p) const override
const Property & | getProperty (const std::string &name) const override
StatusCode | getProperty (const std::string &n, std::string &v) const override
const std::vector< Property * > & | getProperties () const override
bool | hasProperty (const std::string &name) const override
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value More...
| Service (std::string name, ISvcLocator *svcloc)
| Standard Constructor. More...
SmartIF< ISvcLocator > & | serviceLocator () const override
| Retrieve pointer to service locator. More...
StatusCode | setProperties ()
| Method for setting declared properties to the values specified for the job. More...
template<class T >
StatusCode | service (const std::string &name, const T *&psvc, bool createIf=true) const
| Access a service by name, creating it if it doesn't already exist. More...
template<class T >
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const
template<typename IFace = IService>
SmartIF< IFace > | service (const std::string &name, bool createIf=true) const
template<class T >
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const
| Access a service by name and type, creating it if it doesn't already exist. More...
template<class T >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property. More...
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
| Declare remote named properties. More...
template<class T >
StatusCode | declarePrivateTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
| Declare used Private tool. More...
template<class T >
StatusCode | declarePublicTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
| Declare used Public tool. More...
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
Public Member Functions inherited from CommonMessagingBase
virtual | ~CommonMessagingBase ()=default
| Virtual destructor. More...
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service. More...
MsgStream & | msgStream () const
| Return an uninitialized MsgStream. More...
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts. More...
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS) More...
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL) More...
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING) More...
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO) More...
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG) More...
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE) More...
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO) More...
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream More...
MSG::Level | outputLevel () const __attribute__((deprecated))
| Backward compatibility function for getting the output level. More...
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream More...
Public Member Functions inherited from extend_interfaces< Interfaces...>
| ~extend_interfaces () override=default
| Virtual destructor. More...

## Protected Member Functions
virtual | ~ConversionSvc ()
| Standard Destructor. More...
virtual IConverter * | createConverter (long typ, const CLID &clid, const ICnvFactory *fac)
| Create new Converter using factory. More...
virtual StatusCode | configureConverter (long typ, const CLID &clid, IConverter *cnv)
| Configure the new converter before initialize is called. More...
virtual StatusCode | initializeConverter (long typ, const CLID &clid, IConverter *cnv)
| Initialize the new converter. More...
virtual StatusCode | activateConverter (long typ, const CLID &clid, IConverter *cnv)
| Activate the new converter after initialization. More...
virtual void | loadConverter (DataObject *pObject)
| Load converter or dictionary needed by the converter. More...
virtual SmartIF< IAddressCreator > & | addressCreator ()
| Retrieve address creation interface. More...
StatusCode | makeCall (int typ, bool ignore_add, bool ignore_obj, bool update, IOpaqueAddress *&pAddress, DataObject *&pObject)
Protected Member Functions inherited from Service
| ~Service () override
| Standard Destructor. More...
int | outputLevel () const
| get the `Service's` output level More...
Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
void | updateMsgStreamOutputLevel (int level)
| Update the output level of the cached MsgStream. More...

## Protected Attributes
SmartIF< IDataProviderSvc > | m_dataSvc
| Pointer to data provider service. More...
SmartIF< IAddressCreator > | m_addressCreator
| Pointer to the address creation service interface. More...
SmartIF< IConversionSvc > | m_cnvSvc
| Pointer to the IConversionSvc interface of this. More...
long | m_type
| Conversion service type. More...
std::vector< WorkerEntry > | m_workers
| List of conversion workers. More...
Protected Attributes inherited from Service
IntegerProperty | m_outputLevel = MSG::NIL
| Service output level. More...
Gaudi::StateMachine::State | m_state = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::StateMachine::State | m_targetState = Gaudi::StateMachine::OFFLINE
| Service state. More...

## Private Member Functions
| ConversionSvc (const ConversionSvc &)
| Fake copy constructor (never implemented). More...
ConversionSvc & | operator= (const ConversionSvc &)
| Fake assignment operator (never implemented). More...

## Additional Inherited Members
Public Types inherited from extends< Service, IConversionSvc, IAddressCreator >
using | base_class = extends
| Typedef to this class. More...
using | extend_interfaces_base = extend_interfaces< Interfaces...>
| Typedef to the base of this class. More...
Public Types inherited from Service
typedef Gaudi::PluginService::Factory< IService *, const std::string &, ISvcLocator * > | Factory
Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using | base_class = CommonMessaging
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...

## Detailed Description

Base class for all conversion services.

It manages a set of Converters that are specialized for conversions of specific objects.

This supports self learning converters: User hooks include the following (overridable) entries:

- findCnvFactory: returns a suitable converter factory
- createConverter: the actual convetrer creation
- configureConverter: configure converter before initialize
- initializeConverter: initializes the converter
- activateConverter: any additional configuration to be done after initialize.

configureConverter and activateConverter are user hooks, where the convetrer can be manipulated by the hosting service and knowledge can be supplied, which a "generic" converter cannot aquire itself.

These hooks allow any sub-classed conversion service to override the calls and create converters, which aquire the knowledge about their persistency type and the object type they convert during the initialization.

Only AFTER these three steps the converter must satisfy the storage type of the hosting service and the class type of the required object type.

Author
  Markus Frank

Version
  1.0

Definition at line 46 of file ConversionSvc.h.

## Constructor & Destructor Documentation

ConversionSvc::ConversionSvc | ( | const std::string & | name,
|  | ISvcLocator * | svc,
|  | long | type
| ) |  |

Standard Constructor.

Definition at line 379 of file ConversionSvc.cpp.

380 : base_class(name, svc),
381 m_cnvSvc(static_cast<IConversionSvc*>(this))
382 {
383 m_type = type;
384 m_dataSvc = nullptr;
385 setAddressCreator(this).ignore();
386 }
extends< Service, IConversionSvc, IAddressCreator >::base_class
extends base_class
Typedef to this class.
Definition: extends.h:14
gaudirun.type
string type
Definition: gaudirun.py:151
ConversionSvc::setAddressCreator
virtual StatusCode setAddressCreator(IAddressCreator *creator)
Set address creator facility.
Definition: ConversionSvc.cpp:180
ConversionSvc::m_dataSvc
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to data provider service.
Definition: ConversionSvc.h:225
ConversionSvc::m_cnvSvc
SmartIF< IConversionSvc > m_cnvSvc
Pointer to the IConversionSvc interface of this.
Definition: ConversionSvc.h:229
ConversionSvc::m_type
long m_type
Conversion service type.
Definition: ConversionSvc.h:231
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:108

ConversionSvc::~ConversionSvc | ( |  | ) |
| protected virtual

Standard Destructor.

Definition at line 389 of file ConversionSvc.cpp.

389 {
390 // Release all workers.
391 for ( auto & i : m_workers ) i.converter()->release();
392 }
ConversionSvc::m_workers
std::vector< WorkerEntry > m_workers
List of conversion workers.
Definition: ConversionSvc.h:233
ana.i
list i
Definition: ana.py:128

ConversionSvc::ConversionSvc | ( | const ConversionSvc & |  | ) |
| private

Fake copy constructor (never implemented).

## Member Function Documentation

StatusCode ConversionSvc::activateConverter | ( | long | typ,
|  | const CLID & | clid,
|  | IConverter * | cnv
| ) |  |
| protected virtual

Activate the new converter after initialization.

Activate the freshly created converter.

Definition at line 317 of file ConversionSvc.cpp.

319 {
320 return pConverter ? StatusCode{StatusCode::SUCCESS}
321 : NO_CONVERTER;
322 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26

StatusCode ConversionSvc::addConverter | ( | const CLID & | clid | ) |
| virtual

Add converter object to conversion service.

Definition at line 209 of file ConversionSvc.cpp.

209 {
210 // First look for the more specific converter
211 long typ = repSvcType();
212 IConverter* pConverter = createConverter(typ, clid, nullptr);
213 if ( pConverter ) {
214 StatusCode status = configureConverter( typ, clid, pConverter );
215 if ( status.isSuccess() ) {
216 status = initializeConverter( typ, clid, pConverter );
217 if ( status.isSuccess() ) {
218 status = activateConverter( typ, clid, pConverter );
219 if ( status.isSuccess() ) {
220 long conv_typ = pConverter->repSvcType();
221 const CLID& conv_clid = pConverter->objType();
222 typ = (typ<0xFF) ? typ : typ&0xFFFFFF00;
223 conv_typ = (conv_typ<0xFF) ? conv_typ : conv_typ&0xFFFFFF00;
224 if ( conv_typ == typ && conv_clid == clid ) {
225 return addConverter(pConverter);
226 }
227 }
228 }
229 }
230 pConverter->release();
231 }
232 return NO_CONVERTER;
233 }
IConverter::objType
virtual const CLID & objType() const =0
Retrieve the class type of objects the converter produces.
ConversionSvc::configureConverter
virtual StatusCode configureConverter(long typ, const CLID &clid, IConverter *cnv)
Configure the new converter before initialize is called.
Definition: ConversionSvc.cpp:298
IConverter
The data converters are responsible to translate data from one representation into another...
Definition: IConverter.h:57
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
ConversionSvc::addConverter
virtual StatusCode addConverter(const CLID &clid)
Add converter object to conversion service.
Definition: ConversionSvc.cpp:209
ConversionSvc::repSvcType
virtual long repSvcType() const
Retrieve the class type of the data store the converter uses.
Definition: ConversionSvc.cpp:330
IConverter::repSvcType
virtual long repSvcType() const =0
Retrieve the class type of the data store the converter uses.
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
ConversionSvc::initializeConverter
virtual StatusCode initializeConverter(long typ, const CLID &clid, IConverter *cnv)
Initialize the new converter.
Definition: ConversionSvc.cpp:309
IInterface::release
virtual unsigned long release()=0
Release Interface instance.
ConversionSvc::createConverter
virtual IConverter * createConverter(long typ, const CLID &clid, const ICnvFactory *fac)
Create new Converter using factory.
Definition: ConversionSvc.cpp:286
ConversionSvc::activateConverter
virtual StatusCode activateConverter(long typ, const CLID &clid, IConverter *cnv)
Activate the new converter after initialization.
Definition: ConversionSvc.cpp:317

StatusCode ConversionSvc::addConverter | ( | IConverter * | pConverter | ) |
| virtual

Add converter object to conversion service.

Definition at line 236 of file ConversionSvc.cpp.

236 {
237 if ( pConverter ) {
238 const CLID& clid = pConverter->objType();
239 removeConverter(clid).ignore();
240 m_workers.emplace_back(clid, pConverter);
241 pConverter->addRef();
242 return StatusCode::SUCCESS;
243 }
244 return NO_CONVERTER;
245 }
IConverter::objType
virtual const CLID & objType() const =0
Retrieve the class type of objects the converter produces.
ConversionSvc::removeConverter
virtual StatusCode removeConverter(const CLID &clid)
Remove converter object from conversion service (if present).
Definition: ConversionSvc.cpp:248
StatusCode::SUCCESS
Definition: StatusCode.h:30
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
IInterface::addRef
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:108
ConversionSvc::m_workers
std::vector< WorkerEntry > m_workers
List of conversion workers.
Definition: ConversionSvc.h:233

SmartIF< IAddressCreator > & ConversionSvc::addressCreator | ( |  | ) | const
| virtual

Retrieve address creator facility.

Access the transient store.

Definition at line 194 of file ConversionSvc.cpp.

194 {
195 return m_addressCreator;
196 }
ConversionSvc::m_addressCreator
SmartIF< IAddressCreator > m_addressCreator
Pointer to the address creation service interface.
Definition: ConversionSvc.h:227

virtual SmartIF<IAddressCreator>& ConversionSvc::addressCreator | ( |  | ) |
| inline protected virtual

Retrieve address creation interface.

Definition at line 212 of file ConversionSvc.h.

212 {
213 return m_addressCreator;
214 }
ConversionSvc::m_addressCreator
SmartIF< IAddressCreator > m_addressCreator
Pointer to the address creation service interface.
Definition: ConversionSvc.h:227

StatusCode ConversionSvc::commitOutput | ( | const std::string & | output,
|  | bool | do_commit
| ) |  |
| virtual

Commit pending output.

Reimplemented in Gaudi::RootCnvSvc.

Definition at line 346 of file ConversionSvc.cpp.

346 {
347 return StatusCode::SUCCESS;
348 }
StatusCode::SUCCESS
Definition: StatusCode.h:30

StatusCode ConversionSvc::configureConverter | ( | long | typ,
|  | const CLID & | clid,
|  | IConverter * | cnv
| ) |  |
| protected virtual

Configure the new converter before initialize is called.

Configure the freshly created converter.

Definition at line 298 of file ConversionSvc.cpp.

300 {
301 if ( !pConverter ) return NO_CONVERTER;
302 pConverter->setConversionSvc(this).ignore();
303 pConverter->setAddressCreator(m_addressCreator).ignore();
304 pConverter->setDataProvider(m_dataSvc).ignore();
305 return StatusCode::SUCCESS;
306 }
ConversionSvc::m_addressCreator
SmartIF< IAddressCreator > m_addressCreator
Pointer to the address creation service interface.
Definition: ConversionSvc.h:227
StatusCode::SUCCESS
Definition: StatusCode.h:30
ConversionSvc::m_dataSvc
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to data provider service.
Definition: ConversionSvc.h:225

StatusCode ConversionSvc::connectOutput | ( | const std::string & | outputFile,
|  | const std::string & | openMode
| ) |  |
| virtual

Connect the output file to the service with open mode.

Reimplemented in Gaudi::RootCnvSvc.

Definition at line 335 of file ConversionSvc.cpp.

336 {
337 return connectOutput(outputFile);
338 }
ConversionSvc::connectOutput
virtual StatusCode connectOutput(const std::string &outputFile, const std::string &openMode)
Connect the output file to the service with open mode.
Definition: ConversionSvc.cpp:335

StatusCode ConversionSvc::connectOutput | ( | const std::string & | output | ) |
| virtual

Connect the output file to the service.

Reimplemented in Gaudi::RootCnvSvc.

Definition at line 341 of file ConversionSvc.cpp.

341 {
342 return StatusCode::SUCCESS;
343 }
StatusCode::SUCCESS
Definition: StatusCode.h:30

SmartIF< IConversionSvc > & ConversionSvc::conversionSvc | ( |  | ) | const
| virtual

Implementation of IConverter: Get conversion service the converter is connected to.

Get conversion service the converter is connected to.

Definition at line 204 of file ConversionSvc.cpp.

204 {
205 return m_cnvSvc;
206 }
ConversionSvc::m_cnvSvc
SmartIF< IConversionSvc > m_cnvSvc
Pointer to the IConversionSvc interface of this.
Definition: ConversionSvc.h:229

StatusCode ConversionSvc::convertAddress | ( | const IOpaqueAddress * | pAddress,
|  | std::string & | refAddress
| ) |  |
| virtual

Convert an address to string form.

Definition at line 361 of file ConversionSvc.cpp.

363 {
364 refAddress.clear();
365 return StatusCode::FAILURE;
366 }
StatusCode::FAILURE
Definition: StatusCode.h:29
std::string::clear
T clear(T...args)

IConverter * ConversionSvc::converter | ( | const CLID & | wanted | ) |
| virtual

Retrieve converter from list.

Definition at line 143 of file ConversionSvc.cpp.

143 {
144 IConverter* cnv = nullptr;
145 auto i = std::find_if(m_workers.begin(),m_workers.end(),CnvTest(clid));
146 if ( i != m_workers.end() ) {
147 cnv = i->converter();
148 }
149 if ( !cnv ) {
150 StatusCode status = addConverter(clid);
151 if ( status.isSuccess() ) {
152 i = std::find_if(m_workers.begin(),m_workers.end(),CnvTest(clid));
153 if ( i != m_workers.end() ) {
154 cnv = i->converter();
155 }
156 }
157 }
158 return cnv;
159 }
IConverter
The data converters are responsible to translate data from one representation into another...
Definition: IConverter.h:57
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
ConversionSvc::addConverter
virtual StatusCode addConverter(const CLID &clid)
Add converter object to conversion service.
Definition: ConversionSvc.cpp:209
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
std::find_if
T find_if(T...args)
ConversionSvc::m_workers
std::vector< WorkerEntry > m_workers
List of conversion workers.
Definition: ConversionSvc.h:233
ana.i
list i
Definition: ana.py:128

StatusCode ConversionSvc::createAddress | ( | long | svc_type,
|  | const CLID & | clid,
|  | const std::string * | par,
|  | const unsigned long * | ip,
|  | IOpaqueAddress *& | refpAddress
| ) |  |
| virtual

Create a Generic address using explicit arguments to identify a single object.

Reimplemented in Gaudi::RootCnvSvc.

Definition at line 351 of file ConversionSvc.cpp.

355 {
356 refpAddress = nullptr;
357 return StatusCode::FAILURE;
358 }
StatusCode::FAILURE
Definition: StatusCode.h:29

StatusCode ConversionSvc::createAddress | ( | long | svc_type,
|  | const CLID & | clid,
|  | const std::string & | refAddress,
|  | IOpaqueAddress *& | refpAddress
| ) |  |
| virtual

Convert an address in string form to object form.

Reimplemented in Gaudi::RootCnvSvc.

Definition at line 369 of file ConversionSvc.cpp.

373 {
374 refpAddress = nullptr;
375 return StatusCode::FAILURE;
376 }
StatusCode::FAILURE
Definition: StatusCode.h:29

IConverter * ConversionSvc::createConverter | ( | long | typ,
|  | const CLID & | clid,
|  | const ICnvFactory * | fac
| ) |  |
| protected virtual

Create new Converter using factory.

Reimplemented in Gaudi::RootCnvSvc.

Definition at line 286 of file ConversionSvc.cpp.

288 {
289 IConverter* pConverter = Converter::Factory::create(ConverterID(typ,clid), serviceLocator().get());
290 if ( !pConverter ) {
291 typ = (typ<0xFF) ? typ : typ&0xFFFFFF00;
292 pConverter = Converter::Factory::create(ConverterID(typ,clid), serviceLocator().get());
293 }
294 return pConverter;
295 }
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:324
IConverter
The data converters are responsible to translate data from one representation into another...
Definition: IConverter.h:57
ConverterID
Definition: Converter.h:150

StatusCode ConversionSvc::createObj | ( | IOpaqueAddress * | pAddress,
|  | DataObject *& | refpObject
| ) |  |
| virtual

Implementation of IConverter: Create the transient representation of an object.

Create the transient representation of an object.

Definition at line 103 of file ConversionSvc.cpp.

103 {
104 return makeCall(CREATE_OBJ, false, true, false, pAddress, refpObj);
105 }
ConversionSvc::makeCall
StatusCode makeCall(int typ, bool ignore_add, bool ignore_obj, bool update, IOpaqueAddress *&pAddress, DataObject *&pObject)
Definition: ConversionSvc.cpp:23
CREATE_OBJ
Definition: ConversionSvc.cpp:13

StatusCode ConversionSvc::createRep | ( | DataObject * | pObject,
|  | IOpaqueAddress *& | refpAddress
| ) |  |
| virtual

Implementation of IConverter: Convert the transient object to the requested representation.

Convert the transient object to the requested representation.

Reimplemented in RootHistCnv::PersSvc.

Definition at line 123 of file ConversionSvc.cpp.

123 {
124 return makeCall(CREATE_REP, true, false, false, refpAddress, pObj);
125 }
CREATE_REP
Definition: ConversionSvc.cpp:17
ConversionSvc::makeCall
StatusCode makeCall(int typ, bool ignore_add, bool ignore_obj, bool update, IOpaqueAddress *&pAddress, DataObject *&pObject)
Definition: ConversionSvc.cpp:23

SmartIF< IDataProviderSvc > & ConversionSvc::dataProvider | ( |  | ) | const
| virtual

Implementation of IConverter: Get Data provider service.

Access the transient store.

Returns
  Pointer to data provider service

Definition at line 175 of file ConversionSvc.cpp.

175 {
176 return m_dataSvc;
177 }
ConversionSvc::m_dataSvc
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to data provider service.
Definition: ConversionSvc.h:225

StatusCode ConversionSvc::fillObjRefs | ( | IOpaqueAddress * | pAddress,
|  | DataObject * | pObject
| ) |  |
| virtual

Implementation of IConverter: Resolve the references of the created transient object.

Resolve the references of the created transient object.

Definition at line 108 of file ConversionSvc.cpp.

108 {
109 return makeCall(FILL_OBJ_REFS, false, true, true, pAddress, pObj);
110 }
ConversionSvc::makeCall
StatusCode makeCall(int typ, bool ignore_add, bool ignore_obj, bool update, IOpaqueAddress *&pAddress, DataObject *&pObject)
Definition: ConversionSvc.cpp:23
FILL_OBJ_REFS
Definition: ConversionSvc.cpp:14

StatusCode ConversionSvc::fillRepRefs | ( | IOpaqueAddress * | pAddress,
|  | DataObject * | pObject
| ) |  |
| virtual

Implementation of IConverter: Resolve the references of the converted object.

Resolve the references of the converted object.

Definition at line 128 of file ConversionSvc.cpp.

128 {
129 return makeCall(FILL_REP_REFS, true, false, false, pAddress, pObj);
130 }
ConversionSvc::makeCall
StatusCode makeCall(int typ, bool ignore_add, bool ignore_obj, bool update, IOpaqueAddress *&pAddress, DataObject *&pObject)
Definition: ConversionSvc.cpp:23
FILL_REP_REFS
Definition: ConversionSvc.cpp:18

StatusCode ConversionSvc::finalize | ( |  | ) |
| virtual

stop the service.

Reimplemented in Gaudi::RootCnvSvc, and RootHistCnv::PersSvc.

Definition at line 268 of file ConversionSvc.cpp.

268 {
269 // Release all workers.
270 for ( auto& i : m_workers ) {
271 if ( i.converter()->finalize().isFailure() ) {
272 error() << "finalizing worker" << endmsg;
273 }
274 i.converter()->release();
275 }
276 m_workers.clear();
277 // release interfaces
278 m_addressCreator = nullptr;
279 m_dataSvc = nullptr;
280 m_cnvSvc = nullptr;
281 return Service::finalize();
282 }
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:193
ConversionSvc::m_addressCreator
SmartIF< IAddressCreator > m_addressCreator
Pointer to the address creation service interface.
Definition: ConversionSvc.h:227
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
ConversionSvc::m_dataSvc
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to data provider service.
Definition: ConversionSvc.h:225
ConversionSvc::m_cnvSvc
SmartIF< IConversionSvc > m_cnvSvc
Pointer to the IConversionSvc interface of this.
Definition: ConversionSvc.h:229
ConversionSvc::m_workers
std::vector< WorkerEntry > m_workers
List of conversion workers.
Definition: ConversionSvc.h:233
ana.i
list i
Definition: ana.py:128
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode ConversionSvc::initialize | ( |  | ) |
| virtual

Initialize the service.

Reimplemented in Gaudi::RootCnvSvc, and RootHistCnv::PersSvc.

Definition at line 262 of file ConversionSvc.cpp.

262 {
263 StatusCode status = Service::initialize();
264 return status;
265 }
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:68
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26

StatusCode ConversionSvc::initializeConverter | ( | long | typ,
|  | const CLID & | clid,
|  | IConverter * | cnv
| ) |  |
| protected virtual

Initialize the new converter.

Initialize new converter.

Definition at line 309 of file ConversionSvc.cpp.

311 {
312 return pConverter ? pConverter->initialize()
313 : NO_CONVERTER;
314 }

void ConversionSvc::loadConverter | ( | DataObject * | pObject | ) |
| protected virtual

Load converter or dictionary needed by the converter.

Reimplemented in Gaudi::RootCnvSvc.

Definition at line 94 of file ConversionSvc.cpp.

94 {
95
96 }

StatusCode ConversionSvc::makeCall | ( | int | typ,
|  | bool | ignore_add,
|  | bool | ignore_obj,
|  | bool | update,
|  | IOpaqueAddress *& | pAddress,
|  | DataObject *& | pObject
| ) |  |
| protected

Definition at line 23 of file ConversionSvc.cpp.

28 {
29 if ( pAddress || ignore_add ) {
30 if ( pObject || ignore_obj ) {
31 const CLID& obj_class =
32 ( pObject && !ignore_obj) ? pObject->clID()
33 : ( pAddress && !ignore_add)
34 ? pAddress->clID()
35 : CLID_NULL;
36 IConverter* cnv = converter(obj_class);
37 if ( !cnv && pObject ) {
38 //Give it a try to autoload the class (dictionary) for which the converter is needed
39 loadConverter( pObject);
40 cnv = converter(obj_class);
41 }
42
43 StatusCode status(StatusCode::FAILURE,true);
44 if ( cnv ) {
45 switch(typ) {
46 case CREATE_OBJ:
47 pObject = nullptr;
48 status = cnv->createObj(pAddress, pObject);
49 break;
50 case FILL_OBJ_REFS:
51 status = cnv->fillObjRefs(pAddress, pObject);
52 break;
53 case UPDATE_OBJ:
54 status = cnv->updateObj(pAddress, pObject);
55 break;
56 case UPDATE_OBJ_REFS:
57 status = cnv->updateObjRefs(pAddress, pObject);
58 break;
59 case CREATE_REP:
60 pAddress = nullptr;
61 status = cnv->createRep(pObject, pAddress);
62 break;
63 case FILL_REP_REFS:
64 status = cnv->fillRepRefs(pAddress, pObject);
65 break;
66 case UPDATE_REP:
67 status = cnv->updateRep(pAddress, pObject);
68 break;
69 case UPDATE_REP_REFS:
70 status = cnv->updateRepRefs(pAddress, pObject);
71 break;
72 default:
73 status = StatusCode::FAILURE;
74 break;
75 }
76 if ( status.isSuccess() && update ) {
77 status = updateServiceState(pAddress);
78 }
79 return status;
80 }
81 status.ignore();
82 info() << "No converter for object ";
83 if ( pObject ) {
84 msgStream() << System::typeinfoName(typeid(*pObject));
85 }
86 msgStream() << " CLID= " << obj_class << endmsg;
87 return NO_CONVERTER;
88 }
89 return INVALID_OBJECT;
90 }
91 return INVALID_ADDRESS;
92 }
CREATE_REP
Definition: ConversionSvc.cpp:17
IConverter
The data converters are responsible to translate data from one representation into another...
Definition: IConverter.h:57
IConverter::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)=0
Create the transient representation of an object.
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:124
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:297
FILL_REP_REFS
Definition: ConversionSvc.cpp:18
CREATE_OBJ
Definition: ConversionSvc.cpp:13
IConverter::createRep
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
IConverter::updateRepRefs
virtual StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an already converted object.
ConversionSvc::loadConverter
virtual void loadConverter(DataObject *pObject)
Load converter or dictionary needed by the converter.
Definition: ConversionSvc.cpp:94
IConverter::updateObj
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)=0
Update the transient object from the other representation.
UPDATE_OBJ
Definition: ConversionSvc.cpp:15
FILL_OBJ_REFS
Definition: ConversionSvc.cpp:14
DataObject::clID
virtual const CLID & clID() const
Retrieve reference to class definition structure.
Definition: DataObject.cpp:68
IOpaqueAddress::clID
virtual const CLID & clID() const =0
Retrieve class information from link.
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
UPDATE_REP_REFS
Definition: ConversionSvc.cpp:20
IConverter::updateObjRefs
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
IConverter::updateRep
virtual StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the converted representation of a transient object.
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
ConversionSvc::updateServiceState
virtual StatusCode updateServiceState(IOpaqueAddress *pAddress)
Update state of the service.
Definition: ConversionSvc.cpp:98
UPDATE_OBJ_REFS
Definition: ConversionSvc.cpp:16
install.update
def update
Definition: install.py:213
IConverter::fillObjRefs
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the created transient object.
CommonMessagingBase::msgStream
MsgStream & msgStream() const
Return an uninitialized MsgStream.
Definition: CommonMessaging.h:89
ConversionSvc::converter
virtual IConverter * converter(const CLID &wanted)
Retrieve converter from list.
Definition: ConversionSvc.cpp:143
IConverter::fillRepRefs
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
UPDATE_REP
Definition: ConversionSvc.cpp:19

const CLID & ConversionSvc::objType | ( |  | ) | const

Implementation of IConverter: dummy call.

Retrieve the class type of objects the converter produces.

Definition at line 325 of file ConversionSvc.cpp.

325 {
326 return CLID_NULL;
327 }

ConversionSvc& ConversionSvc::operator= | ( | const ConversionSvc & |  | ) |
| private

Fake assignment operator (never implemented).

StatusCode ConversionSvc::removeConverter | ( | const CLID & | clid | ) |
| virtual

Remove converter object from conversion service (if present).

Definition at line 248 of file ConversionSvc.cpp.

248 {
249
250 auto i = std::partition( std::begin(m_workers), std::end(m_workers),
251 std::not1( CnvTest{clid} ) );
252 if ( i == std::end(m_workers) ) return NO_CONVERTER;
253 std::for_each( i, std::end(m_workers), []( WorkerEntry& w ) {
254 w.converter()->finalize().ignore();
255 w.converter()->release();
256 });
257 m_workers.erase( i, std::end(m_workers) );
258 return StatusCode::SUCCESS;
259 }
std::end
T end(T...args)
std::partition
T partition(T...args)
StatusCode::SUCCESS
Definition: StatusCode.h:30
std::begin
T begin(T...args)
std::not1
T not1(T...args)
std::for_each
T for_each(T...args)
ConversionSvc::m_workers
std::vector< WorkerEntry > m_workers
List of conversion workers.
Definition: ConversionSvc.h:233
ana.i
list i
Definition: ana.py:128

long ConversionSvc::repSvcType | ( |  | ) | const
| virtual

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

Definition at line 330 of file ConversionSvc.cpp.

330 {
331 return m_type;
332 }
ConversionSvc::m_type
long m_type
Conversion service type.
Definition: ConversionSvc.h:231

StatusCode ConversionSvc::setAddressCreator | ( | IAddressCreator * | creator | ) |
| virtual

Set address creator facility.

Definition at line 180 of file ConversionSvc.cpp.

180 {
181 m_addressCreator = creator;
182 for(auto& i : m_workers ) {
183 auto* cnv = i.converter();
184 if ( cnv ) {
185 if (cnv->setAddressCreator(m_addressCreator).isFailure()) {
186 error() << "setting Address Creator" << endmsg;
187 }
188 }
189 }
190 return StatusCode::SUCCESS;
191 }
ConversionSvc::m_addressCreator
SmartIF< IAddressCreator > m_addressCreator
Pointer to the address creation service interface.
Definition: ConversionSvc.h:227
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
StatusCode::SUCCESS
Definition: StatusCode.h:30
ConversionSvc::m_workers
std::vector< WorkerEntry > m_workers
List of conversion workers.
Definition: ConversionSvc.h:233
ana.i
list i
Definition: ana.py:128
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode ConversionSvc::setConversionSvc | ( | IConversionSvc * | svc | ) |
| virtual

Implementation of IConverter: Set conversion service the converter is connected to.

Set conversion service the converter is connected to.

Definition at line 199 of file ConversionSvc.cpp.

199 {
200 return StatusCode::FAILURE;
201 }
StatusCode::FAILURE
Definition: StatusCode.h:29

StatusCode ConversionSvc::setDataProvider | ( | IDataProviderSvc * | pService | ) |
| virtual

Implementation of IConverter: Set Data provider service.

Define transient data store.

Returns
  Status code indicating success or failure

Parameters

  pService | Pointer to data provider service

Definition at line 162 of file ConversionSvc.cpp.

162 {
163 if ( !pDataSvc ) return StatusCode::SUCCESS; //Atlas does not use DataSvc
164 m_dataSvc = pDataSvc;
165 for(auto& i : m_workers ) {
166 IConverter* cnv = i.converter();
167 if ( cnv && cnv->setDataProvider(m_dataSvc).isFailure()) {
168 error() << "setting Data Provider" << endmsg;
169 }
170 }
171 return StatusCode::SUCCESS;
172 }
IConverter
The data converters are responsible to translate data from one representation into another...
Definition: IConverter.h:57
IConverter::setDataProvider
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
StatusCode::SUCCESS
Definition: StatusCode.h:30
ConversionSvc::m_dataSvc
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to data provider service.
Definition: ConversionSvc.h:225
ConversionSvc::m_workers
std::vector< WorkerEntry > m_workers
List of conversion workers.
Definition: ConversionSvc.h:233
ana.i
list i
Definition: ana.py:128
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode ConversionSvc::updateObj | ( | IOpaqueAddress * | pAddress,
|  | DataObject * | refpObject
| ) |  |
| virtual

Implementation of IConverter: Update the transient object from the other representation.

Update the transient object from the other representation.

Definition at line 113 of file ConversionSvc.cpp.

113 {
114 return makeCall(UPDATE_OBJ, false, true, false, pAddress, pObj);
115 }
ConversionSvc::makeCall
StatusCode makeCall(int typ, bool ignore_add, bool ignore_obj, bool update, IOpaqueAddress *&pAddress, DataObject *&pObject)
Definition: ConversionSvc.cpp:23
UPDATE_OBJ
Definition: ConversionSvc.cpp:15

StatusCode ConversionSvc::updateObjRefs | ( | IOpaqueAddress * | pAddress,
|  | DataObject * | pObject
| ) |  |
| virtual

Implementation of IConverter: Update the references of an updated transient object.

Update the references of an updated transient object.

Definition at line 118 of file ConversionSvc.cpp.

118 {
119 return makeCall(UPDATE_OBJ_REFS, false, true, true, pAddress, pObj);
120 }
ConversionSvc::makeCall
StatusCode makeCall(int typ, bool ignore_add, bool ignore_obj, bool update, IOpaqueAddress *&pAddress, DataObject *&pObject)
Definition: ConversionSvc.cpp:23
UPDATE_OBJ_REFS
Definition: ConversionSvc.cpp:16

StatusCode ConversionSvc::updateRep | ( | IOpaqueAddress * | pAddress,
|  | DataObject * | pObject
| ) |  |
| virtual

Implementation of IConverter: Update the converted representation of a transient object.

Update the converted representation of a transient object.

Definition at line 133 of file ConversionSvc.cpp.

133 {
134 return makeCall(UPDATE_REP, true, false, false, pAddress, pObj);
135 }
ConversionSvc::makeCall
StatusCode makeCall(int typ, bool ignore_add, bool ignore_obj, bool update, IOpaqueAddress *&pAddress, DataObject *&pObject)
Definition: ConversionSvc.cpp:23
UPDATE_REP
Definition: ConversionSvc.cpp:19

StatusCode ConversionSvc::updateRepRefs | ( | IOpaqueAddress * | pAddress,
|  | DataObject * | pObject
| ) |  |
| virtual

Implementation of IConverter: Update the references of an already converted object.

Update the references of an already converted object.

Definition at line 138 of file ConversionSvc.cpp.

138 {
139 return makeCall(UPDATE_REP_REFS, true, false, false, pAddress, pObj);
140 }
ConversionSvc::makeCall
StatusCode makeCall(int typ, bool ignore_add, bool ignore_obj, bool update, IOpaqueAddress *&pAddress, DataObject *&pObject)
Definition: ConversionSvc.cpp:23
UPDATE_REP_REFS
Definition: ConversionSvc.cpp:20

StatusCode ConversionSvc::updateServiceState | ( | IOpaqueAddress * | pAddress | ) |
| virtual

Update state of the service.

Reimplemented in Gaudi::RootCnvSvc.

Definition at line 98 of file ConversionSvc.cpp.

98 {
99 return StatusCode::SUCCESS;
100 }
StatusCode::SUCCESS
Definition: StatusCode.h:30

## Member Data Documentation

SmartIF<IAddressCreator> ConversionSvc::m_addressCreator
| mutable protected

Pointer to the address creation service interface.

Definition at line 227 of file ConversionSvc.h.

SmartIF<IConversionSvc> ConversionSvc::m_cnvSvc
| mutable protected

Pointer to the IConversionSvc interface of this.

Definition at line 229 of file ConversionSvc.h.

SmartIF<IDataProviderSvc> ConversionSvc::m_dataSvc
| mutable protected

Pointer to data provider service.

Definition at line 225 of file ConversionSvc.h.

long ConversionSvc::m_type
| protected

Conversion service type.

Definition at line 231 of file ConversionSvc.h.

std::vector<WorkerEntry> ConversionSvc::m_workers
| protected

List of conversion workers.

Definition at line 233 of file ConversionSvc.h.

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

- GaudiKernel/GaudiKernel/ConversionSvc.h
- GaudiKernel/src/Lib/ConversionSvc.cpp