8#ifndef TRIGSERIALIZECONVERTER_H
9#define TRIGSERIALIZECONVERTER_H
11#include "GaudiKernel/Converter.h"
12#include "GaudiKernel/ToolHandle.h"
13#include "GaudiKernel/ServiceHandle.h"
50 constexpr static typename std::enable_if<std::is_base_of<SG::AuxElement,typename std::pointer_traits<typename C::value_type>::element_type>
::value,
bool>
::type isxAODVector(
C*){
return true;}
54 constexpr static typename std::enable_if<std::is_base_of<SG::IAuxStore,C>::value,
bool>
::type isAuxVector(
C*){
return true;}
92 holder = std::make_unique<ViewVector<DV> > (*d);
124 auto d2 = std::make_unique<ViewVector<DV> > (*d);
130 d->clearPersistent();
138template<
typename DATA >
145 StatusCode
createObj( IOpaqueAddress* iAddr, DataObject *& pO ) {
153 if(
m_log->level() <= MSG::DEBUG ) {
154 *
m_log << MSG::DEBUG <<
"In createObj for : " << clname <<
" normalized to " << normalized <<
endmsg;
158 if(
sc.isFailure() ){
159 *
m_log << MSG::WARNING <<
"m_convHelper->createObj failed for "
163 DATA *nObj = ( DATA* ) ptr;
167 if(
m_log->level() <= MSG::DEBUG ) {
168 *
m_log << MSG::DEBUG <<
"IOpaq: " << iAddr
169 <<
" created nObj: " << nObj <<
endmsg;
179 *
m_log << MSG::WARNING <<
"TrigSerializeConverter::createObj object "
180 << clname <<
" / " << addr->
sgkey()
181 <<
" is already in the store; not overwriting"
186 if(
sc.isFailure() ) {
187 *
m_log << MSG::ERROR <<
"SG::record failed for " << addr->
sgkey()
189 }
else if(
m_log->level() <= MSG::DEBUG ) {
190 *
m_log << MSG::DEBUG <<
"SG::record key: "
191 << addr->
sgkey() <<
" class: " << clname <<
endmsg;
194 *
m_log << MSG::WARNING <<
"createObj cast failed" <<
endmsg;
196 }
else if(
m_log->level() <= MSG::DEBUG ) {
197 *
m_log << MSG::DEBUG <<
"did not put an object into SG" <<
endmsg;
204 StatusCode
createRep( DataObject* pObj, IOpaqueAddress*& pAddr ) {
214 if(
m_log->level() <= MSG::DEBUG ) {
215 *
m_log << MSG::DEBUG <<
"My createRep for " <<
classID() <<
" "
219 std::unique_ptr<DATA> holder;
222 std::vector< uint32_t > ser;
225 if(
m_log->level() <= MSG::DEBUG ) {
226 *
m_log << MSG::DEBUG <<
"convHelper " << ser.size() <<
endmsg;
240 m_log->setLevel( msgSvc()->outputLevel(
"TrigSerializeConverter" ) );
242 return StatusCode::FAILURE;
246 if( !
sc.isSuccess() ) {
247 if(
m_log->level() <= MSG::DEBUG ) {
251 if(
m_log->level() <= MSG::DEBUG ) {
256 if(
m_log->level() <= MSG::DEBUG ) {
264 if (scsg.isFailure())
265 *
m_log << MSG::ERROR <<
"cannot access SG" <<
endmsg;
279 m_convHelper(
"TrigSerializeConvHelper/TrigSerializeConvHelper" ),
280 m_sgHandle(
"StoreGateSvc",
"TrigSerializeConverter" ),
283 m_log =
new MsgStream( msgSvc(),
"TrigSerializeConverter" );
298template <
typename DATA>
302template <
typename DATA>
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
uint32_t CLID
The Class ID type.
convert to and from a SG storable
Identify view containers to be made persistent.
Abstract factory to create the converter.
Base class for elements of a container that can have aux data.
Interface for non-const operations on an auxiliary store.
void setClearOnPersistent()
Set a flag to declare that the vector should be cleared on the next call to toPersistent().
The Athena Transient Store API.
static long int storageType()
ServiceHandle< StoreGateSvc > m_sgHandle
TrigSerializeConverter(ISvcLocator *svcloc)
virtual long int repSvcType() const
StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
static long int storageType()
static const CLID & classID()
ToolHandle< ITrigSerializeConvHelper > m_convHelper
~TrigSerializeConverter()
static const bool typeIsxAOD
StatusCode createObj(IOpaqueAddress *iAddr, DataObject *&pO)
IOpaqueAddress for TrigSerializenCnvSvc.
void add(const std::vector< uint32_t > &a)
const std::string & sgkey() const
Identify view containers to be made persistent.
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...
bool fromStorable(DataObject *pDObj, T *&pTrans, bool quiet=false, IRegisterTransient *irt=0, bool isConst=true)
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
DATA * finishRead(DATA *d)
Called after an object has been read from BS.
DATA * prepareForWrite(DATA *d, std::unique_ptr< DATA > &)
Called before serializing an object to BS.
Helper to disable undefined behavior sanitizer for a function.
#define NO_SANITIZE_UNDEFINED
Convert a type_info to a normalized string representation (matching the names used in the root dictio...
static const std::string & typeName()
static constexpr bool isAuxVector(...)
static constexpr bool isxAODVector(...)
static constexpr std::enable_if< std::is_base_of< SG::IAuxStore, C >::value, bool >::type isAuxVector(C *)
static constexpr std::enable_if< std::is_base_of< SG::AuxElement, typenamestd::pointer_traits< typenameC::value_type >::element_type >::value, bool >::type isxAODVector(C *)