File indexing completed on 2025-05-11 08:57:27
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #ifndef FWCORE_IMETADATASERVICE_H
0020 #define FWCORE_IMETADATASERVICE_H
0021
0022 #include "GaudiKernel/IInterface.h"
0023
0024 #include "podio/Frame.h"
0025
0026 class IMetadataSvc : virtual public IInterface {
0027 friend class Writer;
0028
0029 public:
0030 DeclareInterfaceID(IMetadataSvc, 1, 0);
0031
0032 virtual void setFrame(podio::Frame&& frame) = 0;
0033
0034 template <typename T> void put(const std::string& name, const T& obj) {
0035 if (!getFrame()) {
0036 setFrame(podio::Frame{});
0037 }
0038 getFrame()->putParameter(name, obj);
0039 }
0040
0041 template <typename T> std::optional<T> get(const std::string& name) const {
0042 const auto* frame = getFrame();
0043 if (!frame) {
0044 return std::nullopt;
0045 }
0046 return frame->getParameter<T>(name);
0047 }
0048
0049 protected:
0050 virtual podio::Frame* getFrame() = 0;
0051 virtual const podio::Frame* getFrame() const = 0;
0052 };
0053
0054 #endif