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, WorkerEntryWorkers

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 CLIDobjType () 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 () const 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.
SmartIF< IConversionSvc > m_cnvSvc
 Pointer to the IConversionSvc interface of this.
long m_type
 Conversion service type.
Workers m_workers
 List of conversion workers.
CallMutex m_conv_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 &)
AthCnvSvcoperator= (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 320 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:318
SmartIF< IAddressCreator > m_addressCreator
Pointer to the address creation service interface.
Definition AthCnvSvc.h:312
long m_type
Conversion service type.
Definition AthCnvSvc.h:316

◆ 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_cnvSvc) {
71 m_cnvSvc->addRef();
72 m_cnvSvc = 0;
73 }
74 if (m_addressCreator) {
75 m_addressCreator->addRef();
77 }
78 if (m_dataSvc) {
79 m_dataSvc->addRef();
80 m_dataSvc = 0;
81 }
82
83 ATH_MSG_DEBUG ("release-ing all workers (" << m_workers.size() << ")...");
84 for ( Workers::iterator
85 i = m_workers.begin(),
86 iend = m_workers.end();
87 i != iend;
88 ++i ) {
89 IConverter *cnv = i->second.m_converter;
90 if (cnv) {
91
92 if (!cnv->release()) {
93 i->second.m_converter = 0;
94 }
95 }
96 }
97 ATH_MSG_DEBUG ("release-ing all workers (" << m_workers.size() << ")... [done]");
98 m_workers.clear();
99
100}
#define ATH_MSG_DEBUG(x)
SmartIF< IConversionSvc > m_cnvSvc
Pointer to the IConversionSvc interface of this.
Definition AthCnvSvc.h:314

Member Function Documentation

◆ activateConverter()

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

Activate the new converter after initialization.

Definition at line 507 of file AthCnvSvc.cxx.

509{
510 if (cnv) {
511 return StatusCode::SUCCESS;
512 }
513 return Status::NO_CONVERTER;
514}

◆ addConverter() [1/2]

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

Add converter object to conversion service.

Definition at line 307 of file AthCnvSvc.cxx.

308{
309 // First look for the more specific converter
310 long typ = repSvcType();
311 IConverter* pConverter = createConverter(typ, clid, 0);
312 if ( 0 != pConverter ) {
313 StatusCode status = configureConverter( typ, clid, pConverter );
314 if ( status.isSuccess() ) {
315 status = initializeConverter( typ, clid, pConverter );
316 if ( status.isSuccess() ) {
317 status = activateConverter( typ, clid, pConverter );
318 if ( status.isSuccess() ) {
319 long conv_typ = pConverter->repSvcType();
320 const CLID& conv_clid = pConverter->objType();
321 typ = (typ<0xFF) ? typ : typ&0xFFFFFF00;
322 conv_typ = (conv_typ<0xFF) ? conv_typ : conv_typ&0xFFFFFF00;
323 if ( conv_typ == typ && conv_clid == clid ) {
324 return addConverter(pConverter);
325 }
326 }
327 }
328 }
329 pConverter->release();
330 }
331 return Status::NO_CONVERTER;
332}
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 336 of file AthCnvSvc.cxx.

337{
338 if ( 0 != pConverter ) {
339 const CLID& clid = pConverter->objType();
340 removeConverter(clid).ignore();
341 m_workers.insert (std::make_pair(clid,WorkerEntry(clid, pConverter)));
342 pConverter->addRef();
343 return StatusCode::SUCCESS;
344 }
345 return Status::NO_CONVERTER;
346}
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 232 of file AthCnvSvc.cxx.

233{
234 // FIXME: Ideally the return type should be const, but that would require
235 // changes in the Gaudi IConverter base class.
236 SmartIF<IAddressCreator>& svc ATLAS_THREAD_SAFE =
237 const_cast<SmartIF<IAddressCreator>&>(m_addressCreator);
238 return svc;
239}
#define ATLAS_THREAD_SAFE
AthROOTErrorHandlerSvc * svc

◆ commitOutput()

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

