ATLAS Offline Software
Classes | Public Types | Public Member Functions | Friends | List of all members
AthCnvSvc Class Reference

#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: More...
 
virtual StatusCode initialize ()
 Gaudi Service Implementation. More...
 
virtual StatusCode finalize ()
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Friends

class SvcFactory< AthCnvSvc >
 

@c IConversionSvc implementation

virtual long repSvcType () const
 Retrieve the class type of the data store the converter uses. More...
 
const CLIDobjType () 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 disconnectOutput (const std::string &output)
 Disconnect output files from the service. More...
 

@c IAddressCreator interface implementation

typedef std::recursive_mutex CallMutex
 Mutex to protect Converter creation. More...
 
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...
 
Workers m_workers
 List of conversion workers. More...
 
CallMutex m_conv_mut
 
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...
 
 AthCnvSvc ()
 Default constructor: More...
 
 AthCnvSvc (const AthCnvSvc &)
 
AthCnvSvcoperator= (const AthCnvSvc &)
 
virtual ~AthCnvSvc ()
 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)
 

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:

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 323 of file AthCnvSvc.h.

◆ Workers

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

Definition at line 106 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  ::AthService (name, pSvcLocator),
50  m_dataSvc (0),
52  m_type (type),
53  m_workers ( )
54 {
55  //
56  // Property declaration
57  //
58  //declareProperty( "Property", m_nProperty );
59  AthCnvSvc::setAddressCreator(this).ignore();
60 
61  m_cnvSvc = this;
62 }

◆ AthCnvSvc() [2/3]

AthCnvSvc::AthCnvSvc ( )
private

Default constructor:

◆ AthCnvSvc() [3/3]

AthCnvSvc::AthCnvSvc ( const AthCnvSvc )
private

◆ ~AthCnvSvc()

AthCnvSvc::~AthCnvSvc ( )
protectedvirtual

Destructor:

Definition at line 66 of file AthCnvSvc.cxx.

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

Member Function Documentation

◆ activateConverter()

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

Activate the new converter after initialization.

Definition at line 536 of file AthCnvSvc.cxx.

538 {
539  if (cnv) {
540  return StatusCode::SUCCESS;
541  }
542  return Status::NO_CONVERTER;
543 }

◆ addConverter() [1/2]

StatusCode AthCnvSvc::addConverter ( const CLID clid)
virtual

Add converter object to conversion service.

Definition at line 336 of file AthCnvSvc.cxx.

337 {
338  // First look for the more specific converter
339  long typ = repSvcType();
340  IConverter* pConverter = createConverter(typ, clid, 0);
341  if ( 0 != pConverter ) {
342  StatusCode status = configureConverter( typ, clid, pConverter );
343  if ( status.isSuccess() ) {
344  status = initializeConverter( typ, clid, pConverter );
345  if ( status.isSuccess() ) {
346  status = activateConverter( typ, clid, pConverter );
347  if ( status.isSuccess() ) {
348  long conv_typ = pConverter->repSvcType();
349  const CLID& conv_clid = pConverter->objType();
350  typ = (typ<0xFF) ? typ : typ&0xFFFFFF00;
351  conv_typ = (conv_typ<0xFF) ? conv_typ : conv_typ&0xFFFFFF00;
352  if ( conv_typ == typ && conv_clid == clid ) {
353  return addConverter(pConverter);
354  }
355  }
356  }
357  }
358  pConverter->release();
359  }
360  return Status::NO_CONVERTER;
361 }

◆ addConverter() [2/2]

StatusCode AthCnvSvc::addConverter ( IConverter *  pConverter)
virtual

Add converter object to conversion service.

Definition at line 365 of file AthCnvSvc.cxx.

366 {
367  if ( 0 != pConverter ) {
368  const CLID& clid = pConverter->objType();
369  removeConverter(clid).ignore();
370  m_workers.insert (std::make_pair(clid,WorkerEntry(clid, pConverter)));
371  pConverter->addRef();
372  return StatusCode::SUCCESS;
373  }
374  return Status::NO_CONVERTER;
375 }

◆ addressCreator() [1/2]

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

Retrieve address creation interface.

Definition at line 300 of file AthCnvSvc.h.

301  {
302  return m_addressCreator;
303  }

◆ addressCreator() [2/2]

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

Retrieve address creator facility.

Definition at line 261 of file AthCnvSvc.cxx.

