ATLAS Offline Software
Loading...
Searching...
No Matches
Athena::xAODCnvSvc Class Reference

#include <xAODCnvSvc.h>

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

Public Member Functions

 xAODCnvSvc (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor with parameters:
virtual ~xAODCnvSvc ()
 Destructor:
virtual StatusCode initialize ()
 Gaudi Service Implementation.
virtual StatusCode finalize ()
virtual StatusCode updateServiceState (IOpaqueAddress *pAddress)
 IConversionSvc and IConverter interfaces
virtual StatusCode createObj (IOpaqueAddress *pAddress, DataObject *&refpObject)
 Implementation of IConverter: Create the transient representation of an object from persistent state.
virtual StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
 Implementation of IConverter: Convert the transient object to the requested representation.
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Implementation of IConverter: Resolve the references of the converted object.
virtual StatusCode connectOutput (const std::string &outputConnectionSpec, const std::string &openMode)
 Connect the output connection specification to the service with open mode.
virtual StatusCode connectOutput (const std::string &outputConnectionSpec)
 Connect the output connection specification to the service with open mode.
virtual StatusCode commitOutput (const std::string &outputConnectionSpec, bool doCommit)
 Commit pending output.
virtual StatusCode createAddress (long svcType, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
 IAddressCreator interfaces
virtual StatusCode convertAddress (const IOpaqueAddress *pAddress, std::string &refAddress)
 Convert address to string form.
virtual StatusCode createAddress (long svcType, const CLID &clid, const std::string &refAddress, IOpaqueAddress *&refpAddress)
 Create address from string form.

Protected Member Functions

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

Private Member Functions

 xAODCnvSvc ()
 Default constructor:

Detailed Description

Definition at line 26 of file xAODCnvSvc.h.

Constructor & Destructor Documentation

◆ xAODCnvSvc() [1/2]

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

Constructor with parameters:

Definition at line 36 of file xAODCnvSvc.cxx.

37 :
38 base_class( name, pSvcLocator, pool::ROOT_StorageType.type() )
39{
40}
static const DbType ROOT_StorageType
Definition DbType.h:85

◆ ~xAODCnvSvc()

Athena::xAODCnvSvc::~xAODCnvSvc ( )
virtual

Destructor:

Definition at line 44 of file xAODCnvSvc.cxx.

45{}

◆ xAODCnvSvc() [2/2]

Athena::xAODCnvSvc::xAODCnvSvc ( )
private

Default constructor:

Member Function Documentation

◆ commitOutput()

StatusCode Athena::xAODCnvSvc::commitOutput ( const std::string & outputConnectionSpec,
bool doCommit )
virtual

Commit pending output.

Definition at line 173 of file xAODCnvSvc.cxx.

175{
176 ATH_MSG_DEBUG("::commitOutput(" << outputConnectionSpec
177 << ", " << doCommit << ")...");
178 return StatusCode::SUCCESS;
179}
#define ATH_MSG_DEBUG(x)

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

Definition at line 159 of file xAODCnvSvc.cxx.

160{
161 ATH_MSG_DEBUG("::connectOutput("
162 << outputConnectionSpec << ")");
163 // std::cerr << "::connectOutput(" << outputConnectionSpec << ")...\n";
164 TFile *f = TFile::Open(outputConnectionSpec.c_str(), "recreate");
165 if (f == 0) {
166 return StatusCode::FAILURE;
167 }
168 return StatusCode::SUCCESS;
169}

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

Definition at line 139 of file xAODCnvSvc.cxx.

141{
142 ATH_MSG_DEBUG("::connectOutput("
143 << outputConnectionSpec << ", "
144 << openMode << ")");
145 // std::cerr << "::connectOutput(" << outputConnectionSpec << ", openmode="
146 // << openMode << ")...\n";
147 TFile *f = TFile::Open(outputConnectionSpec.c_str(), "recreate");
148 if (f == 0) {
149 return StatusCode::FAILURE;
150 }
151
152 return StatusCode::SUCCESS;
153}

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

Definition at line 210 of file xAODCnvSvc.cxx.

212{
213 ATH_MSG_DEBUG("::convertAddress(" << pAddress << ", "
214 << refAddress << ")...");
215 if (pAddress) {
216 refAddress = *pAddress->par();
217 return StatusCode::SUCCESS;
218 }
219 ATH_MSG_ERROR("::convertAddress: null pointer to IOpaqueAddress !");
220 return StatusCode::FAILURE;
221}
#define ATH_MSG_ERROR(x)

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

Definition at line 229 of file xAODCnvSvc.cxx.

233{
234 ATH_MSG_VERBOSE("::createAddress(" << svcType << ", " << clid
235 << ", " << refAddress << ", " << refpAddress
236 << ")...");
237 if (svcType != pool::ROOT_StorageType.type()) {
238 ATH_MSG_ERROR("::createAddress: svcType != root-type");
239 ATH_MSG_ERROR(" svcType = [" << svcType << "]");
240 ATH_MSG_ERROR(" root-type = [" << pool::ROOT_StorageType.type() << "]");
241 return StatusCode::FAILURE;
242 }
243 refpAddress = new GenericAddress(pool::ROOT_StorageType.type(), clid, refAddress);
244 return StatusCode::SUCCESS;
245}
#define ATH_MSG_VERBOSE(x)

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

Definition at line 194 of file xAODCnvSvc.cxx.

199{
200 ATH_MSG_DEBUG("::createAddress(" << svcType << ", " << clid
201 << ", " << par << ", " << ip << ", " << refpAddress
202 << ")...");
203 return ::AthCnvSvc::createAddress(svcType, clid, par, ip, refpAddress);
204}

◆ createConverter()

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

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

Definition at line 262 of file xAODCnvSvc.cxx.

265{
266 ATH_MSG_VERBOSE("xAODCnvSvc::createConverter(" << typ << ", " << clid
267 << ", " << fac << ")...");
268 IConverter* cnv = new Athena::xAODCnv(clid, serviceLocator());
269 ATH_MSG_VERBOSE("xAODCnvSvc::createConverter 2");
270 if (cnv) {
271 ATH_MSG_VERBOSE("xAODCnvSvc::createConverter 3");
272 return cnv;
273 }
274 ATH_MSG_VERBOSE("xAODCnvSvc::createConverter 4");
275 return AthCnvSvc::createConverter(typ, clid, fac);
276}
virtual IConverter * createConverter(long typ, const CLID &clid, const ICnvFactory *fac)
Create new Converter using factory.

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

Definition at line 84 of file xAODCnvSvc.cxx.

85{
86 ATH_MSG_DEBUG("-->createObj(" << pAddress->par()[0] << "/" << pAddress->par()[1]
87 << ", " << refpObject << ")...");
88 GenericAddress *addr = dynamic_cast<GenericAddress*>(pAddress);
89 if (!addr) {
90 ATH_MSG_DEBUG(pAddress->par()[0] << "/" << pAddress->par()[1]
91 << " is NOT a GenericAddress!");
92 return StatusCode::FAILURE;
93 }
94 ATH_MSG_DEBUG(" par: " << pAddress->par()[0] << "/" << pAddress->par()[1]
95 << endmsg <<
96 " ipar: " << *pAddress->ipar());
97 return AthCnvSvc::createObj(pAddress, refpObject);
98}
#define endmsg
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject) override
Implementation of IConverter: Create the transient representation of an object.

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

Definition at line 106 of file xAODCnvSvc.cxx.

107{
108 ATH_MSG_DEBUG("::createRep(" << refpAddress << ", " << pObject << ")...");
109 //std::cerr << "::NCS::createRep(" << this->name() << ", " << pObject << ")...\n";
110 if (0==pObject) {
111 ATH_MSG_ERROR("::createRep: received null ptr to DataObject");
112 return StatusCode::FAILURE;
113 }
114 return ::AthCnvSvc::createRep(pObject, refpAddress);
115}

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

Definition at line 123 of file xAODCnvSvc.cxx.

124{
125 ATH_MSG_DEBUG("::fillRepRefs(" << pAddress << ", " << pObject << ")...");
126 if (0==pAddress || 0==pObject) {
127 ATH_MSG_ERROR("::fillRepRefs: null ptr received! (paddr=" << pAddress
128 << ", pobj=" << pObject << ")");
129 return StatusCode::FAILURE;
130 }
131 return ::AthCnvSvc::fillRepRefs(pAddress, pObject);
132}

◆ finalize()

StatusCode Athena::xAODCnvSvc::finalize ( )
virtual

Definition at line 58 of file xAODCnvSvc.cxx.

59{
60 ATH_MSG_DEBUG ("Finalizing " << name() << "...");
61
62 return AthCnvSvc::finalize();
63}
virtual StatusCode finalize() override

◆ initialize()

StatusCode Athena::xAODCnvSvc::initialize ( )
virtual

Gaudi Service Implementation.

Definition at line 50 of file xAODCnvSvc.cxx.

51{
52 ATH_MSG_DEBUG ("Initializing " << name() << "...");
53
54 return AthCnvSvc::initialize();
55}
virtual StatusCode initialize() override
Gaudi Service Implementation.

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

Definition at line 68 of file xAODCnvSvc.cxx.

69{
70 ATH_MSG_DEBUG("updateServiceState(" << pAddress << ")...");
71 if (pAddress) {
72 return dynamic_cast<GenericAddress*>(pAddress)
73 ? StatusCode::SUCCESS
75 }
76 return StatusCode::FAILURE;
77}
::StatusCode StatusCode
StatusCode definition for legacy code.

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