ATLAS Offline Software
Loading...
Searching...
No Matches
AthCnvSvc Class Reference

Base class for all conversion services. More...

#include <AthenaBaseComps/AthCnvSvc.h>

Inheritance diagram for AthCnvSvc:
Collaboration diagram for AthCnvSvc:

Classes

class  WorkerEntry

Public Types

typedef std::unordered_map< CLID, WorkerEntry > Workers

Public Member Functions

 AthCnvSvc (const std::string &name, ISvcLocator *pSvcLocator, long type)
 Constructor with parameters:
virtual StatusCode initialize () override
 Gaudi Service Implementation.
virtual StatusCode finalize () override
@c IConversionSvc implementation
virtual long repSvcType () const override
 Retrieve the class type of the data store the converter uses.
virtual const CLID & objType () const override
 Implementation of IConverter: dummy call.
virtual StatusCode setDataProvider (IDataProviderSvc *pService) override
 Implementation of IConverter: Set Data provider service.
virtual SmartIF< IDataProviderSvc > & dataProvider () const override
 Implementation of IConverter: Get Data provider service.
virtual StatusCode setConversionSvc (IConversionSvc *svc) override
 Implementation of IConverter: Set conversion service the converter is connected to.
virtual SmartIF< IConversionSvc > conversionSvc () override
 Implementation of IConverter: Get conversion service the converter is connected to.
virtual StatusCode setAddressCreator (IAddressCreator *creator) override
 Set address creator facility.
virtual SmartIF< IAddressCreator > & addressCreator () const override
 Retrieve address creator facility.
virtual StatusCode createObj (IOpaqueAddress *pAddress, DataObject *&refpObject) override
 Implementation of IConverter: Create the transient representation of an object.
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
 Implementation of IConverter: Resolve the references of the created transient object.
virtual StatusCode updateObj (IOpaqueAddress *pAddress, DataObject *refpObject) override
 Implementation of IConverter: Update the transient object from the other representation.
virtual StatusCode updateObjRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
 Implementation of IConverter: Update the references of an updated transient object.
virtual StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress) override
 Implementation of IConverter: Convert the transient object to the requested representation.
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
 Implementation of IConverter: Resolve the references of the converted object.
virtual StatusCode updateRep (IOpaqueAddress *pAddress, DataObject *pObject) override
 Implementation of IConverter: Update the converted representation of a transient object.
virtual StatusCode updateRepRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
 Implementation of IConverter: Update the references of an already converted object.
virtual StatusCode addConverter (const CLID &clid) override
 Add converter object to conversion service.
virtual StatusCode addConverter (IConverter *pConverter) override
 Add converter object to conversion service.
virtual StatusCode removeConverter (const CLID &clid) override
 Remove converter object from conversion service (if present).
virtual IConverter * converter (const CLID &wanted) override
 Retrieve converter from list.
virtual StatusCode connectOutput (const std::string &outputFile, const std::string &openMode) override
 Connect the output file to the service with open mode.
virtual StatusCode connectOutput (const std::string &output) override
 Connect the output file to the service.
virtual StatusCode commitOutput (const std::string &output, bool do_commit) override
 Commit pending output.
virtual StatusCode disconnectOutput (const std::string &output)
 Disconnect output files from the service.

Friends

class SvcFactory< AthCnvSvc >

@c IAddressCreator interface implementation

typedef std::recursive_mutex CallMutex
 Mutex to protect Converter creation.
SmartIF< IDataProviderSvc > m_dataSvc
 Pointer to data provider service.
SmartIF< IAddressCreator > m_addressCreator
 Pointer to the address creation service interface.
long m_type
 Conversion service type.
Workers m_workers
 List of conversion workers.
CallMutex m_convsvc_mut
virtual StatusCode createAddress (long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress) override
 Create a Generic address using explicit arguments to identify a single object.
virtual StatusCode convertAddress (const IOpaqueAddress *pAddress, std::string &refAddress) override
 Convert an address to string form.
virtual StatusCode createAddress (long svc_type, const CLID &clid, const std::string &refAddress, IOpaqueAddress *&refpAddress) override
 Convert an address in string form to object form.
virtual StatusCode updateServiceState (IOpaqueAddress *pAddress)
 Update state of the service.
 AthCnvSvc ()
 Default constructor:
 AthCnvSvc (const AthCnvSvc &)
