ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Athena::RootCnvSvc Class Reference

This class provides the interface between Athena and RootSvc. More...

#include <RootCnvSvc.h>

Inheritance diagram for Athena::RootCnvSvc:
Collaboration diagram for Athena::RootCnvSvc:

Public Types

typedef std::unordered_map< CLID, WorkerEntryWorkers
 

Public Member Functions

 RootCnvSvc (const std::string &name, ISvcLocator *pSvcLocator)
 Standard Service Constructor. More...
 
StatusCode initialize ()
 Gaudi Service Interface method implementations: More...
 
StatusCode finalize ()
 
StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
 
StatusCode connectOutput (const std::string &file)
 Connect the output file to the service. More...
 
StatusCode connectOutput (const std::string &file, const std::string &mode)
 Connect the output file to the service with open mode. More...
 
StatusCode commitOutput (const std::string &output, bool do_commit)
 Commit pending output. More...
 
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...
 
StatusCode convertAddress (const IOpaqueAddress *pAddress, std::string &refAddress)
 Convert an address to string form. More...
 
StatusCode createAddress (long svc_type, const CLID &clid, const std::string &refAddress, IOpaqueAddress *&refpAddress)
 Convert an address in string form to object form. More...
 
StatusCode updateServiceState (IOpaqueAddress *pAddress)
 Update state of the service. More...
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 Retrieve interface ID. More...
 

Protected Member Functions

IConverter * createConverter (long typ, const CLID &clid, const ICnvFactory *fac)
 Create new converter using factory. More...
 
RootType getType (const CLID &clid) const
 
RootType getType (const std::type_info &type) const
 
const TokenwriteObject (const std::string &key, const RootType &typeDesc, const void *pObj, ITPCnvBase *tpConverter=0)
 Write object of a given class to Root, using optional T/P converter. More...
 
ITPCnvBasegetTPConverter (const CLID &clid) const
 Get T/P converter for a transient class. More...
 

Private Member Functions

 RootCnvSvc ()
 Default constructor: More...
 
 RootCnvSvc (const RootCnvSvc &)
 
RootCnvSvcoperator= (const RootCnvSvc &)
 

Private Attributes

ServiceHandle< ::IDictLoaderSvcm_dictSvc
 ServiceHandle to the dictionary service. More...
 
ServiceHandle< ::ITPCnvSvcm_tpCnvSvc
 ServiceHandle to the T/P conversion service. More...
 
ServiceHandle< ::IRootSvcm_rootSvc
 ServiceHandle to the root service. More...
 
std::string m_treeName
 ROOT TTree name. More...
 

Friends

class SvcFactory< Athena::RootCnvSvc >
 

@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 disconnectOutput (const std::string &output)
 Disconnect output files from the service. More...
 

@c IAddressCreator interface implementation

virtual SmartIF< IAddressCreator > & addressCreator ()
 Retrieve address creation interface. 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...
 
StatusCode makeCall (int typ, bool ignore_add, bool ignore_obj, bool update, IOpaqueAddress *&pAddress, DataObject *&pObject)
 
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
 

Detailed Description

This class provides the interface between Athena and RootSvc.

Definition at line 35 of file RootCnvSvc.h.

Member Typedef Documentation

◆ CallMutex

typedef std::recursive_mutex AthCnvSvc::CallMutex
protectedinherited

Mutex to protect Converter creation.

Definition at line 323 of file AthCnvSvc.h.

◆ Workers

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

Definition at line 106 of file AthCnvSvc.h.

Constructor & Destructor Documentation

◆ RootCnvSvc() [1/3]

Athena::RootCnvSvc::RootCnvSvc ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Standard Service Constructor.

Definition at line 31 of file RootCnvSvc.cxx.

31  :
32  ::AthCnvSvc(name, pSvcLocator, ROOT_StorageType),
33  m_dictSvc("AthDictLoaderSvc", name),
34  m_tpCnvSvc("AthTPCnvSvc", name),
35  m_rootSvc("Athena::RootSvc/AthenaRootSvc", name),
36  m_treeName("CollectionTree") {
37 }