262 {
263  // FIXME: Ideally the return type should be const, but that would require
264  // changes in the Gaudi IConverter base class.
265  SmartIF<IAddressCreator>& svc ATLAS_THREAD_SAFE =
266  const_cast<SmartIF<IAddressCreator>&>(m_addressCreator);
267  return svc;
268 }

◆ commitOutput()

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

Commit pending output.

Reimplemented in TrigByteStreamCnvSvc, Athena::NtupleCnvSvc, Athena::xAODCnvSvc, AthenaPoolCnvSvc, ByteStreamCnvSvc, and Athena::RootCnvSvc.

Definition at line 429 of file AthCnvSvc.cxx.

430 {
431  return StatusCode::SUCCESS;
432 }

◆ configureConverter()

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

Configure the new converter before initialize is called.

Definition at line 510 of file AthCnvSvc.cxx.

512 {
513  if (cnv) {
514  cnv->setConversionSvc(this).ignore();
515  cnv->setAddressCreator(m_addressCreator).ignore();
516  cnv->setDataProvider(m_dataSvc).ignore();
517  return StatusCode::SUCCESS;
518  }
519  return Status::NO_CONVERTER;
520 
521 }

◆ connectOutput() [1/2]

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

Connect the output file to the service.

Reimplemented in ByteStreamCnvSvc, TrigByteStreamCnvSvc, Athena::NtupleCnvSvc, Athena::xAODCnvSvc, AthenaPoolCnvSvc, and Athena::RootCnvSvc.

Definition at line 422 of file AthCnvSvc.cxx.

423 {
424  return StatusCode::SUCCESS;
425 }

◆ connectOutput() [2/2]

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

Connect the output file to the service with open mode.

Reimplemented in ByteStreamCnvSvc, TrigByteStreamCnvSvc, Athena::NtupleCnvSvc, Athena::xAODCnvSvc, AthenaPoolCnvSvc, and Athena::RootCnvSvc.

Definition at line 414 of file AthCnvSvc.cxx.

416 {
417  return connectOutput (outputFile);
418 }

◆ conversionSvc()

SmartIF< IConversionSvc > & AthCnvSvc::conversionSvc ( ) const
virtual

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

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<IConversionSvc>& svc ATLAS_THREAD_SAFE =
237  const_cast<SmartIF<IConversionSvc>&>(m_cnvSvc);
238  return svc;
239 }

◆ convertAddress()

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

Convert an address to string form.

Reimplemented in AthenaPoolCnvSvc, Athena::NtupleCnvSvc, Athena::xAODCnvSvc, and Athena::RootCnvSvc.

Definition at line 459 of file AthCnvSvc.cxx.

461 {
462  refAddress = "";
463  return StatusCode::FAILURE;
464 }

◆ converter()

IConverter * AthCnvSvc::converter ( const CLID wanted)
virtual

Retrieve converter from list.

Definition at line 394 of file AthCnvSvc.cxx.

395 {
396  std::lock_guard<CallMutex> lock(m_conv_mut);
397  Workers::iterator worker = m_workers.find (clid);
398  if ( worker != m_workers.end() ) {
399  return worker->second.converter();
400  }
401  if (addConverter (clid).isSuccess()) {
402  worker = m_workers.find (clid);
403  if (worker != m_workers.end()) {
404  return worker->second.converter();
405  }
406  } else {
407  ATH_MSG_INFO("problem adding converter for CLID [" << clid << "]");
408  }
409  return 0;
410 }

◆ createAddress() [1/2]

StatusCode AthCnvSvc::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 Athena::NtupleCnvSvc, Athena::xAODCnvSvc, AthenaPoolCnvSvc, and Athena::RootCnvSvc.

Definition at line 468 of file AthCnvSvc.cxx.

472 {
473  refpAddress = 0;
474  return StatusCode::FAILURE;
475 }

◆ createAddress() [2/2]

StatusCode AthCnvSvc::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 Athena::NtupleCnvSvc, Athena::xAODCnvSvc, AthenaPoolCnvSvc, and Athena::RootCnvSvc.

Definition at line 447 of file AthCnvSvc.cxx.

452 {
453  refpAddress = 0;
454  return StatusCode::FAILURE;
455 }

◆ createConverter()

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

Create new Converter using factory.

Reimplemented in Athena::NtupleCnvSvc, Athena::xAODCnvSvc, and Athena::RootCnvSvc.

Definition at line 491 of file AthCnvSvc.cxx.