AthCnvSvc & operator= (const AthCnvSvc &)
virtual ~AthCnvSvc ()
 Destructor:
virtual IConverter * createConverter (long typ, const CLID &clid, const ICnvFactory *fac)
 Create new Converter using factory.
virtual StatusCode configureConverter (long typ, const CLID &clid, IConverter *cnv)
 Configure the new converter before initialize is called.
virtual StatusCode initializeConverter (long typ, const CLID &clid, IConverter *cnv)
 Initialize the new converter.
virtual StatusCode activateConverter (long typ, const CLID &clid, IConverter *cnv)
 Activate the new converter after initialization.
virtual void loadConverter (DataObject *pObject)
 Load converter or dictionary needed by the converter.
virtual SmartIF< IAddressCreator > & addressCreator ()
 Retrieve address creation interface.
StatusCode makeCall (int typ, bool ignore_add, bool ignore_obj, bool update, IOpaqueAddress *&pAddress, DataObject *&pObject)

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 converter 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 converter can be manipulated by the hosting service and knowledge can be supplied, which a "generic" converter cannot acquire itself.

These hooks allow any sub-classed conversion service to override the calls and create converters, which acquire 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 63 of file AthCnvSvc.h.

Member Typedef Documentation

◆ CallMutex

typedef std::recursive_mutex AthCnvSvc::CallMutex
protected

Mutex to protect Converter creation.

Definition at line 318 of file AthCnvSvc.h.

◆ Workers

typedef std::unordered_map<CLID,WorkerEntry> AthCnvSvc::Workers

Definition at line 105 of file AthCnvSvc.h.

Constructor & Destructor Documentation

◆ AthCnvSvc() [1/3]

AthCnvSvc::AthCnvSvc ( const std::string & name,
ISvcLocator * pSvcLocator,
long type )

Constructor with parameters:

Definition at line 46 of file AthCnvSvc.cxx.

48 :
49 base_class (name, pSvcLocator),
50 m_dataSvc (0),
52 m_type (type),
53 m_workers ( )
54{
55}
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to data provider service.
Definition AthCnvSvc.h:310
Workers m_workers
List of conversion workers.
Definition AthCnvSvc.h:316
SmartIF< IAddressCreator > m_addressCreator
Pointer to the address creation service interface.
Definition AthCnvSvc.h:312
long m_type
Conversion service type.
Definition AthCnvSvc.h:314

◆ AthCnvSvc() [2/3]

AthCnvSvc::AthCnvSvc ( )
private

Default constructor:

◆ AthCnvSvc() [3/3]

AthCnvSvc::AthCnvSvc ( const AthCnvSvc & )
private

◆ ~AthCnvSvc()

AthCnvSvc::~AthCnvSvc ( )
protectedvirtual

Destructor:

Definition at line 59 of file AthCnvSvc.cxx.

60{
61 // the following is hopefully (!) temporary hack to prevent deleting
62 // services we hold a reference count to.
63 // the problem is that these references might point back to us (so we
64 // end up recursively calling the d-tor) or be double-deleted later on
65 // by the ServiceManager.
66 // the correct fix is to have everybody use SmartIF<T> all over the code...
67 //
68 // "temporary hack" ha ha! (CGL 5/2014)
69 //
70 if (m_addressCreator) {
71 m_addressCreator->addRef();
73 }
74 if (m_dataSvc) {
75 m_dataSvc->addRef();
76 m_dataSvc = 0;
77 }
78
79 ATH_MSG_DEBUG ("release-ing all workers ({})...", m_workers.size());
80 for ( Workers::iterator
81 i = m_workers.begin(),
82 iend = m_workers.end();
83 i != iend;
84 ++i ) {
85 IConverter *cnv = i->second.m_converter;
86 if (cnv) {
87
88 if (!cnv->release()) {
89 i->second.m_converter = 0;
90 }
91 }
92 }
93 ATH_MSG_DEBUG ("release-ing all workers ({})... [done]", m_workers.size());
94 m_workers.clear();
95
96}
#define ATH_MSG_DEBUG(x,...)

Member Function Documentation

◆ activateConverter()

StatusCode AthCnvSvc::activateConverter ( long typ,
const CLID & clid,
IConverter * cnv )
protectedvirtual

Activate the new converter after initialization.

Definition at line 496 of file AthCnvSvc.cxx.