◆ RootCnvSvc() [2/3]

Athena::RootCnvSvc::RootCnvSvc ( )
private

Default constructor:

◆ RootCnvSvc() [3/3]

Athena::RootCnvSvc::RootCnvSvc ( const RootCnvSvc )
private

Member Function Documentation

◆ activateConverter()

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

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)
virtualinherited

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)
virtualinherited

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 ( )
inlineprotectedvirtualinherited

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
virtualinherited

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 Athena::RootCnvSvc::commitOutput ( const std::string &  output,
bool  do_commit 
)
virtual

Commit pending output.

Reimplemented from AthCnvSvc.

Definition at line 94 of file RootCnvSvc.cxx.

94  {
95  return m_rootSvc->commitOutput();
96 }

◆ configureConverter()

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

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 Athena::RootCnvSvc::connectOutput ( const std::string &  file)
virtual

Connect the output file to the service.

Reimplemented from AthCnvSvc.

Definition at line 89 of file RootCnvSvc.cxx.

89  {
90  return m_rootSvc->connect(file);
91 }

◆ connectOutput() [2/2]

StatusCode Athena::RootCnvSvc::connectOutput ( const std::string &  file,
const std::string &  mode 
)
virtual

Connect the output file to the service with open mode.

Reimplemented from AthCnvSvc.

Definition at line 70 of file RootCnvSvc.cxx.

70  {
71  std::string fileName = file;
72  std::string::size_type inx1 = file.find('(');
73  if (inx1 != std::string::npos) {
74  std::string::size_type inx2 = file.find(')');
75  if (inx2 == std::string::npos || inx2 != file.size() - 1) {
76  return StatusCode::FAILURE;
77  }
78  m_treeName = fileName.substr(inx1 + 1, inx2 - inx1 - 1);
79  fileName.resize(inx1);//already checked that inx1!=npos
80  }
81  if (!m_rootSvc->open(fileName, mode).isSuccess()) {
82  ATH_MSG_ERROR("Could not open-recreate file [" << file << "]");
83  return StatusCode::FAILURE;
84  }
85  return this->connectOutput(fileName);
86 }

◆ conversionSvc()

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

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 Athena::RootCnvSvc::convertAddress ( const IOpaqueAddress *  pAddress,
std::string &  refAddress 
)
virtual

Convert an address to string form.

Reimplemented from AthCnvSvc.

Definition at line 113 of file RootCnvSvc.cxx.

113  {
114  ATH_MSG_VERBOSE("::convertAddress(pAddr = " << pAddress << ", refPaddr = " << refAddress << ")");
115  return StatusCode::FAILURE;
116 }

◆ converter()

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

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 Athena::RootCnvSvc::createAddress ( long  svc_type,
const CLID clid,
const std::string &  refAddress,
IOpaqueAddress *&  refpAddress 
)
virtual

Convert an address in string form to object form.

Reimplemented from AthCnvSvc.

Definition at line 118 of file RootCnvSvc.cxx.

121  {
122  ATH_MSG_VERBOSE("RootCnvSvc::createAddress("
123  << "svc_type=" << svc_type << ", "
124  << "clid=" << clid << ", "
125  << "refaddr=" << refAddress << ", "
126  << "refpaddr=" << refpAddress << ")");
127 
128  return StatusCode::FAILURE;
129 }

◆ createAddress() [2/2]

StatusCode Athena::RootCnvSvc::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 from AthCnvSvc.

Definition at line 98 of file RootCnvSvc.cxx.

102  {
103  ATH_MSG_VERBOSE("RootCnvSvc::createAddress("
104  << "svc_type=" << svc_type << ", "
105  << "clid=" << clid << ", "
106  << "par=" << par[0] << ", " << par[1] << " "
107  << "ip=" << ip[0] << ", " << ip[1] << " "
108  << "refpaddr=" << refpAddress << ")");
109  refpAddress = new GenericAddress(ROOT_StorageType, clid, par[0], par[1], ip[0], ip[1]);
110  return StatusCode::SUCCESS;
111 }

