ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
Athena::NtupleCnvSvc Class Reference

#include <NtupleCnvSvc.h>

Inheritance diagram for Athena::NtupleCnvSvc:
Collaboration diagram for Athena::NtupleCnvSvc:

Public Member Functions

 NtupleCnvSvc (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor with parameters: More...
 
virtual ~NtupleCnvSvc ()
 Destructor: More...
 
virtual StatusCode initialize ()
 Gaudi Service Implementation. More...
 
virtual StatusCode finalize ()
 
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...
 

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

 NtupleCnvSvc ()
 Default constructor: More...
 

Detailed Description

Definition at line 29 of file NtupleCnvSvc.h.

Constructor & Destructor Documentation

◆ NtupleCnvSvc() [1/2]

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

Constructor with parameters:

Definition at line 35 of file NtupleCnvSvc.cxx.

36  :
37  base_class( name, pSvcLocator, ROOT_StorageType )
38 {
39 }

◆ ~NtupleCnvSvc()

Athena::NtupleCnvSvc::~NtupleCnvSvc ( )
virtual

Destructor:

Definition at line 43 of file NtupleCnvSvc.cxx.

44 {}

◆ NtupleCnvSvc() [2/2]

Athena::NtupleCnvSvc::NtupleCnvSvc ( )
private

Default constructor:

Member Function Documentation

◆ commitOutput()

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

Commit pending output.

Definition at line 172 of file NtupleCnvSvc.cxx.

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

◆ connectOutput() [1/2]

StatusCode Athena::NtupleCnvSvc::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 158 of file NtupleCnvSvc.cxx.

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

◆ connectOutput() [2/2]

StatusCode Athena::NtupleCnvSvc::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 138 of file NtupleCnvSvc.cxx.

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

◆ convertAddress()

StatusCode Athena::NtupleCnvSvc::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 209 of file NtupleCnvSvc.cxx.

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

◆ createAddress() [1/2]

StatusCode Athena::NtupleCnvSvc::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 228 of file NtupleCnvSvc.cxx.

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

◆ createAddress() [2/2]

StatusCode Athena::NtupleCnvSvc::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 193 of file NtupleCnvSvc.cxx.

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

◆ createConverter()

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

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

Definition at line 261 of file NtupleCnvSvc.cxx.

264 {
265  ATH_MSG_DEBUG("::createConverter(" << typ << ", " << clid
266  << ", " << fac << ")...");
267  IConverter* cnv = new Athena::LeafCnv(clid, serviceLocator());
268  if (cnv) {
269  return cnv;
270  }
271  return AthCnvSvc::createConverter(typ, clid, fac);
272 }

◆ createObj()

StatusCode Athena::NtupleCnvSvc::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 83 of file NtupleCnvSvc.cxx.

84 {
85  ATH_MSG_DEBUG("-->createObj(" << pAddress->par()[0] << "/" << pAddress->par()[1]
86  << ", " << refpObject << ")...");
87  GenericAddress *addr = dynamic_cast<GenericAddress*>(pAddress);
88  if (!addr) {
89  ATH_MSG_DEBUG(pAddress->par()[0] << "/" << pAddress->par()[1]
90  << " is NOT a GenericAddress!");
91  return StatusCode::FAILURE;
92  }
93  ATH_MSG_DEBUG(" par: " << pAddress->par()[0] << "/" << pAddress->par()[1]
94  << endmsg <<
95  " ipar: " << *pAddress->ipar());
96  return AthCnvSvc::createObj(pAddress, refpObject);
97 }

◆ createRep()

StatusCode Athena::NtupleCnvSvc::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 105 of file NtupleCnvSvc.cxx.

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

◆ fillRepRefs()

StatusCode Athena::NtupleCnvSvc::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 122 of file NtupleCnvSvc.cxx.

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

◆ finalize()

StatusCode Athena::NtupleCnvSvc::finalize ( )
virtual

Definition at line 57 of file NtupleCnvSvc.cxx.

58 {
59  ATH_MSG_DEBUG ("Finalizing " << name() << "...");
60 
61  return AthCnvSvc::finalize();
62 }

◆ initialize()

StatusCode Athena::NtupleCnvSvc::initialize ( )
virtual

Gaudi Service Implementation.

Definition at line 49 of file NtupleCnvSvc.cxx.

50 {
51  ATH_MSG_DEBUG ("Initializing " << name() << "...");
52 
53  return AthCnvSvc::initialize();
54 }

◆ updateServiceState()

StatusCode Athena::NtupleCnvSvc::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 67 of file NtupleCnvSvc.cxx.

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

The documentation for this class was generated from the following files:
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
hist_file_dump.f
f
Definition: hist_file_dump.py:135
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
createCoolChannelIdFile.par
par
Definition: createCoolChannelIdFile.py:29
AthCnvSvc::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject) override
Implementation of IConverter: Create the transient representation of an object.
Definition: AthCnvSvc.cxx:244
Athena::LeafCnv
Definition: LeafCnv.h:37
AthCnvSvc::createConverter
virtual IConverter * createConverter(long typ, const CLID &clid, const ICnvFactory *fac)
Create new Converter using factory.
Definition: AthCnvSvc.cxx:462
AthCnvSvc::finalize
virtual StatusCode finalize() override
Definition: AthCnvSvc.cxx:112
AthCnvSvc::initialize
virtual StatusCode initialize() override
Gaudi Service Implementation.
Definition: AthCnvSvc.cxx:104