diff --git a/k4FWCore/components/Writer.cpp b/k4FWCore/components/Writer.cpp index f44dce11..a613be8e 100644 --- a/k4FWCore/components/Writer.cpp +++ b/k4FWCore/components/Writer.cpp @@ -122,7 +122,7 @@ class Writer final : public Gaudi::Functional::ConsumergetWriter()->writeFrame(config_metadata_frame, "configuration_metadata"); - if (const auto* metadata_frame = std::as_const(*m_metadataSvc).getFrame(); metadata_frame) { + if (const auto* metadata_frame = m_metadataSvc->getFrame(); metadata_frame) { iosvc->getWriter()->writeFrame(*metadata_frame, podio::Category::Metadata); } diff --git a/k4FWCore/include/k4FWCore/IMetadataSvc.h b/k4FWCore/include/k4FWCore/IMetadataSvc.h index c88df593..6066a301 100644 --- a/k4FWCore/include/k4FWCore/IMetadataSvc.h +++ b/k4FWCore/include/k4FWCore/IMetadataSvc.h @@ -24,11 +24,12 @@ #include "podio/Frame.h" class IMetadataSvc : virtual public IInterface { + friend class Writer; + public: DeclareInterfaceID(IMetadataSvc, 1, 0); - virtual const podio::Frame* getFrame() const = 0; - virtual void setFrame(podio::Frame&& frame) = 0; + virtual void setFrame(podio::Frame&& frame) = 0; template void put(const std::string& name, const T& obj) { if (!getFrame()) { @@ -46,7 +47,8 @@ class IMetadataSvc : virtual public IInterface { } protected: - virtual podio::Frame* getFrame() = 0; + virtual podio::Frame* getFrame() = 0; + virtual const podio::Frame* getFrame() const = 0; }; #endif