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

#include <xAODCnv.h>

Inheritance diagram for Athena::xAODCnv:
Collaboration diagram for Athena::xAODCnv:

Public Member Functions

 xAODCnv (const CLID &clid, ISvcLocator *pSvcLocator)
 Constructor with parameters:
 xAODCnv (ISvcLocator *pSvcLocator)
virtual ~xAODCnv ()
 Destructor:
virtual StatusCode initialize ()
 Gaudi Service Implementation.
long repSvcType () const
virtual StatusCode createObj (IOpaqueAddress *pAddr, DataObject *&pObj)
 Create a transient object from a persistent representation.
virtual StatusCode createRep (DataObject *pObj, IOpaqueAddress *&pAddr)
 Create a persistent representation for a transient object.
bool msgLvl (const MSG::Level lvl) const
 Test the output level.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.
void setLevel (MSG::Level lvl)
 Change the current logging level.

Static Public Member Functions

static long storageType ()
static const CLID & classID ()

Private Member Functions

void initMessaging () const
 Initialize our message level and MessageSvc.

Private Attributes

RootType m_type
 the type we can convert
std::string m_nm
 Message source name.
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels).
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer.
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level.
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging).

Detailed Description

Definition at line 34 of file xAODCnv.h.

Constructor & Destructor Documentation

◆ xAODCnv() [1/2]

Athena::xAODCnv::xAODCnv ( const CLID & clid,
ISvcLocator * pSvcLocator )

Constructor with parameters:

Definition at line 54 of file xAODCnv.cxx.

55 :
56 ::Converter( pool::ROOT_StorageType.type(), clid, pSvcLocator ),
57 ::AthMessaging( msgSvc(), name_from_clid(clid) ),
58 m_type()
59{
60 //
61 // Property declaration
62 //
63 //declareProperty( "Property", m_nProperty );
64
65}
AthMessaging()
Default constructor:
RootType m_type
the type we can convert
Definition xAODCnv.h:89
static const DbType ROOT_StorageType
Definition DbType.h:85

◆ xAODCnv() [2/2]

Athena::xAODCnv::xAODCnv ( ISvcLocator * pSvcLocator)

Definition at line 67 of file xAODCnv.cxx.

67 :
68 ::Converter ( pool::ROOT_StorageType.type(), CLID_NULL, pSvcLocator ),
69 ::AthMessaging( msgSvc(), name_from_clid(CLID_NULL) ),
70 m_type()
71{
72 //
73 // Property declaration
74 //
75 //declareProperty( "Property", m_nProperty );
76 ATH_MSG_DEBUG("Constructor xAODCnv...");
77
78}
#define ATH_MSG_DEBUG(x,...)

◆ ~xAODCnv()

Athena::xAODCnv::~xAODCnv ( )
virtual

Destructor:

Definition at line 82 of file xAODCnv.cxx.

83{
84 ATH_MSG_DEBUG("Calling destructor");
85}

Member Function Documentation

◆ classID()

const CLID & Athena::xAODCnv::classID ( )
inlinestatic
Returns
class ID.

Definition at line 80 of file xAODCnv.h.

80{ return CLID_NULL; }

◆ createObj()

StatusCode Athena::xAODCnv::createObj ( IOpaqueAddress * pAddr,
DataObject *& pObj )
virtual

Create a transient object from a persistent representation.

Parameters
pAddr[IN] IOpaqueAddress of persistent representation.
pObj[OUT] pointer to the transient object.

Definition at line 143 of file xAODCnv.cxx.

144{
145 ATH_MSG_DEBUG("::createObj(" << pAddr << ", " << pObj << ")");
146 Athena::xAODBranchAddress *rba = dynamic_cast<Athena::xAODBranchAddress*>(pAddr);
147 if (!rba) {
148 ATH_MSG_DEBUG(*pAddr->par() << " is NOT a GenericAddress!");
149 return StatusCode::FAILURE;
150 }
151 ATH_MSG_DEBUG("loading branch: [" << rba->par()[0]
152 << "/" << rba->par()[1] << "]...");
153 //rba->setBranchAddress(m_type);
154 ATH_MSG_DEBUG("xAODCnv::createObj 1");
155 // FIXME JE
156 rba->setEventAddress();
157 ATH_MSG_DEBUG("loading branch: [" << rba->par()[0]
158 << "/" << rba->par()[1] << "]... [done]");
159 ATH_MSG_DEBUG("xAODCnv::createObj 2");
160 Athena::DataBucketBranch *dbb = new DataBucketBranch(rba->clID(), m_type, rba->m_ptr);
161 dbb->allowMismatchCLID = true; //FIXME WB : hack to allow requests from other clid types
162 ATH_MSG_DEBUG("xAODCnv::createObj 3");
163 pObj = dbb;
164 ATH_MSG_DEBUG("xAODCnv::createObj 4");
165 return StatusCode::SUCCESS;
166}

◆ createRep()

StatusCode Athena::xAODCnv::createRep ( DataObject * pObj,
IOpaqueAddress *& pAddr )
virtual

Create a persistent representation for a transient object.

Parameters
pObj[IN] pointer to the transient object.
pAddr[OUT] IOpaqueAddress of persistent representation.

Definition at line 172 of file xAODCnv.cxx.