494 {
495 
496  std::unique_ptr<IConverter> cnv{Converter::Factory::create
497  (ConverterID(typ,clid), serviceLocator().get() )};
498 
499  if (!cnv) {
500  typ = (typ<0xFF) ? typ : typ&0xFFFFFF00;
501  cnv = Converter::Factory::create
502  (ConverterID(typ,clid), serviceLocator().get() );
503  }
504  return cnv.release();
505 
506 }

◆ createObj()

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

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

Reimplemented in Athena::NtupleCnvSvc, Athena::xAODCnvSvc, and AthenaPoolCnvSvc.

Definition at line 273 of file AthCnvSvc.cxx.

274 {
275  return makeCall (CREATE_OBJ, false, true, false, pAddress, refpObject);
276 }

◆ createRep()

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

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

Reimplemented in Athena::NtupleCnvSvc, Athena::xAODCnvSvc, and AthenaPoolCnvSvc.

Definition at line 305 of file AthCnvSvc.cxx.

306 {
307  return makeCall (CREATE_REP, true, false, false, refpAddress, pObject);
308 }

◆ dataProvider()

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

Implementation of IConverter: Get Data provider service.

Returns
Pointer to data provider service

Definition at line 212 of file AthCnvSvc.cxx.

213 {
214  // FIXME: Ideally the return type should be const, but that would require
215  // changes in the Gaudi IConverter base class.
216  SmartIF<IDataProviderSvc>& svc ATLAS_THREAD_SAFE =
217  const_cast<SmartIF<IDataProviderSvc>&>(m_dataSvc);
218  return svc;
219 }

◆ disconnectOutput()

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

Disconnect output files from the service.

Reimplemented in AthenaPoolCnvSvc.

Definition at line 437 of file AthCnvSvc.cxx.

438 {
439  return StatusCode::SUCCESS;
440 }

◆ fillObjRefs()

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

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

Definition at line 281 of file AthCnvSvc.cxx.

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

◆ fillRepRefs()

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

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


Reimplemented in Athena::NtupleCnvSvc, Athena::xAODCnvSvc, and AthenaPoolCnvSvc.

Definition at line 313 of file AthCnvSvc.cxx.

314 {
315  return makeCall (FILL_REP_REFS, true, false, false, pAddress, pObject);
316 }

◆ finalize()

StatusCode AthCnvSvc::finalize ( )
virtual

Reimplemented in ByteStreamCnvSvc, TrigByteStreamCnvSvc, AthenaPoolCnvSvc, Athena::NtupleCnvSvc, Athena::xAODCnvSvc, and Athena::RootCnvSvc.

Definition at line 116 of file AthCnvSvc.cxx.

117 {
118  ATH_MSG_DEBUG ("releasing all workers");
119  for ( Workers::iterator
120  i = m_workers.begin(),
121  iend = m_workers.end();
122  i != iend;
123  ++i ) {
124  if (!i->second.converter()->finalize().isSuccess()) {
125  ATH_MSG_ERROR ("finalizing worker w/ clid=[" << i->first << "]");
126  }
127  i->second.converter()->release();
128  }
129  //m_workers.clear();
130  Workers().swap (m_workers);
131 
132  if (m_addressCreator) m_addressCreator->addRef();
133  if (m_dataSvc) m_dataSvc->addRef();
134  if (m_cnvSvc) m_cnvSvc->addRef();
135 
136  m_addressCreator = 0;
137  m_dataSvc = 0;
138  m_cnvSvc = 0;
139 
140  return StatusCode::SUCCESS;
141 }

◆ initialize()

StatusCode AthCnvSvc::initialize ( )
virtual

Gaudi Service Implementation.

Reimplemented in ByteStreamCnvSvc, TrigByteStreamCnvSvc, ByteStreamCnvSvcBase, Athena::NtupleCnvSvc, Athena::xAODCnvSvc, AthenaPoolCnvSvc, Athena::RootCnvSvc, and MuonCalibStreamCnvSvc.

Definition at line 111 of file AthCnvSvc.cxx.

112 {
113  return StatusCode::SUCCESS;
114 }

◆ initializeConverter()

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

Initialize the new converter.

Definition at line 525 of file AthCnvSvc.cxx.

527 {
528  if (cnv) {
529  return cnv->initialize();
530  }
531  return Status::NO_CONVERTER;
532 }

◆ loadConverter()

void AthCnvSvc::loadConverter ( DataObject *  pObject)
protectedvirtual

Load converter or dictionary needed by the converter.