498{
499 if (cnv) {
500 return StatusCode::SUCCESS;
501 }
502 return Status::NO_CONVERTER;
503}

◆ addConverter() [1/2]

StatusCode AthCnvSvc::addConverter ( const CLID & clid)
overridevirtual

Add converter object to conversion service.

Definition at line 296 of file AthCnvSvc.cxx.

297{
298 // First look for the more specific converter
299 long typ = repSvcType();
300 IConverter* pConverter = createConverter(typ, clid, 0);
301 if ( 0 != pConverter ) {
302 StatusCode status = configureConverter( typ, clid, pConverter );
303 if ( status.isSuccess() ) {
304 status = initializeConverter( typ, clid, pConverter );
305 if ( status.isSuccess() ) {
306 status = activateConverter( typ, clid, pConverter );
307 if ( status.isSuccess() ) {
308 long conv_typ = pConverter->repSvcType();
309 const CLID& conv_clid = pConverter->objType();
310 typ = (typ<0xFF) ? typ : typ&0xFFFFFF00;
311 conv_typ = (conv_typ<0xFF) ? conv_typ : conv_typ&0xFFFFFF00;
312 if ( conv_typ == typ && conv_clid == clid ) {
313 return addConverter(pConverter);
314 }
315 }
316 }
317 }
318 pConverter->release();
319 }
320 return Status::NO_CONVERTER;
321}
uint32_t CLID
The Class ID type.
virtual StatusCode activateConverter(long typ, const CLID &clid, IConverter *cnv)
Activate the new converter after initialization.
virtual IConverter * createConverter(long typ, const CLID &clid, const ICnvFactory *fac)
Create new Converter using factory.
virtual long repSvcType() const override
Retrieve the class type of the data store the converter uses.
virtual StatusCode addConverter(const CLID &clid) override
Add converter object to conversion service.
virtual StatusCode initializeConverter(long typ, const CLID &clid, IConverter *cnv)
Initialize the new converter.
virtual StatusCode configureConverter(long typ, const CLID &clid, IConverter *cnv)
Configure the new converter before initialize is called.
::StatusCode StatusCode
StatusCode definition for legacy code.
status
Definition merge.py:16

◆ addConverter() [2/2]

StatusCode AthCnvSvc::addConverter ( IConverter * pConverter)
overridevirtual

Add converter object to conversion service.

Definition at line 325 of file AthCnvSvc.cxx.

326{
327 if ( 0 != pConverter ) {
328 const CLID& clid = pConverter->objType();
329 removeConverter(clid).ignore();
330 m_workers.insert (std::make_pair(clid,WorkerEntry(clid, pConverter)));
331 pConverter->addRef();
332 return StatusCode::SUCCESS;
333 }
334 return Status::NO_CONVERTER;
335}
virtual StatusCode removeConverter(const CLID &clid) override
Remove converter object from conversion service (if present).

◆ addressCreator() [1/2]

virtual SmartIF< IAddressCreator > & AthCnvSvc::addressCreator ( )
inlineprotectedvirtual

Retrieve address creation interface.

Definition at line 297 of file AthCnvSvc.h.

298 {
299 return m_addressCreator;
300 }

◆ addressCreator() [2/2]

SmartIF< IAddressCreator > & AthCnvSvc::addressCreator ( ) const
overridevirtual

Retrieve address creator facility.

Definition at line 221 of file AthCnvSvc.cxx.

222{
223 // FIXME: Ideally the return type should be const, but that would require
224 // changes in the Gaudi IConverter base class.
225 SmartIF<IAddressCreator>& svc ATLAS_THREAD_SAFE =
226 const_cast<SmartIF<IAddressCreator>&>(m_addressCreator);
227 return svc;
228}
#define ATLAS_THREAD_SAFE
AthROOTErrorHandlerSvc * svc

◆ commitOutput()

StatusCode AthCnvSvc::commitOutput ( const std::string & output,
bool do_commit )
overridevirtual

Commit pending output.

Definition at line 389 of file AthCnvSvc.cxx.

390{
391 return StatusCode::SUCCESS;
392}

◆ configureConverter()

StatusCode AthCnvSvc::configureConverter ( long typ,
const CLID & clid,
IConverter * cnv )
protectedvirtual

Configure the new converter before initialize is called.

Definition at line 470 of file AthCnvSvc.cxx.