173{
174 ATH_MSG_DEBUG("Calling xAODCnv::createRep");
175
176 ATH_MSG_INFO("::createRep(" << pObj << ", " << pAddr << ")");
177 if (0==pObj) {
178 ATH_MSG_ERROR("::createRep: received null ptr to dobj");
179 return StatusCode::FAILURE;
180 }
181 msg(MSG::INFO) << " -> clid: [" << pObj->clID() << "]" << endmsg
182 << " -> name: [" << pObj->name() << "]" << endmsg;
183
184 /*
185 Athena::DataBucketBranch *dbb = 0;
186 dbb = dynamic_cast<Athena::DataBucketBranch*>(pObj);
187 if (!dbb) {
188 ATH_MSG_INFO("dataobject at [" << pObj->name() << "] is not"
189 << " a DataBucketBranch ! [clid=" << pObj->clID() << "]");
190 return StatusCode::FAILURE;
191 }
192 */
193
194 // FIXME:
195 // Athena::RootBranchAddress* addr = new Athena::RootBranchAddress
196 // (pool::ROOT_StorageType.type(),
197 // dbb->clID(),
198 // m_tupleName.value(),
199 // br_name,
200 // (unsigned long)(value_ptr),
201 // (unsigned long)(m_nbrEvts-1));
202#if 1
203 GenericAddress* addr = new GenericAddress(pool::ROOT_StorageType.type(),
204 pObj->clID(),
205 pObj->name());
206#else
207 Athena::xAODBranchAddress* addr = new Athena::xAODBranchAddress
209 "foo",//m_tupleName.value(),
210 dbb->name(),
211 (unsigned long)(value_ptr),
212 (unsigned long)(m_nbrEvts-1));
213#endif
214 pAddr = addr;
215 return StatusCode::SUCCESS;
216}
#define endmsg
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_INFO(x,...)
MsgStream & msg() const
The standard message stream.

◆ initialize()

StatusCode Athena::xAODCnv::initialize ( )
virtual

Gaudi Service Implementation.

Definition at line 89 of file xAODCnv.cxx.

90{
91 // configure our MsgStream
92 //msg().setLevel( MSG::INFO );
93
94 ATH_MSG_DEBUG("Initializing xAODCnv...");
95
96 ATH_MSG_DEBUG("Initializing base class...");
97 if ( ::Converter::initialize().isFailure() ) {
98 ATH_MSG_ERROR("Could not intialize base class !!");
99 return StatusCode::FAILURE;
100 } else {
101 ATH_MSG_VERBOSE("Base class initialized");
102 }
103
104 // retrieve the dict-loader-svc
105 typedef ServiceHandle<IDictLoaderSvc> IDictLoaderSvc_t;
106 IDictLoaderSvc_t dictSvc("AthDictLoaderSvc",
107 "Athena::xAODCnv");
108 // name_from_clid(objType()));
109 if ( !dictSvc.retrieve().isSuccess() ) {
110 ATH_MSG_ERROR("could not retrieve [" << dictSvc.typeAndName() << "] !");
111 return StatusCode::FAILURE;
112 }
113
114 RootType ty = dictSvc->load_type(this->objType());
115 ATH_MSG_VERBOSE("loaded dictionary for clid ["
116 << this->objType() << "]: name=["
117 << ty.Name() << "]");
118 m_type = std::move(ty);
119
120 ATH_MSG_DEBUG("converter correctly initialized - clid=[" << objType() << "]");
121 return StatusCode::SUCCESS;
122}
#define ATH_MSG_VERBOSE(x,...)
TTypeAdapter RootType
Definition RootType.h:211
std::string Name(unsigned int mod=Reflex::SCOPED) const
Definition RootType.cxx:610

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40{
42 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)
int outputLevel(const IMessageSvc *ims, const std::string &source)

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 167 of file AthMessaging.h.

168{
169 MsgStream* ms = m_msg_tls.get();
170 if (!ms) {
171 if (!m_initialized.test_and_set()) initMessaging();
172 ms = new MsgStream(m_imsg,m_nm);
173 m_msg_tls.reset( ms );
174 }
175
176 ms->setLevel (m_lvl);
177 return *ms;
178}
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels).
void initMessaging() const
Initialize our message level and MessageSvc.

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 182 of file AthMessaging.h.

183{ return msg() << lvl; }

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152{
153 // If user did not set explicit message level we have to initialize
154 // the messaging and retrieve the default via the MessageSvc.
155 if (m_lvl==MSG::NIL && !m_initialized.test_and_set()) initMessaging();
156
157 if (m_lvl <= lvl) {
158 msg() << lvl;
159 return true;
160 } else {
161 return false;
162 }
163}

◆ repSvcType()

long Athena::xAODCnv::repSvcType ( ) const

Definition at line 129 of file xAODCnv.cxx.

130{
131 ATH_MSG_DEBUG("Calling xAODCnv::repSvcType");
133}
int type() const
Access to full type.
Definition DbType.h:65

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29{
30 m_lvl = lvl;
31}

◆ storageType()

long Athena::xAODCnv::storageType ( )
static
Returns
storage type.

Definition at line 219 of file xAODCnv.cxx.

220{
221 std::cout << "Calling xAODCnv::storageType" << std::endl;
222
224
225}

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging).

Definition at line 141 of file AthMessaging.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels).

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_type

RootType Athena::xAODCnv::m_type
private

the type we can convert

Definition at line 89 of file xAODCnv.h.


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