Definition at line 547 of file AthCnvSvc.cxx.

548 {
549 }

◆ makeCall()

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

Definition at line 553 of file AthCnvSvc.cxx.

559 {
560  if ( 0 != pAddress || ignore_add ) {
561  if ( 0 != pObject || ignore_obj ) {
562  const CLID& obj_class =
563  (0 != pObject && !ignore_obj) ? pObject->clID()
564  : (0 != pAddress && !ignore_add)
565  ? pAddress->clID()
566  : CLID_NULL;
567  IConverter* cnv = converter(obj_class);
568  if ( !cnv && pObject ) {
569  //Give it a try to autoload the class (dictionary) for which the converter is needed
570  loadConverter( pObject);
571  cnv = converter(obj_class);
572  }
573 
574  StatusCode status(StatusCode::FAILURE);
575  if ( 0 != cnv ) {
576  switch(typ) {
577  case CREATE_OBJ:
578  status = cnv->createObj(pAddress, pObject);
579  break;
580  case FILL_OBJ_REFS:
581  status = cnv->fillObjRefs(pAddress, pObject);
582  break;
583  case UPDATE_OBJ:
584  status = cnv->updateObj(pAddress, pObject);
585  break;
586  case UPDATE_OBJ_REFS:
587  status = cnv->updateObjRefs(pAddress, pObject);
588  break;
589  case CREATE_REP:
590  status = cnv->createRep(pObject, pAddress);
591  break;
592  case FILL_REP_REFS:
593  status = cnv->fillRepRefs(pAddress, pObject);
594  break;
595  case UPDATE_REP:
596  status = cnv->updateRep(pAddress, pObject);
597  break;
598  case UPDATE_REP_REFS:
599  status = cnv->updateRepRefs(pAddress, pObject);
600  break;
601  default:
602  status = StatusCode::FAILURE;
603  break;
604  }
605  if ( status.isSuccess() && update ) {
606  status = updateServiceState(pAddress);
607  }
608  return status;
609  }
610  status.ignore();
611  msg(MSG::INFO) << "No converter for object ";
612  if ( pObject != 0 ) {
613  msg(MSG::INFO) << System::typeinfoName(typeid(*pObject));
614  }
615  msg(MSG::INFO) << " CLID= " << obj_class << endmsg;
616  return Status::NO_CONVERTER;
617  }
618  return Status::INVALID_OBJECT;
619  }
620  return Status::INVALID_ADDRESS;
621 }

◆ msg() [1/2]

MsgStream& AthCommonMsg< Service >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< Service >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< Service >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ objType()

const CLID & AthCnvSvc::objType ( ) const

Implementation of IConverter: dummy call.

Definition at line 179 of file AthCnvSvc.cxx.

180 {
181  return CLID_NULL;
182 }

◆ operator=()

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

◆ queryInterface()

StatusCode AthCnvSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvInterface 
)
virtual

Reimplemented in ByteStreamCnvSvc, ByteStreamCnvSvcBase, AthenaPoolCnvSvc, Athena::NtupleCnvSvc, Athena::xAODCnvSvc, Athena::RootCnvSvc, and MuonCalibStreamCnvSvc.

Definition at line 149 of file AthCnvSvc.cxx.

150 {
151  if ( riid == IConversionSvc::interfaceID() ) {
152  *ppvInterface = (IConversionSvc*)this;
153  }
154  else if ( riid == IConverter::interfaceID() ) {
155  *ppvInterface = (IConverter*)this;
156  }
157  else if ( riid == IAddressCreator::interfaceID() ) {
158  *ppvInterface = (IAddressCreator*)this;
159  }
160  else {
161  // Interface is not directly available: try out a base class
162  return AthService::queryInterface(riid, ppvInterface);
163  }
164  addRef();
165  return StatusCode::SUCCESS;
166 }

◆ removeConverter()

StatusCode AthCnvSvc::removeConverter ( const CLID clid)
virtual

Remove converter object from conversion service (if present).

Definition at line 379 of file AthCnvSvc.cxx.

380 {
381  Workers::iterator worker = m_workers.find (clid);
382  if ( worker != m_workers.end() ) {
383  worker->second.converter()->finalize().ignore();
384  worker->second.converter()->release();
385 
386  m_workers.erase (worker);
387  return StatusCode::SUCCESS;
388  }
389  return Status::NO_CONVERTER;
390 }

◆ repSvcType()

long AthCnvSvc::repSvcType ( ) const
virtual

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