472{
473 if (cnv) {
474 cnv->setConversionSvc(this).ignore();
475 cnv->setAddressCreator(m_addressCreator).ignore();
476 cnv->setDataProvider(m_dataSvc).ignore();
477 return StatusCode::SUCCESS;
478 }
479 return Status::NO_CONVERTER;
480
481}

◆ connectOutput() [1/2]

StatusCode AthCnvSvc::connectOutput ( const std::string & output)
overridevirtual

Connect the output file to the service.

Definition at line 382 of file AthCnvSvc.cxx.

383{
384 return StatusCode::SUCCESS;
385}

◆ connectOutput() [2/2]

StatusCode AthCnvSvc::connectOutput ( const std::string & outputFile,
const std::string & openMode )
overridevirtual

Connect the output file to the service with open mode.

Definition at line 374 of file AthCnvSvc.cxx.

376{
377 return connectOutput (outputFile);
378}
virtual StatusCode connectOutput(const std::string &outputFile, const std::string &openMode) override
Connect the output file to the service with open mode.

◆ conversionSvc()

SmartIF< IConversionSvc > AthCnvSvc::conversionSvc ( )
overridevirtual

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

Definition at line 196 of file AthCnvSvc.cxx.

197{
198 return SmartIF<IConversionSvc>(this);
199}

◆ convertAddress()

StatusCode AthCnvSvc::convertAddress ( const IOpaqueAddress * pAddress,
std::string & refAddress )
overridevirtual

Convert an address to string form.

Definition at line 419 of file AthCnvSvc.cxx.

421{
422 refAddress = "";
423 return StatusCode::FAILURE;
424}

◆ converter()

IConverter * AthCnvSvc::converter ( const CLID & wanted)
overridevirtual

Retrieve converter from list.

Definition at line 354 of file AthCnvSvc.cxx.

355{
356 std::lock_guard<CallMutex> lock(m_convsvc_mut);
357 Workers::iterator worker = m_workers.find (clid);
358 if ( worker != m_workers.end() ) {
359 return worker->second.converter();
360 }
361 if (addConverter (clid).isSuccess()) {
362 worker = m_workers.find (clid);
363 if (worker != m_workers.end()) {
364 return worker->second.converter();
365 }
366 } else {
367 ATH_MSG_INFO("problem adding converter for CLID [{}]", clid);
368 }
369 return 0;
370}
#define ATH_MSG_INFO(x,...)
virtual void lock()=0
Interface to allow an object to lock itself when made const in SG.
CallMutex m_convsvc_mut
Definition AthCnvSvc.h:319

◆ createAddress() [1/2]

StatusCode AthCnvSvc::createAddress ( long svc_type,
const CLID & clid,
const std::string & refAddress,
IOpaqueAddress *& refpAddress )
overridevirtual

Convert an address in string form to object form.

Definition at line 428 of file AthCnvSvc.cxx.

432{
433 refpAddress = 0;
434 return StatusCode::FAILURE;
435}

◆ createAddress() [2/2]

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

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

Definition at line 407 of file AthCnvSvc.cxx.

412{
413 refpAddress = 0;
414 return StatusCode::FAILURE;
415}

◆ createConverter()

IConverter * AthCnvSvc::createConverter ( long typ,
const CLID & clid,
const ICnvFactory * fac )
protectedvirtual

Create new Converter using factory.

Definition at line 451 of file AthCnvSvc.cxx.

454{
455
456 std::unique_ptr<IConverter> cnv{Converter::Factory::create
457 (ConverterID(typ,clid), serviceLocator().get() )};
458
459 if (!cnv) {
460 typ = (typ<0xFF) ? typ : typ&0xFFFFFF00;
461 cnv = Converter::Factory::create
462 (ConverterID(typ,clid), serviceLocator().get() );
463 }
464 return cnv.release();
465
466}
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:132

◆ createObj()

StatusCode AthCnvSvc::createObj ( IOpaqueAddress * pAddress,
DataObject *& refpObject )
overridevirtual

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

Definition at line 233 of file AthCnvSvc.cxx.

234{
235 return makeCall (CREATE_OBJ, false, true, false, pAddress, refpObject);
236}
@ CREATE_OBJ
Definition AthCnvSvc.cxx:30
StatusCode makeCall(int typ, bool ignore_add, bool ignore_obj, bool update, IOpaqueAddress *&pAddress, DataObject *&pObject)