◆ createConverter()

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

Create new converter using factory.

Reimplemented from AthCnvSvc.

Definition at line 172 of file RootCnvSvc.cxx.

172  {
173  ATH_MSG_VERBOSE("createConverter typ = " << typ << ", clid = " << clid);
174  if (typ == ROOT_StorageType) {
175  return new Athena::RootCnv(clid, serviceLocator().get());
176  }
177  return ::AthCnvSvc::createConverter(typ, clid, fac);
178 }

◆ createObj()

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

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 
)
virtualinherited

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
virtualinherited

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)
virtualinherited

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 
)
virtualinherited

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 
)
virtualinherited

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 Athena::RootCnvSvc::finalize ( )
virtual

Reimplemented from AthCnvSvc.

Definition at line 54 of file RootCnvSvc.cxx.

54  {
56 }

◆ getTPConverter()

ITPCnvBase * Athena::RootCnvSvc::getTPConverter ( const CLID clid) const
protectedvirtual

Get T/P converter for a transient class.

Implements IAthenaRootCnvSvc.

Definition at line 166 of file RootCnvSvc.cxx.

166  {
167  ATH_MSG_VERBOSE("RootCnvSvc::getTPConverter clid = " << clid);
168  return m_tpCnvSvc->t2p_cnv(clid);
169 }

◆ getType() [1/2]

RootType Athena::RootCnvSvc::getType ( const CLID clid) const
protectedvirtual

RootType-based API Load the class (dictionary) from Root.

Implements IAthenaRootCnvSvc.

Definition at line 138 of file RootCnvSvc.cxx.

138  {
139  return m_dictSvc->load_type(clid);
140 }

◆ getType() [2/2]

RootType Athena::RootCnvSvc::getType ( const std::type_info &  type) const
protectedvirtual

Implements IAthenaRootCnvSvc.

Definition at line 142 of file RootCnvSvc.cxx.

142  {
143  return m_dictSvc->load_type(type);
144 }

◆ initialize()

StatusCode Athena::RootCnvSvc::initialize ( )
virtual

Gaudi Service Interface method implementations:

Reimplemented from AthCnvSvc.

Definition at line 39 of file RootCnvSvc.cxx.

39  {
40  ATH_MSG_INFO("Initializing " << name());
41  if (!::AthCnvSvc::initialize().isSuccess()) {
42  ATH_MSG_FATAL("Cannot initialize ConversionSvc base class.");
43  return StatusCode::FAILURE;
44  }
45  // Get the Dictionary service
46  ATH_CHECK(m_dictSvc.retrieve());
47  // Get the T/P conversion service
48  ATH_CHECK(m_tpCnvSvc.retrieve());
49  // Get the Root service
50  ATH_CHECK(m_rootSvc.retrieve());
51  return StatusCode::SUCCESS;
52 }

◆ initializeConverter()

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

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 }

◆ interfaceID()

static const InterfaceID& IAthenaRootCnvSvc::interfaceID ( )
inlinestaticinherited

Retrieve interface ID.

Definition at line 35 of file IAthenaRootCnvSvc.h.

35  {
36  static const InterfaceID s_iid("IAthenaRootCnvSvc", 1, 0);
37  return s_iid;
38  }

◆ loadConverter()

void AthCnvSvc::loadConverter ( DataObject *  pObject)
protectedvirtualinherited

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 
)
protectedinherited

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
inherited

Implementation of IConverter: dummy call.

Definition at line 179 of file AthCnvSvc.cxx.

180 {
181  return CLID_NULL;
182 }

◆ operator=()

RootCnvSvc& Athena::RootCnvSvc::operator= ( const RootCnvSvc )
private

◆ queryInterface()

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

Reimplemented from AthCnvSvc.

Definition at line 58 of file RootCnvSvc.cxx.