Definition at line 172 of file AthCnvSvc.cxx.

173 {
174  return m_type;
175 }

◆ setAddressCreator()

StatusCode AthCnvSvc::setAddressCreator ( IAddressCreator *  creator)
virtual

Set address creator facility.

Definition at line 243 of file AthCnvSvc.cxx.

244 {
245  m_addressCreator = creator;
248  for(Workers::iterator i=start; i != stop; ++i ) {
249  IConverter* cnv = i->second.converter();
250  if ( 0 != cnv ) {
251  if (cnv->setAddressCreator(m_addressCreator).isFailure()) {
252  ATH_MSG_ERROR ("setting Address Creator");
253  }
254  }
255  }
256  return StatusCode::SUCCESS;
257 }

◆ setConversionSvc()

StatusCode AthCnvSvc::setConversionSvc ( IConversionSvc *  svc)
virtual

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

Definition at line 224 of file AthCnvSvc.cxx.

225 {
226  return StatusCode::FAILURE;
227 }

◆ setDataProvider()

StatusCode AthCnvSvc::setDataProvider ( IDataProviderSvc *  pDataSvc)
virtual

Implementation of IConverter: Set Data provider service.

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

Definition at line 189 of file AthCnvSvc.cxx.

190 {
191  if ( !pDataSvc ) return StatusCode::SUCCESS; //Atlas does not use DataSvc
192  if ( m_dataSvc ) m_dataSvc->release();
193  m_dataSvc = pDataSvc;
194  m_dataSvc->addRef();
197  for(Workers::iterator i=start; i != stop; ++i ) {
198  IConverter* cnv = i->second.converter();
199  if ( 0 != cnv ) {
200  if (cnv->setDataProvider(m_dataSvc).isFailure()) {
201  ATH_MSG_ERROR ("setting Data Provider");
202  }
203  }
204  }
205  return StatusCode::SUCCESS;
206 }

◆ updateObj()

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

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

Definition at line 289 of file AthCnvSvc.cxx.

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

◆ updateObjRefs()

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

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

Definition at line 297 of file AthCnvSvc.cxx.

298 {
299  return makeCall (UPDATE_OBJ_REFS, false, true, true, pAddress, pObject);
300 }

◆ updateRep()

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

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

Definition at line 321 of file AthCnvSvc.cxx.

322 {
323  return makeCall (UPDATE_REP, true, false, false, pAddress, pObject);
324 }

◆ updateRepRefs()

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

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

Definition at line 329 of file AthCnvSvc.cxx.

330 {
331  return makeCall (UPDATE_REP_REFS, true, false, false, pAddress, pObject);
332 }

◆ updateServiceState()

StatusCode AthCnvSvc::updateServiceState ( IOpaqueAddress *  pAddress)
virtual

Update state of the service.

Reimplemented in ByteStreamCnvSvcBase, Athena::RootCnvSvc, Athena::NtupleCnvSvc, Athena::xAODCnvSvc, and MuonCalibStreamCnvSvc.

Definition at line 479 of file AthCnvSvc.cxx.

480 {
481  return StatusCode::SUCCESS;
482 }

Friends And Related Function Documentation

◆ 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 315 of file AthCnvSvc.h.

◆ m_cnvSvc

SmartIF<IConversionSvc> AthCnvSvc::m_cnvSvc
protected

Pointer to the IConversionSvc interface of this.

Definition at line 317 of file AthCnvSvc.h.

◆ m_conv_mut

CallMutex AthCnvSvc::m_conv_mut
protected

Definition at line 324 of file AthCnvSvc.h.

◆ m_dataSvc

SmartIF<IDataProviderSvc> AthCnvSvc::m_dataSvc
protected

Pointer to data provider service.

Definition at line 313 of file AthCnvSvc.h.

◆ m_type

long AthCnvSvc::m_type
protected

Conversion service type.

Definition at line 319 of file AthCnvSvc.h.

◆ m_workers

Workers AthCnvSvc::m_workers
protected

List of conversion workers.

