ATLAS Offline Software
Loading...
Searching...
No Matches
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
18class IByteStreamCnvSvc : virtual public IInterface {
19public:
22
24 template <class T> StatusCode getFullEventAssembler(T*&t, const std::string& name);
25
26protected:
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:
41template <class T>
42StatusCode IByteStreamCnvSvc::getFullEventAssembler(T*& t, const std::string& name)
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
#define endmsg
Helpers for checking error return status codes and reporting errors.
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
base class for assembling a full atlas raw event from subfragments
interface for bytestream conversion services
DeclareInterfaceID(IByteStreamCnvSvc, 1, 0)
Gaudi interface id.
StatusCode getFullEventAssembler(T *&t, const std::string &name)
Access to FullEventAssembler.
virtual FullEventAssemblerBase * findFullEventAssembler(const std::string &name) const =0
Find FullEventAssembler with given name.
virtual StatusCode storeFullEventAssembler(std::unique_ptr< FullEventAssemblerBase > fea, const std::string &name)=0
Store FullEventAssembler under given name.