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

#include <xAODCnvSvc.h>

Inheritance diagram for Athena::xAODCnvSvc:
Collaboration diagram for Athena::xAODCnvSvc:

Public Types

typedef std::unordered_map< CLID, WorkerEntryWorkers
 

Public Member Functions

 xAODCnvSvc (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor with parameters: More...
 
virtual ~xAODCnvSvc ()
 Destructor: More...
 
virtual StatusCode initialize ()
 Gaudi Service Implementation. More...
 
virtual StatusCode finalize ()
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
 
virtual StatusCode updateServiceState (IOpaqueAddress *pAddress)
 IConversionSvc and IConverter interfaces More...
 
virtual StatusCode createObj (IOpaqueAddress *pAddress, DataObject *&refpObject)
 Implementation of IConverter: Create the transient representation of an object from persistent state. 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 connectOutput (const std::string &outputConnectionSpec, const std::string &openMode)
 Connect the output connection specification to the service with open mode. More...
 
virtual StatusCode connectOutput (const std::string &outputConnectionSpec)
 Connect the output connection specification to the service with open mode. More...
 
virtual StatusCode commitOutput (const std::string &outputConnectionSpec, bool doCommit)
 Commit pending output. More...
 
virtual StatusCode createAddress (long svcType, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
 IAddressCreator interfaces More...
 
virtual StatusCode convertAddress (const IOpaqueAddress *pAddress, std::string &refAddress)
 Convert address to string form. More...
 
virtual StatusCode createAddress (long svcType, const CLID &clid, const std::string &refAddress, IOpaqueAddress *&refpAddress)
 Create address from string form. More...
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 
@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 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 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...
 
@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 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 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 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 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 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...
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 

Protected Member Functions

virtual IConverter * createConverter (long typ, const CLID &clid, const ICnvFactory *fac)
 Create new Converter using factory (override AthCnvSvc::createConverter) More...
 

Private Member Functions

 xAODCnvSvc ()
 Default constructor: More...
 

Friends

class SvcFactory< Athena::xAODCnvSvc >
 

@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

Definition at line 29 of file xAODCnvSvc.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

◆ xAODCnvSvc() [1/2]

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

Constructor with parameters:

Definition at line 35 of file xAODCnvSvc.cxx.

36  :
37  ::AthCnvSvc( name, pSvcLocator, POOL_ROOTTREE_StorageType )
38 {
39  //
40  // Property declaration
41  //
42  //declareProperty( "Property", m_nProperty );
43 
44  // std::cerr << "::xAODCnvSvc(" << name << ")...\n";
45 }

◆ ~xAODCnvSvc()

Athena::xAODCnvSvc::~xAODCnvSvc ( )
virtual

Destructor:

Definition at line 49 of file xAODCnvSvc.cxx.

50 {}

◆ xAODCnvSvc() [2/2]

Athena::xAODCnvSvc::xAODCnvSvc ( )
private

Default constructor:

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::xAODCnvSvc::commitOutput ( const std::string &  outputConnectionSpec,
bool  doCommit 
)
virtual

Commit pending output.

Reimplemented from AthCnvSvc.

Definition at line 196 of file xAODCnvSvc.cxx.

198 {
199  ATH_MSG_DEBUG("::commitOutput(" << outputConnectionSpec
200  << ", " << doCommit << ")...");
201  return StatusCode::SUCCESS;
202 }

◆ 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::xAODCnvSvc::connectOutput ( const std::string &  outputConnectionSpec)
virtual

Connect the output connection specification to the service with open mode.

Parameters
outputConnectionSpec[IN] the name of the output connection specification as string.

Reimplemented from AthCnvSvc.

Definition at line 182 of file xAODCnvSvc.cxx.

183 {
184  ATH_MSG_DEBUG("::connectOutput("
185  << outputConnectionSpec << ")");
186  // std::cerr << "::connectOutput(" << outputConnectionSpec << ")...\n";
187  TFile *f = TFile::Open(outputConnectionSpec.c_str(), "recreate");
188  if (f == 0) {
189  return StatusCode::FAILURE;
190  }
191  return StatusCode::SUCCESS;
192 }

◆ connectOutput() [2/2]

StatusCode Athena::xAODCnvSvc::connectOutput ( const std::string &  outputConnectionSpec,
const std::string &  openMode 
)
virtual

Connect the output connection specification to the service with open mode.

Parameters
outputConnectionSpec[IN] the name of the output connection specification as string.
openMode[IN] the open mode of the file as string.

Reimplemented from AthCnvSvc.

Definition at line 162 of file xAODCnvSvc.cxx.

164 {
165  ATH_MSG_DEBUG("::connectOutput("
166  << outputConnectionSpec << ", "
167  << openMode << ")");
168  // std::cerr << "::connectOutput(" << outputConnectionSpec << ", openmode="
169  // << openMode << ")...\n";
170  TFile *f = TFile::Open(outputConnectionSpec.c_str(), "recreate");
171  if (f == 0) {
172  return StatusCode::FAILURE;
173  }
174 
175  return StatusCode::SUCCESS;
176 }

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

Convert address to string form.

Parameters
pAddress[IN] address to be converted.
refAddress[OUT] converted string form.

Reimplemented from AthCnvSvc.

Definition at line 233 of file xAODCnvSvc.cxx.

235 {
236  ATH_MSG_DEBUG("::convertAddress(" << pAddress << ", "
237  << refAddress << ")...");
238  if (pAddress) {
239  refAddress = *pAddress->par();
240  return StatusCode::SUCCESS;
241  }
242  ATH_MSG_ERROR("::convertAddress: null pointer to IOpaqueAddress !");
243  return StatusCode::FAILURE;
244 }

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

Create address from string form.

Parameters
svcType[IN] service type of the address.
clid[IN] class id for the address.
refAddress[IN] string form to be converted.
refpAddress[OUT] converted address.

Reimplemented from AthCnvSvc.

Definition at line 252 of file xAODCnvSvc.cxx.

256 {
257  ATH_MSG_VERBOSE("::createAddress(" << svcType << ", " << clid
258  << ", " << refAddress << ", " << refpAddress
259  << ")...");
260  if (svcType != POOL_ROOTTREE_StorageType) {
261  ATH_MSG_ERROR("::createAddress: svcType != root-type");
262  ATH_MSG_ERROR(" svcType = [" << svcType << "]");
263  ATH_MSG_ERROR(" root-type = [" << POOL_ROOTTREE_StorageType << "]");
264  return StatusCode::FAILURE;
265  }
266  refpAddress = new GenericAddress(POOL_ROOTTREE_StorageType, clid, refAddress);
267  return StatusCode::SUCCESS;
268 }

◆ createAddress() [2/2]

StatusCode Athena::xAODCnvSvc::createAddress ( long  svcType,
const CLID clid,
const std::string *  par,
const unsigned long *  ip,
IOpaqueAddress *&  refpAddress 
)
virtual

IAddressCreator interfaces

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

Parameters
svcType[IN] service type of the address.
clid[IN] class id for the address.
par[IN] string containing the database name.
ip[IN] object identifier.
refpAddress[OUT] converted address.

Reimplemented from AthCnvSvc.

Definition at line 217 of file xAODCnvSvc.cxx.

222 {
223  ATH_MSG_DEBUG("::createAddress(" << svcType << ", " << clid
224  << ", " << par << ", " << ip << ", " << refpAddress
225  << ")...");
226  return ::AthCnvSvc::createAddress(svcType, clid, par, ip, refpAddress);
227 }

◆ createConverter()

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

Create new Converter using factory (override AthCnvSvc::createConverter)

Reimplemented from AthCnvSvc.

Definition at line 285 of file xAODCnvSvc.cxx.

288 {
289  ATH_MSG_VERBOSE("xAODCnvSvc::createConverter(" << typ << ", " << clid
290  << ", " << fac << ")...");
291  IConverter* cnv = new Athena::xAODCnv(clid, serviceLocator());
292  ATH_MSG_VERBOSE("xAODCnvSvc::createConverter 2");
293  if (cnv) {
294  ATH_MSG_VERBOSE("xAODCnvSvc::createConverter 3");
295  return cnv;
296  }
297  ATH_MSG_VERBOSE("xAODCnvSvc::createConverter 4");
298  return AthCnvSvc::createConverter(typ, clid, fac);
299 }

◆ createObj()

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

Implementation of IConverter: Create the transient representation of an object from persistent state.

Parameters
pAddress[IN] pointer to IOpaqueAddress of the representation.
refpObject[OUT] pointer to DataObject to be created.

Reimplemented from AthCnvSvc.

Definition at line 107 of file xAODCnvSvc.cxx.

108 {
109  ATH_MSG_DEBUG("-->createObj(" << pAddress->par()[0] << "/" << pAddress->par()[1]
110  << ", " << refpObject << ")...");
111  GenericAddress *addr = dynamic_cast<GenericAddress*>(pAddress);
112  if (!addr) {
113  ATH_MSG_DEBUG(pAddress->par()[0] << "/" << pAddress->par()[1]
114  << " is NOT a GenericAddress!");
115  return StatusCode::FAILURE;
116  }
117  ATH_MSG_DEBUG(" par: " << pAddress->par()[0] << "/" << pAddress->par()[1]
118  << endmsg <<
119  " ipar: " << *pAddress->ipar());
120  return AthCnvSvc::createObj(pAddress, refpObject);
121 }

◆ createRep()

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

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

Parameters
pObject[IN] pointer to DataObject.
refpAddress[OUT] pointer to IOpaqueAddress of the representation to be created.

Reimplemented from AthCnvSvc.

Definition at line 129 of file xAODCnvSvc.cxx.

130 {
131  ATH_MSG_DEBUG("::createRep(" << refpAddress << ", " << pObject << ")...");
132  //std::cerr << "::NCS::createRep(" << this->name() << ", " << pObject << ")...\n";
133  if (0==pObject) {
134  ATH_MSG_ERROR("::createRep: received null ptr to DataObject");
135  return StatusCode::FAILURE;
136  }
137  return ::AthCnvSvc::createRep(pObject, refpAddress);
138 }

◆ 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 Athena::xAODCnvSvc::fillRepRefs ( IOpaqueAddress *  pAddress,
DataObject *  pObject 
)
virtual

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

Parameters
pAddress[IN] pointer to IOpaqueAddress of the representation to be resolved.
pObject[IN] pointer to DataObject to be created.

Reimplemented from AthCnvSvc.

Definition at line 146 of file xAODCnvSvc.cxx.

147 {
148  ATH_MSG_DEBUG("::fillRepRefs(" << pAddress << ", " << pObject << ")...");
149  if (0==pAddress || 0==pObject) {
150  ATH_MSG_ERROR("::fillRepRefs: null ptr received! (paddr=" << pAddress
151  << ", pobj=" << pObject << ")");
152  return StatusCode::FAILURE;
153  }
154  return ::AthCnvSvc::fillRepRefs(pAddress, pObject);
155 }

◆ finalize()

StatusCode Athena::xAODCnvSvc::finalize ( )
virtual

Reimplemented from AthCnvSvc.

Definition at line 63 of file xAODCnvSvc.cxx.

64 {
65  ATH_MSG_DEBUG ("Finalizing " << name() << "...");
66 
67  return AthCnvSvc::finalize();
68 }

◆ initialize()

StatusCode Athena::xAODCnvSvc::initialize ( )
virtual

Gaudi Service Implementation.

Reimplemented from AthCnvSvc.

Definition at line 55 of file xAODCnvSvc.cxx.

56 {
57  ATH_MSG_DEBUG ("Initializing " << name() << "...");
58 
59  return AthCnvSvc::initialize();
60 }

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

const InterfaceID & Athena::xAODCnvSvc::interfaceID ( )
inlinestatic

Definition at line 185 of file xAODCnvSvc.h.

186 {
187  return IConversionSvc::interfaceID();
188 }

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

◆ queryInterface()

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

Reimplemented from AthCnvSvc.

Definition at line 76 of file xAODCnvSvc.cxx.

77 {
78  if ( IConversionSvc::interfaceID().versionMatch(riid) ) {
79  *ppvInterface = dynamic_cast<IConversionSvc*>(this);
80  } else {
81  // Interface is not directly available : try out a base class
82  return ::AthCnvSvc::queryInterface(riid, ppvInterface);
83  }
84  addRef();
85  return StatusCode::SUCCESS;
86 }

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

IConversionSvc and IConverter interfaces

update the service state (well, just check the IOpaqueAddress is in fact a GenericAddress )

Reimplemented from AthCnvSvc.

Definition at line 91 of file xAODCnvSvc.cxx.

92 {
93  ATH_MSG_DEBUG("updateServiceState(" << pAddress << ")...");
94  if (pAddress) {
95  return dynamic_cast<GenericAddress*>(pAddress)
96  ? StatusCode::SUCCESS
97  : StatusCode::FAILURE;
98  }
99  return StatusCode::FAILURE;
100 }

Friends And Related Function Documentation

◆ SvcFactory< Athena::xAODCnvSvc >

friend class SvcFactory< Athena::xAODCnvSvc >
friend

Definition at line 185 of file xAODCnvSvc.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_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
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
AthCnvSvc::finalize
virtual StatusCode finalize()
Definition: AthCnvSvc.cxx:116
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
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
AthCnvSvc::configureConverter
virtual StatusCode configureConverter(long typ, const CLID &clid, IConverter *cnv)
Configure the new converter before initialize is called.
Definition: AthCnvSvc.cxx:510
Athena::xAODCnv
Definition: xAODCnv.h:37
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::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)
Implementation of IConverter: Create the transient representation of an object.
Definition: AthCnvSvc.cxx:273
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
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
AthCommonMsg< Service >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
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
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