Definition at line 321 of file AthCnvSvc.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
AthService::AthService
AthService()
AthCnvSvc::makeCall
StatusCode makeCall(int typ, bool ignore_add, bool ignore_obj, bool update, IOpaqueAddress *&pAddress, DataObject *&pObject)
Definition: AthCnvSvc.cxx:553
UPDATE_REP
@ UPDATE_REP
Definition: AthCnvSvc.cxx:36
CREATE_REP
@ CREATE_REP
Definition: AthCnvSvc.cxx:34
AthCnvSvc::removeConverter
virtual StatusCode removeConverter(const CLID &clid)
Remove converter object from conversion service (if present).
Definition: AthCnvSvc.cxx:379
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCnvSvc::m_conv_mut
CallMutex m_conv_mut
Definition: AthCnvSvc.h:324
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
AthCnvSvc::activateConverter
virtual StatusCode activateConverter(long typ, const CLID &clid, IConverter *cnv)
Activate the new converter after initialization.
Definition: AthCnvSvc.cxx:536
AthCnvSvc::updateServiceState
virtual StatusCode updateServiceState(IOpaqueAddress *pAddress)
Update state of the service.
Definition: AthCnvSvc.cxx:479
AthCnvSvc::m_addressCreator
SmartIF< IAddressCreator > m_addressCreator
Pointer to the address creation service interface.
Definition: AthCnvSvc.h:315
FILL_OBJ_REFS
@ FILL_OBJ_REFS
Definition: AthCnvSvc.cxx:31
PixelModuleFeMask_create_db.stop
int stop
Definition: PixelModuleFeMask_create_db.py:76
AthCnvSvc::connectOutput
virtual StatusCode connectOutput(const std::string &outputFile, const std::string &openMode)
Connect the output file to the service with open mode.
Definition: AthCnvSvc.cxx:414
AthCnvSvc::setAddressCreator
virtual StatusCode setAddressCreator(IAddressCreator *creator)
Set address creator facility.
Definition: AthCnvSvc.cxx:243
compareGeometries.outputFile
string outputFile
Definition: compareGeometries.py:25
AthCnvSvc::configureConverter
virtual StatusCode configureConverter(long typ, const CLID &clid, IConverter *cnv)
Configure the new converter before initialize is called.
Definition: AthCnvSvc.cxx:510
UPDATE_REP_REFS
@ UPDATE_REP_REFS
Definition: AthCnvSvc.cxx:37
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:92
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AthCnvSvc::m_cnvSvc
SmartIF< IConversionSvc > m_cnvSvc
Pointer to the IConversionSvc interface of this.
Definition: AthCnvSvc.h:317
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
AthCnvSvc::m_workers
Workers m_workers
List of conversion workers.
Definition: AthCnvSvc.h:321
AthCnvSvc::initializeConverter
virtual StatusCode initializeConverter(long typ, const CLID &clid, IConverter *cnv)
Initialize the new converter.
Definition: AthCnvSvc.cxx:525
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
AthCnvSvc::addConverter
virtual StatusCode addConverter(const CLID &clid)
Add converter object to conversion service.
Definition: AthCnvSvc.cxx:336
UPDATE_OBJ_REFS
@ UPDATE_OBJ_REFS
Definition: AthCnvSvc.cxx:33
AthCnvSvc::createConverter
virtual IConverter * createConverter(long typ, const CLID &clid, const ICnvFactory *fac)
Create new Converter using factory.
Definition: AthCnvSvc.cxx:491
AthCnvSvc::converter
virtual IConverter * converter(const CLID &wanted)
Retrieve converter from list.
Definition: AthCnvSvc.cxx:394
dqt_zlumi_pandas.update
update
Definition: dqt_zlumi_pandas.py:42
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AthCommonMsg< Service >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
AthCnvSvc::loadConverter
virtual void loadConverter(DataObject *pObject)
Load converter or dictionary needed by the converter.
Definition: AthCnvSvc.cxx:547
AthCnvSvc::Workers
std::unordered_map< CLID, WorkerEntry > Workers
Definition: AthCnvSvc.h:106
AthCnvSvc::m_dataSvc
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to data provider service.
Definition: AthCnvSvc.h:313
merge.status
status
Definition: merge.py:17
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition: checker_macros.h:211
FILL_REP_REFS
@ FILL_REP_REFS
Definition: AthCnvSvc.cxx:35
AthCnvSvc::repSvcType
virtual long repSvcType() const
Retrieve the class type of the data store the converter uses.
Definition: AthCnvSvc.cxx:172
CREATE_OBJ
@ CREATE_OBJ
Definition: AthCnvSvc.cxx:30
AthCnvSvc::m_type
long m_type
Conversion service type.
Definition: AthCnvSvc.h:319
UPDATE_OBJ
@ UPDATE_OBJ
Definition: AthCnvSvc.cxx:32