58  {
59  if (IAthenaRootCnvSvc::interfaceID().versionMatch(riid)) {
60  *ppvInterface = dynamic_cast<IAthenaRootCnvSvc*>(this);
61  } else {
62  // Interface is not directly available: try out a base class
63  return ::AthCnvSvc::queryInterface(riid, ppvInterface);
64  }
65  addRef();
66  return StatusCode::SUCCESS;
67 }

◆ removeConverter()

StatusCode AthCnvSvc::removeConverter ( const CLID clid)
virtualinherited

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
virtualinherited

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)
virtualinherited

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)
virtualinherited

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)
virtualinherited

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 
)
virtualinherited

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 
)
virtualinherited

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 
)
virtualinherited

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 
)
virtualinherited

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 Athena::RootCnvSvc::updateServiceState ( IOpaqueAddress *  pAddress)
virtual

Update state of the service.

Reimplemented from AthCnvSvc.

Definition at line 131 of file RootCnvSvc.cxx.

131  {
132  ATH_MSG_VERBOSE("RootCnvSvc::updateServiceState(paddr = " << pAddress << ")");
133  return StatusCode::FAILURE;
134 }

◆ writeObject()

const Token * Athena::RootCnvSvc::writeObject ( const std::string &  key,
const RootType typeDesc,
const void *  pObj,
ITPCnvBase tpConverter = 0 
)
protectedvirtual

Write object of a given class to Root, using optional T/P converter.

Implements IAthenaRootCnvSvc.

Definition at line 147 of file RootCnvSvc.cxx.

150  {
151  const Token* token = 0;
152  Placement placement;
153  placement.setContainerName(m_treeName + "(" + key + ")");
154  placement.setTechnology(ROOT_StorageType);
155  if (tpConverter == 0) {
156  token = m_rootSvc->writeObject(placement, typeDesc, pObj);
157  } else {
158  void* pers = m_rootSvc->createObject(typeDesc);
159  tpConverter->transToPersUntyped(pObj, pers, this->msg());
160  token = m_rootSvc->writeObject(placement, typeDesc, pers);
161  m_rootSvc->destructObject(typeDesc, pers); pers = 0;
162  }
163  return token;
164 }

Friends And Related Function Documentation

◆ SvcFactory< Athena::RootCnvSvc >

friend class SvcFactory< Athena::RootCnvSvc >
friend

Definition at line 1 of file RootCnvSvc.h.

Member Data Documentation

◆ m_addressCreator

SmartIF<IAddressCreator> AthCnvSvc::m_addressCreator
protectedinherited

Pointer to the address creation service interface.

Definition at line 315 of file AthCnvSvc.h.

◆ m_cnvSvc

SmartIF<IConversionSvc> AthCnvSvc::m_cnvSvc
protectedinherited

Pointer to the IConversionSvc interface of this.

Definition at line 317 of file AthCnvSvc.h.

◆ m_conv_mut

CallMutex AthCnvSvc::m_conv_mut
protectedinherited

Definition at line 324 of file AthCnvSvc.h.

◆ m_dataSvc

SmartIF<IDataProviderSvc> AthCnvSvc::m_dataSvc
protectedinherited

Pointer to data provider service.

Definition at line 313 of file AthCnvSvc.h.

◆ m_dictSvc

ServiceHandle< ::IDictLoaderSvc> Athena::RootCnvSvc::m_dictSvc
private

ServiceHandle to the dictionary service.

Definition at line 103 of file RootCnvSvc.h.

◆ m_rootSvc

ServiceHandle< ::IRootSvc> Athena::RootCnvSvc::m_rootSvc
private

ServiceHandle to the root service.

Definition at line 107 of file RootCnvSvc.h.

◆ m_tpCnvSvc

ServiceHandle< ::ITPCnvSvc> Athena::RootCnvSvc::m_tpCnvSvc
private

ServiceHandle to the T/P conversion service.

Definition at line 105 of file RootCnvSvc.h.

◆ m_treeName