◆ createRep()

StatusCode AthCnvSvc::createRep ( DataObject * pObject,
IOpaqueAddress *& refpAddress )
overridevirtual

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

Definition at line 265 of file AthCnvSvc.cxx.

266{
267 return makeCall (CREATE_REP, true, false, false, refpAddress, pObject);
268}
@ CREATE_REP
Definition AthCnvSvc.cxx:34

◆ dataProvider()

SmartIF< IDataProviderSvc > & AthCnvSvc::dataProvider ( ) const
overridevirtual

Implementation of IConverter: Get Data provider service.

Returns
Pointer to data provider service

Definition at line 176 of file AthCnvSvc.cxx.

177{
178 // FIXME: Ideally the return type should be const, but that would require
179 // changes in the Gaudi IConverter base class.
180 SmartIF<IDataProviderSvc>& svc ATLAS_THREAD_SAFE =
181 const_cast<SmartIF<IDataProviderSvc>&>(m_dataSvc);
182 return svc;
183}

◆ disconnectOutput()

StatusCode AthCnvSvc::disconnectOutput ( const std::string & output)
virtual

Disconnect output files from the service.

Definition at line 397 of file AthCnvSvc.cxx.

398{
399 return StatusCode::SUCCESS;
400}

◆ fillObjRefs()

StatusCode AthCnvSvc::fillObjRefs ( IOpaqueAddress * pAddress,
DataObject * pObject )
overridevirtual

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

Definition at line 241 of file AthCnvSvc.cxx.

242{
243 return makeCall (FILL_OBJ_REFS, false, true, true, pAddress, pObject);
244}
@ FILL_OBJ_REFS
Definition AthCnvSvc.cxx:31

◆ fillRepRefs()

StatusCode AthCnvSvc::fillRepRefs ( IOpaqueAddress * pAddress,
DataObject * pObject )
overridevirtual

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

Definition at line 273 of file AthCnvSvc.cxx.

274{
275 return makeCall (FILL_REP_REFS, true, false, false, pAddress, pObject);
276}
@ FILL_REP_REFS
Definition AthCnvSvc.cxx:35

◆ finalize()

StatusCode AthCnvSvc::finalize ( )
overridevirtual

Definition at line 107 of file AthCnvSvc.cxx.

108{
109 ATH_MSG_DEBUG ("releasing all workers");
110 for ( Workers::iterator
111 i = m_workers.begin(),
112 iend = m_workers.end();
113 i != iend;
114 ++i ) {
115 if (!i->second.converter()->finalize().isSuccess()) {
116 ATH_MSG_ERROR ("finalizing worker w/ clid=[{}]", i->first);
117 }
118 i->second.converter()->release();
119 }
120 //m_workers.clear();
121 Workers().swap (m_workers);
122
123 if (m_addressCreator) m_addressCreator->addRef();
124 if (m_dataSvc) m_dataSvc->addRef();
125
127 m_dataSvc = 0;
128
129 return StatusCode::SUCCESS;
130}
#define ATH_MSG_ERROR(x,...)
std::unordered_map< CLID, WorkerEntry > Workers
Definition AthCnvSvc.h:105

◆ initialize()

StatusCode AthCnvSvc::initialize ( )
overridevirtual

Gaudi Service Implementation.

Reimplemented in MuonCalibStreamCnvSvc.

Definition at line 100 of file AthCnvSvc.cxx.

101{
103
104 return StatusCode::SUCCESS;
105}
#define ATH_CHECK
Evaluate an expression and check for errors.
virtual StatusCode setAddressCreator(IAddressCreator *creator) override
Set address creator facility.

◆ initializeConverter()

StatusCode AthCnvSvc::initializeConverter ( long typ,
const CLID & clid,
IConverter * cnv )
protectedvirtual

Initialize the new converter.

Definition at line 485 of file AthCnvSvc.cxx.

487{
488 if (cnv) {
489 return cnv->initialize();
490 }
491 return Status::NO_CONVERTER;
492}

◆ loadConverter()

void AthCnvSvc::loadConverter ( DataObject * pObject)
protectedvirtual

Load converter or dictionary needed by the converter.

Definition at line 507 of file AthCnvSvc.cxx.

508{
509}

◆ makeCall()

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

Definition at line 513 of file AthCnvSvc.cxx.