Commit pending output.

Definition at line 400 of file AthCnvSvc.cxx.

401{
402 return StatusCode::SUCCESS;
403}

◆ configureConverter()

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

Configure the new converter before initialize is called.

Definition at line 481 of file AthCnvSvc.cxx.

483{
484 if (cnv) {
485 cnv->setConversionSvc(this).ignore();
486 cnv->setAddressCreator(m_addressCreator).ignore();
487 cnv->setDataProvider(m_dataSvc).ignore();
488 return StatusCode::SUCCESS;
489 }
490 return Status::NO_CONVERTER;
491
492}

◆ connectOutput() [1/2]

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

Connect the output file to the service.

Definition at line 393 of file AthCnvSvc.cxx.

394{
395 return StatusCode::SUCCESS;
396}

◆ 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 385 of file AthCnvSvc.cxx.

387{
388 return connectOutput (outputFile);
389}
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 ( ) const
overridevirtual

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

Definition at line 203 of file AthCnvSvc.cxx.

204{
205 // FIXME: Ideally the return type should be const, but that would require
206 // changes in the Gaudi IConverter base class.
207 SmartIF<IConversionSvc>& svc ATLAS_THREAD_SAFE =
208 const_cast<SmartIF<IConversionSvc>&>(m_cnvSvc);
209 return svc;
210}

◆ convertAddress()

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

Convert an address to string form.

Definition at line 430 of file AthCnvSvc.cxx.

432{
433 refAddress = "";
434 return StatusCode::FAILURE;
435}

◆ converter()

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

Retrieve converter from list.

Definition at line 365 of file AthCnvSvc.cxx.

366{
367 std::lock_guard<CallMutex> lock(m_conv_mut);
368 Workers::iterator worker = m_workers.find (clid);
369 if ( worker != m_workers.end() ) {
370 return worker->second.converter();
371 }
372 if (addConverter (clid).isSuccess()) {
373 worker = m_workers.find (clid);
374 if (worker != m_workers.end()) {
375 return worker->second.converter();
376 }
377 } else {
378 ATH_MSG_INFO("problem adding converter for CLID [" << clid << "]");
379 }
380 return 0;
381}
#define ATH_MSG_INFO(x)
CallMutex m_conv_mut
Definition AthCnvSvc.h:321

◆ 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 439 of file AthCnvSvc.cxx.

443{
444 refpAddress = 0;
445 return StatusCode::FAILURE;
446}

◆ 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 418 of file AthCnvSvc.cxx.

423{
424 refpAddress = 0;
425 return StatusCode::FAILURE;
426}

◆ createConverter()

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

Create new Converter using factory.

Definition at line 462 of file AthCnvSvc.cxx.

465{
466
467 std::unique_ptr<IConverter> cnv{Converter::Factory::create
468 (ConverterID(typ,clid), serviceLocator().get() )};
469
470 if (!cnv) {
471 typ = (typ<0xFF) ? typ : typ&0xFFFFFF00;
472 cnv = Converter::Factory::create
473 (ConverterID(typ,clid), serviceLocator().get() );
474 }
475 return cnv.release();
476
477}
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:130

◆ createObj()

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

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

Definition at line 244 of file AthCnvSvc.cxx.

245{
246 return makeCall (CREATE_OBJ, false, true, false, pAddress, refpObject);
247}
@ 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 276 of file AthCnvSvc.cxx.

277{
278 return makeCall (CREATE_REP, true, false, false, refpAddress, pObject);
279}
@ 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 183 of file AthCnvSvc.cxx.

184{
185 // FIXME: Ideally the return type should be const, but that would require
186 // changes in the Gaudi IConverter base class.
187 SmartIF<IDataProviderSvc>& svc ATLAS_THREAD_SAFE =
188 const_cast<SmartIF<IDataProviderSvc>&>(m_dataSvc);
189 return svc;
190}

◆ disconnectOutput()

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

Disconnect output files from the service.

Definition at line 408 of file AthCnvSvc.cxx.

409{
410 return StatusCode::SUCCESS;
411}

