ATLAS Offline Software
Loading...
Searching...
No Matches
TrigSerializeConverter< DATA > Class Template Reference

#include <TrigSerializeConverter.h>

Inheritance diagram for TrigSerializeConverter< DATA >:
Collaboration diagram for TrigSerializeConverter< DATA >:

Public Member Functions

StatusCode createObj (IOpaqueAddress *iAddr, DataObject *&pO)
StatusCode createRep (DataObject *pObj, IOpaqueAddress *&pAddr)
StatusCode initialize ()
virtual long int repSvcType () const
 TrigSerializeConverter (ISvcLocator *svcloc)
 ~TrigSerializeConverter ()

Static Public Member Functions

static CLID classID ()
static long int storageType ()

Static Public Attributes

static const bool typeIsxAOD = isxAOD<DATA>::value

Private Attributes

ToolHandle< ITrigSerializeConvHelper > m_convHelper
ServiceHandle< StoreGateSvc > m_sgHandle
MsgStream * m_log
StoreGateSvc * m_sgsvc

Detailed Description

template<typename DATA>
class TrigSerializeConverter< DATA >

Definition at line 139 of file TrigSerializeConverter.h.

Constructor & Destructor Documentation

◆ TrigSerializeConverter()

template<typename DATA>
TrigSerializeConverter< DATA >::TrigSerializeConverter ( ISvcLocator * svcloc)
inline

Definition at line 280 of file TrigSerializeConverter.h.

282 m_convHelper( "TrigSerializeConvHelper/TrigSerializeConvHelper" ),
283 m_sgHandle( "StoreGateSvc", "TrigSerializeConverter" ),
284 m_log( 0 ), m_sgsvc( 0 ) {
285
286 m_log = new MsgStream( msgSvc(), "TrigSerializeConverter" );
287 }
ServiceHandle< StoreGateSvc > m_sgHandle
ToolHandle< ITrigSerializeConvHelper > m_convHelper

◆ ~TrigSerializeConverter()

template<typename DATA>
TrigSerializeConverter< DATA >::~TrigSerializeConverter ( )
inline

Definition at line 289 of file TrigSerializeConverter.h.

289 {
290 delete m_log;
291 }

Member Function Documentation

◆ classID()

template<typename DATA>
CLID TrigSerializeConverter< DATA >::classID ( )
inlinestatic

Definition at line 275 of file TrigSerializeConverter.h.

◆ createObj()

template<typename DATA>
StatusCode TrigSerializeConverter< DATA >::createObj ( IOpaqueAddress * iAddr,
DataObject *& pO )
inline

Definition at line 145 of file TrigSerializeConverter.h.