std::string Athena::RootCnvSvc::m_treeName
private

ROOT TTree name.

Definition at line 110 of file RootCnvSvc.h.

◆ m_type

long AthCnvSvc::m_type
protectedinherited

Conversion service type.

Definition at line 319 of file AthCnvSvc.h.

◆ m_workers

Workers AthCnvSvc::m_workers
protectedinherited

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
AthCnvSvc::makeCall
StatusCode makeCall(int typ, bool ignore_add, bool ignore_obj, bool update, IOpaqueAddress *&pAddress, DataObject *&pObject)
Definition: AthCnvSvc.cxx:553
Athena::RootCnvSvc::m_rootSvc
ServiceHandle< ::IRootSvc > m_rootSvc
ServiceHandle to the root service.
Definition: RootCnvSvc.h:107
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:53
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
Placement
This class holds all the necessary information to guide the writing of an object in a physical place.
Definition: Placement.h:19
UPDATE_REP
@ UPDATE_REP
Definition: AthCnvSvc.cxx:36
IAthenaRootCnvSvc
This class provides the interface between Athena and RootSvc.
Definition: IAthenaRootCnvSvc.h:30
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
Athena::RootCnvSvc::m_dictSvc
ServiceHandle< ::IDictLoaderSvc > m_dictSvc
ServiceHandle to the dictionary service.
Definition: RootCnvSvc.h:103
IAthenaRootCnvSvc::interfaceID
static const InterfaceID & interfaceID()
Retrieve interface ID.
Definition: IAthenaRootCnvSvc.h:35
AthCnvSvc::m_conv_mut
CallMutex m_conv_mut
Definition: AthCnvSvc.h:324
Athena::RootCnvSvc::connectOutput
StatusCode connectOutput(const std::string &file)
Connect the output file to the service.
Definition: RootCnvSvc.cxx:89
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
AthCnvSvc::initialize
virtual StatusCode initialize()
Gaudi Service Implementation.
Definition: AthCnvSvc.cxx:111
FILL_OBJ_REFS
@ FILL_OBJ_REFS
Definition: AthCnvSvc.cxx:31
PixelModuleFeMask_create_db.stop
int stop
Definition: PixelModuleFeMask_create_db.py:76
AthCnvSvc::AthCnvSvc
AthCnvSvc()
Default constructor:
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Placement::setContainerName
Placement & setContainerName(const std::string &containerName)
Set container name.
Definition: Placement.h:34
Token
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition: Token.h:21
ITPCnvBase::transToPersUntyped
virtual void transToPersUntyped(const void *trans, void *pers, MsgStream &msg)=0
Convert transient object representation to persistent.
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
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
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
file
TFile * file
Definition: tile_monitor.h:29
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
AthCnvSvc::m_cnvSvc
SmartIF< IConversionSvc > m_cnvSvc
Pointer to the IConversionSvc interface of this.
Definition: AthCnvSvc.h:317
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Preparation.mode
mode
Definition: Preparation.py:95
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:195
createCoolChannelIdFile.par
par
Definition: createCoolChannelIdFile.py:29
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
Placement::setTechnology
Placement & setTechnology(int technology)
Set technology type.
Definition: Placement.h:38
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::m_dataSvc
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to data provider service.
Definition: AthCnvSvc.h:313
Athena::RootCnvSvc::m_treeName
std::string m_treeName
ROOT TTree name.
Definition: RootCnvSvc.h:110
merge.status
status
Definition: merge.py:17
Athena::RootCnv
This class provides the abstract converter to translate an object to/from its persistent ROOT represe...
Definition: RootCnv.h:37
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition: checker_macros.h:211
Athena::RootCnvSvc::m_tpCnvSvc
ServiceHandle< ::ITPCnvSvc > m_tpCnvSvc
ServiceHandle to the T/P conversion service.
Definition: RootCnvSvc.h:105
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
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
UPDATE_OBJ
@ UPDATE_OBJ
Definition: AthCnvSvc.cxx:32