◆ fillObjRefs()

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

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

Definition at line 252 of file AthCnvSvc.cxx.

253{
254 return makeCall (FILL_OBJ_REFS, false, true, true, pAddress, pObject);
255}
@ 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 284 of file AthCnvSvc.cxx.

285{
286 return makeCall (FILL_REP_REFS, true, false, false, pAddress, pObject);
287}
@ FILL_REP_REFS
Definition AthCnvSvc.cxx:35

◆ finalize()

StatusCode AthCnvSvc::finalize ( )
overridevirtual

Definition at line 112 of file AthCnvSvc.cxx.

113{
114 ATH_MSG_DEBUG ("releasing all workers");
115 for ( Workers::iterator
116 i = m_workers.begin(),
117 iend = m_workers.end();
118 i != iend;
119 ++i ) {
120 if (!i->second.converter()->finalize().isSuccess()) {
121 ATH_MSG_ERROR ("finalizing worker w/ clid=[" << i->first << "]");
122 }
123 i->second.converter()->release();
124 }
125 //m_workers.clear();
126 Workers().swap (m_workers);
127
128 if (m_addressCreator) m_addressCreator->addRef();
129 if (m_dataSvc) m_dataSvc->addRef();
130 if (m_cnvSvc) m_cnvSvc->addRef();
131
133 m_dataSvc = 0;
134 m_cnvSvc = 0;
135
136 return StatusCode::SUCCESS;
137}
#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 104 of file AthCnvSvc.cxx.

105{
106 m_cnvSvc = this; // needed for conversionSvc()
108
109 return StatusCode::SUCCESS;
110}
#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 496 of file AthCnvSvc.cxx.

498{
499 if (cnv) {
500 return cnv->initialize();
501 }
502 return Status::NO_CONVERTER;
503}

◆ loadConverter()

void AthCnvSvc::loadConverter ( DataObject * pObject)
protectedvirtual

Load converter or dictionary needed by the converter.

Definition at line 518 of file AthCnvSvc.cxx.

519{
520}

◆ makeCall()

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

Definition at line 524 of file AthCnvSvc.cxx.

530{
531 if ( 0 != pAddress || ignore_add ) {
532 if ( 0 != pObject || ignore_obj ) {
533 const CLID& obj_class =
534 (0 != pObject && !ignore_obj) ? pObject->clID()
535 : (0 != pAddress && !ignore_add)
536 ? pAddress->clID()
537 : CLID_NULL;
538 IConverter* cnv = converter(obj_class);
539 if ( !cnv && pObject ) {
540 //Give it a try to autoload the class (dictionary) for which the converter is needed
541 loadConverter( pObject);
542 cnv = converter(obj_class);
543 }
544
545 StatusCode status(StatusCode::FAILURE);
546 if ( 0 != cnv ) {
547 switch(typ) {
548 case CREATE_OBJ:
549 status = cnv->createObj(pAddress, pObject);
550 break;
551 case FILL_OBJ_REFS:
552 status = cnv->fillObjRefs(pAddress, pObject);
553 break;
554 case UPDATE_OBJ:
555 status = cnv->updateObj(pAddress, pObject);
556 break;
557 case UPDATE_OBJ_REFS:
558 status = cnv->updateObjRefs(pAddress, pObject);
559 break;
560 case CREATE_REP:
561 status = cnv->createRep(pObject, pAddress);
562 break;
563 case FILL_REP_REFS:
564 status = cnv->fillRepRefs(pAddress, pObject);
565 break;
566 case UPDATE_REP:
567 status = cnv->updateRep(pAddress, pObject);
568 break;
569 case UPDATE_REP_REFS:
570 status = cnv->updateRepRefs(pAddress, pObject);
571 break;
572 default:
573 status = StatusCode::FAILURE;
574 break;
575 }
576 if ( status.isSuccess() && update ) {
577 status = updateServiceState(pAddress);
578 }
579 return status;
580 }
581 status.ignore();
582 msg(MSG::INFO) << "No converter for object ";
583 if ( pObject != 0 ) {
584 msg(MSG::INFO) << System::typeinfoName(typeid(*pObject));
585 }
586 msg(MSG::INFO) << " CLID= " << obj_class << endmsg;
587 return Status::NO_CONVERTER;
588 }
589 return Status::INVALID_OBJECT;
590 }
591 return Status::INVALID_ADDRESS;
592}
#define endmsg
@ 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.
MsgStream & msg
Definition testRead.cxx:32