145 {
146
148
149 std::string normalized = SG::normalizedTypeinfoName( typeid(DATA) ); // normalized string representation (matching the names used in the root dictionary)
150
151
152 void *ptr( 0 );
153 if( m_log->level() <= MSG::DEBUG ) {
154 *m_log << MSG::DEBUG << "In createObj for : " << clname << " normalized to " << normalized << endmsg;
155 }
156
158 if( sc.isFailure() ){
159 *m_log << MSG::WARNING << "m_convHelper->createObj failed for "
160 << clname << endmsg;
161 }
162
163 DATA *nObj = ( DATA* ) ptr;
165 if (!nObj){
166 *m_log << MSG::ERROR << "TrigSerializeConverter::createObj: nObj is null."<< endmsg;
167 return StatusCode::FAILURE;
168 }
170 if( m_log->level() <= MSG::DEBUG ) {
171 *m_log << MSG::DEBUG << "IOpaq: " << iAddr
172 << " created nObj: " << nObj << endmsg;
173 }
174
175
176
177
178 if( m_sgsvc){
179 TrigStreamAddress *addr = dynamic_cast< TrigStreamAddress* >( iAddr );
180 if( addr ) {
181 if( m_sgsvc->contains< DATA >( addr->sgkey() ) ) {
182 *m_log << MSG::WARNING << "TrigSerializeConverter::createObj object "
183 << clname << " / " << addr->sgkey()
184 << " is already in the store; not overwriting"
185 << endmsg;
186 } else {
187 sc = m_sgsvc->record( nObj, addr->sgkey() );
188 }
189 if( sc.isFailure() ) {
190 *m_log << MSG::ERROR << "SG::record failed for " << addr->sgkey()
191 << endmsg;
192 } else if( m_log->level() <= MSG::DEBUG ) {
193 *m_log << MSG::DEBUG << "SG::record key: "
194 << addr->sgkey() << " class: " << clname << endmsg;
195 }
196 } else {
197 *m_log << MSG::WARNING << "createObj cast failed" << endmsg;
198 }
199 } else if( m_log->level() <= MSG::DEBUG ) {
200 *m_log << MSG::DEBUG << "did not put an object into SG" << endmsg;
201 }
202
203 return sc;
204 }
std::string normalizedTypeinfoName(const std::type_info &info)
Convert a type_info to a normalized string representation (matching the names used in the root dictio...
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
DATA * finishRead(DATA *d)
Called after an object has been read from BS.

◆ createRep()

template<typename DATA>
StatusCode TrigSerializeConverter< DATA >::createRep ( DataObject * pObj,
IOpaqueAddress *& pAddr )
inline

Definition at line 207 of file TrigSerializeConverter.h.

207 {
208
209 // const std::string clname = ClassID_traits<DATA>::typeName(); // old style, does not contain the _vX of the actual class type
210
211 // const std::type_info& typeId = ClassID_traits<DATA>::typeId(); // damn, this line just does not compile
212
213 std::string classname = SG::normalizedTypeinfoName( typeid(DATA) ); // normalized string representation (matching the names used in the root dictionary)
214
215 DATA *d( 0 );
217 if( m_log->level() <= MSG::DEBUG ) {
218 *m_log << MSG::DEBUG << "My createRep for " << classID() << " "
219 << classname << endmsg;
220 }
221
224 //
226
228 if( m_log->level() <= MSG::DEBUG ) {
229 *m_log << MSG::DEBUG << "convHelper " << ser.size() << endmsg;
230 }
231
233 addr->add( ser );
234
235 pAddr = addr;
236
237 return sc;
238 }
bool fromStorable(DataObject *pDObj, T *&pTrans, bool quiet=false, IRegisterTransient *irt=0, bool isConst=true)
DATA * prepareForWrite(DATA *d, std::unique_ptr< DATA > &)
Called before serializing an object to BS.

◆ initialize()

template<typename DATA>
StatusCode TrigSerializeConverter< DATA >::initialize ( )
inline

Definition at line 240 of file TrigSerializeConverter.h.

240 {
241
242 if( m_log ) {
243 m_log->setLevel( msgSvc()->outputLevel( "TrigSerializeConverter" ) );
244 } else {
245 return StatusCode::FAILURE;
246 }
247
248 StatusCode sc = m_convHelper.retrieve();
249 if( ! sc.isSuccess() ) {
250 if( m_log->level() <= MSG::DEBUG ) {
251 *m_log << MSG::DEBUG << m_convHelper << "not retrieved" << endmsg;
252 }
253 } else {
254 if( m_log->level() <= MSG::DEBUG ) {
255 *m_log << MSG::DEBUG << m_convHelper << "m_serializer retrieved"
256 << endmsg;
257 }
258 if( ! m_convHelper->initialize().isSuccess() ) {
259 if( m_log->level() <= MSG::DEBUG ) {
260 *m_log << MSG::DEBUG << m_convHelper << " not initialized"
261 << endmsg;
262 }
263 }
264 }
265
266 StatusCode scsg = m_sgHandle.retrieve();
267 if (scsg.isFailure())
268 *m_log << MSG::ERROR << "cannot access SG" << endmsg;
269 else {
270 m_sgsvc = m_sgHandle.operator->();
271 }
272 return sc;
273 }

◆ repSvcType()

template<typename DATA>
long int TrigSerializeConverter< DATA >::repSvcType ( ) const
virtual

Definition at line 306 of file TrigSerializeConverter.h.

306 {
307 return storageType();
308}

◆ storageType()

template<typename DATA>
long int TrigSerializeConverter< DATA >::storageType ( )
static

Definition at line 302 of file TrigSerializeConverter.h.

302 {
304}
static long int storageType()

Member Data Documentation

◆ m_convHelper

template<typename DATA>
ToolHandle< ITrigSerializeConvHelper > TrigSerializeConverter< DATA >::m_convHelper
private

Definition at line 294 of file TrigSerializeConverter.h.

◆ m_log

template<typename DATA>
MsgStream* TrigSerializeConverter< DATA >::m_log
private

Definition at line 296 of file TrigSerializeConverter.h.

◆ m_sgHandle

template<typename DATA>
ServiceHandle< StoreGateSvc > TrigSerializeConverter< DATA >::m_sgHandle
private

Definition at line 295 of file TrigSerializeConverter.h.

◆ m_sgsvc

template<typename DATA>
StoreGateSvc* TrigSerializeConverter< DATA >::m_sgsvc
private

Definition at line 297 of file TrigSerializeConverter.h.

◆ typeIsxAOD

template<typename DATA>
const bool TrigSerializeConverter< DATA >::typeIsxAOD = isxAOD<DATA>::value
static

Definition at line 142 of file TrigSerializeConverter.h.


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