519{
520 if ( 0 != pAddress || ignore_add ) {
521 if ( 0 != pObject || ignore_obj ) {
522 const CLID& obj_class =
523 (0 != pObject && !ignore_obj) ? pObject->clID()
524 : (0 != pAddress && !ignore_add)
525 ? pAddress->clID()
526 : CLID_NULL;
527 IConverter* cnv = converter(obj_class);
528 if ( !cnv && pObject ) {
529 //Give it a try to autoload the class (dictionary) for which the converter is needed
530 loadConverter( pObject);
531 cnv = converter(obj_class);
532 }
533
534 StatusCode status(StatusCode::FAILURE);
535 if ( 0 != cnv ) {
536 switch(typ) {
537 case CREATE_OBJ:
538 status = cnv->createObj(pAddress, pObject);
539 break;
540 case FILL_OBJ_REFS:
541 status = cnv->fillObjRefs(pAddress, pObject);
542 break;
543 case UPDATE_OBJ:
544 status = cnv->updateObj(pAddress, pObject);
545 break;
546 case UPDATE_OBJ_REFS:
547 status = cnv->updateObjRefs(pAddress, pObject);
548 break;
549 case CREATE_REP:
550 status = cnv->createRep(pObject, pAddress);
551 break;
552 case FILL_REP_REFS:
553 status = cnv->fillRepRefs(pAddress, pObject);
554 break;
555 case UPDATE_REP:
556 status = cnv->updateRep(pAddress, pObject);
557 break;
558 case UPDATE_REP_REFS:
559 status = cnv->updateRepRefs(pAddress, pObject);
560 break;
561 default:
562 status = StatusCode::FAILURE;
563 break;
564 }
565 if ( status.isSuccess() && update ) {
566 status = updateServiceState(pAddress);
567 }
568 return status;
569 }
570 status.ignore();
571 ATH_MSG_INFO("No converter for object {} CLID={}",
572 pObject != 0 ? System::typeinfoName(typeid(*pObject)) : "",
573 obj_class);
574 return Status::NO_CONVERTER;
575 }
576 return Status::INVALID_OBJECT;
577 }
578 return Status::INVALID_ADDRESS;
579}
@ UPDATE_OBJ
Definition AthCnvSvc.cxx:32
@ UPDATE_REP
Definition AthCnvSvc.cxx:36
@ UPDATE_REP_REFS
Definition AthCnvSvc.cxx:37
@ UPDATE_OBJ_REFS
Definition AthCnvSvc.cxx:33
virtual StatusCode updateServiceState(IOpaqueAddress *pAddress)
Update state of the service.
virtual void loadConverter(DataObject *pObject)
Load converter or dictionary needed by the converter.
virtual IConverter * converter(const CLID &wanted) override
Retrieve converter from list.

◆ objType()

const CLID & AthCnvSvc::objType ( ) const
overridevirtual

Implementation of IConverter: dummy call.

Definition at line 143 of file AthCnvSvc.cxx.

144{
145 return CLID_NULL;
146}

◆ operator=()

AthCnvSvc & AthCnvSvc::operator= ( const AthCnvSvc & )
private

◆ removeConverter()

StatusCode AthCnvSvc::removeConverter ( const CLID & clid)
overridevirtual

Remove converter object from conversion service (if present).

Definition at line 339 of file AthCnvSvc.cxx.

340{
341 Workers::iterator worker = m_workers.find (clid);
342 if ( worker != m_workers.end() ) {
343 worker->second.converter()->finalize().ignore();
344 worker->second.converter()->release();
345
346 m_workers.erase (worker);
347 return StatusCode::SUCCESS;
348 }
349 return Status::NO_CONVERTER;
350}

◆ repSvcType()

long AthCnvSvc::repSvcType ( ) const
overridevirtual

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

Definition at line 136 of file AthCnvSvc.cxx.

137{
138 return m_type;
139}

◆ setAddressCreator()

StatusCode AthCnvSvc::setAddressCreator ( IAddressCreator * creator)
overridevirtual

Set address creator facility.

Definition at line 203 of file AthCnvSvc.cxx.