◆ objType()

const CLID & AthCnvSvc::objType ( ) const
overridevirtual

Implementation of IConverter: dummy call.

Definition at line 150 of file AthCnvSvc.cxx.

151{
152 return CLID_NULL;
153}

◆ 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 350 of file AthCnvSvc.cxx.

351{
352 Workers::iterator worker = m_workers.find (clid);
353 if ( worker != m_workers.end() ) {
354 worker->second.converter()->finalize().ignore();
355 worker->second.converter()->release();
356
357 m_workers.erase (worker);
358 return StatusCode::SUCCESS;
359 }
360 return Status::NO_CONVERTER;
361}

◆ repSvcType()

long AthCnvSvc::repSvcType ( ) const
overridevirtual

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

Definition at line 143 of file AthCnvSvc.cxx.

144{
145 return m_type;
146}

◆ setAddressCreator()

StatusCode AthCnvSvc::setAddressCreator ( IAddressCreator * creator)
overridevirtual

Set address creator facility.

Definition at line 214 of file AthCnvSvc.cxx.

215{
216 m_addressCreator = creator;
217 Workers::iterator stop = m_workers.end();
218 Workers::iterator start = m_workers.begin();
219 for(Workers::iterator i=start; i != stop; ++i ) {
220 IConverter* cnv = i->second.converter();
221 if ( 0 != cnv ) {
222 if (cnv->setAddressCreator(m_addressCreator).isFailure()) {
223 ATH_MSG_ERROR ("setting Address Creator");
224 }
225 }
226 }
227 return StatusCode::SUCCESS;
228}

◆ setConversionSvc()

StatusCode AthCnvSvc::setConversionSvc ( IConversionSvc * svc)
overridevirtual

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

Definition at line 195 of file AthCnvSvc.cxx.

196{
197 return StatusCode::FAILURE;
198}

◆ 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 160 of file AthCnvSvc.cxx.

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

◆ updateObj()

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

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

Definition at line 260 of file AthCnvSvc.cxx.

261{
262 return makeCall (UPDATE_OBJ, false, true, false, pAddress, pObject);
263}

◆ updateObjRefs()

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

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

Definition at line 268 of file AthCnvSvc.cxx.

269{
270 return makeCall (UPDATE_OBJ_REFS, false, true, true, pAddress, pObject);
271}

◆ updateRep()

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

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

Definition at line 292 of file AthCnvSvc.cxx.

293{
294 return makeCall (UPDATE_REP, true, false, false, pAddress, pObject);
295}

◆ updateRepRefs()

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

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

Definition at line 300 of file AthCnvSvc.cxx.

301{
302 return makeCall (UPDATE_REP_REFS, true, false, false, pAddress, pObject);
303}

◆ updateServiceState()

StatusCode AthCnvSvc::updateServiceState ( IOpaqueAddress * pAddress)
virtual

Update state of the service.

Reimplemented in MuonCalibStreamCnvSvc.

Definition at line 450 of file AthCnvSvc.cxx.

451{
452 return StatusCode::SUCCESS;
453}

◆ 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_cnvSvc

SmartIF<IConversionSvc> AthCnvSvc::m_cnvSvc
protected

Pointer to the IConversionSvc interface of this.

Definition at line 314 of file AthCnvSvc.h.

◆ m_conv_mut

CallMutex AthCnvSvc::m_conv_mut
protected

Definition at line 321 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 316 of file AthCnvSvc.h.

◆ m_workers

Workers AthCnvSvc::m_workers
protected

List of conversion workers.

Definition at line 318 of file AthCnvSvc.h.


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