ATLAS Offline Software
IByteStreamCnvSvc.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef BYTESTREAMCNVSVCBASE_IBYTESTREAMCNVSVC_H
6 #define BYTESTREAMCNVSVCBASE_IBYTESTREAMCNVSVC_H
7 
8 #include "GaudiKernel/IInterface.h"
9 
13 
14 
18 class IByteStreamCnvSvc : virtual public IInterface {
19 public:
22 
24  template <class T> StatusCode getFullEventAssembler(T*&t, const std::string& name);
25 
26 protected:
27 
31  virtual FullEventAssemblerBase* findFullEventAssembler(const std::string& name) const = 0;
32 
36  virtual StatusCode storeFullEventAssembler(std::unique_ptr<FullEventAssemblerBase> fea, const std::string& name) = 0;
37 };
38 
39 
40 // Implementation of template method:
41 template <class T>
43 {
44  // Find existing FEA
46  if (fea) {
47  t = dynamic_cast<T*>(fea);
48  if (t == nullptr) {
49  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "IByteStreamCnvSvc")
50  << "FullEventAssembler with key '" << name << "' exists, but of different type" << endmsg;
51  return StatusCode::FAILURE;
52  }
53  return StatusCode::SUCCESS;
54  }
55  else { // create new FEA
56  auto ptr = std::make_unique<T>();
57  t = ptr.get();
58  return storeFullEventAssembler(std::move(ptr), name);
59  }
60 }
61 
62 #endif
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
FullEventAssemblerBase
base class for assembling a full atlas raw event from subfragments
Definition: FullEventAssembler.h:23
IByteStreamCnvSvc::DeclareInterfaceID
DeclareInterfaceID(IByteStreamCnvSvc, 1, 0)
Gaudi interface id.
RawEvent.h
IByteStreamCnvSvc
interface for bytestream conversion services
Definition: IByteStreamCnvSvc.h:18
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
IByteStreamCnvSvc::storeFullEventAssembler
virtual StatusCode storeFullEventAssembler(std::unique_ptr< FullEventAssemblerBase > fea, const std::string &name)=0
Store FullEventAssembler under given name.
FullEventAssembler.h
REPORT_MESSAGE_WITH_CONTEXT
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:345
IByteStreamCnvSvc::findFullEventAssembler
virtual FullEventAssemblerBase * findFullEventAssembler(const std::string &name) const =0
Find FullEventAssembler with given name.
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
errorcheck.h
Helpers for checking error return status codes and reporting errors.
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
IByteStreamCnvSvc::getFullEventAssembler
StatusCode getFullEventAssembler(T *&t, const std::string &name)
Access to FullEventAssembler.
Definition: IByteStreamCnvSvc.h:42