204{
205 m_addressCreator = creator;
206 Workers::iterator stop = m_workers.end();
207 Workers::iterator start = m_workers.begin();
208 for(Workers::iterator i=start; i != stop; ++i ) {
209 IConverter* cnv = i->second.converter();
210 if ( 0 != cnv ) {
211 if (cnv->setAddressCreator(m_addressCreator).isFailure()) {
212 ATH_MSG_ERROR ("setting Address Creator");
213 }
214 }
215 }
216 return StatusCode::SUCCESS;
217}

◆ setConversionSvc()

StatusCode AthCnvSvc::setConversionSvc ( IConversionSvc * svc)
overridevirtual

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

Definition at line 188 of file AthCnvSvc.cxx.

189{
190 return StatusCode::FAILURE;
191}

◆ setDataProvider()

StatusCode AthCnvSvc::setDataProvider ( IDataProviderSvc * pDataSvc)
overridevirtual

Implementation of IConverter: Set Data provider service.

Returns
Status code indicating success or failure
Parameters
pServicePointer to data provider service

Definition at line 153 of file AthCnvSvc.cxx.

154{
155 if ( !pDataSvc ) return StatusCode::SUCCESS; //Atlas does not use DataSvc
156 if ( m_dataSvc ) m_dataSvc->release();
157 m_dataSvc = pDataSvc;
158 m_dataSvc->addRef();
159 Workers::iterator stop = m_workers.end();
160 Workers::iterator start = m_workers.begin();
161 for(Workers::iterator i=start; i != stop; ++i ) {
162 IConverter* cnv = i->second.converter();
163 if ( 0 != cnv ) {
164 if (cnv->setDataProvider(m_dataSvc).isFailure()) {
165 ATH_MSG_ERROR ("setting Data Provider");
166 }
167 }
168 }
169 return StatusCode::SUCCESS;
170}

◆ updateObj()

StatusCode AthCnvSvc::updateObj ( IOpaqueAddress * pAddress,
DataObject * refpObject )
overridevirtual

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

Definition at line 249 of file AthCnvSvc.cxx.

250{
251 return makeCall (UPDATE_OBJ, false, true, false, pAddress, pObject);
252}

◆ updateObjRefs()

StatusCode AthCnvSvc::updateObjRefs ( IOpaqueAddress * pAddress,
DataObject * pObject )
overridevirtual

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

Definition at line 257 of file AthCnvSvc.cxx.

258{
259 return makeCall (UPDATE_OBJ_REFS, false, true, true, pAddress, pObject);
260}

◆ updateRep()

StatusCode AthCnvSvc::updateRep ( IOpaqueAddress * pAddress,
DataObject * pObject )
overridevirtual

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

Definition at line 281 of file AthCnvSvc.cxx.

282{
283 return makeCall (UPDATE_REP, true, false, false, pAddress, pObject);
284}

◆ updateRepRefs()

StatusCode AthCnvSvc::updateRepRefs ( IOpaqueAddress * pAddress,
DataObject * pObject )
overridevirtual

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

Definition at line 289 of file AthCnvSvc.cxx.

290{
291 return makeCall (UPDATE_REP_REFS, true, false, false, pAddress, pObject);
292}

◆ updateServiceState()

StatusCode AthCnvSvc::updateServiceState ( IOpaqueAddress * pAddress)
virtual

Update state of the service.

Reimplemented in MuonCalibStreamCnvSvc.

Definition at line 439 of file AthCnvSvc.cxx.

440{
441 return StatusCode::SUCCESS;
442}

◆ SvcFactory< AthCnvSvc >

friend class SvcFactory< AthCnvSvc >
friend

Definition at line 1 of file AthCnvSvc.h.

Member Data Documentation

◆ m_addressCreator

SmartIF<IAddressCreator> AthCnvSvc::m_addressCreator
protected

Pointer to the address creation service interface.

Definition at line 312 of file AthCnvSvc.h.

◆ m_convsvc_mut

CallMutex AthCnvSvc::m_convsvc_mut
protected

Definition at line 319 of file AthCnvSvc.h.

◆ m_dataSvc

SmartIF<IDataProviderSvc> AthCnvSvc::m_dataSvc
protected

Pointer to data provider service.

Definition at line 310 of file AthCnvSvc.h.

◆ m_type

long AthCnvSvc::m_type
protected

Conversion service type.

Definition at line 314 of file AthCnvSvc.h.

◆ m_workers

Workers AthCnvSvc::m_workers
protected

List of conversion workers.

Definition at line 316 of file AthCnvSvc.h.


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