diff --git a/source/framework/core/inc/TRestMetadata.h b/source/framework/core/inc/TRestMetadata.h index e1e1910ef..cea8ac1c7 100644 --- a/source/framework/core/inc/TRestMetadata.h +++ b/source/framework/core/inc/TRestMetadata.h @@ -239,6 +239,10 @@ class TRestMetadata : public TNamed { TRestMetadata* InstantiateChildMetadata(int index, std::string pattern = ""); TRestMetadata* InstantiateChildMetadata(std::string pattern = "", std::string name = ""); + /// Merge the metadata information from another metadata object. + /// Needs to be implemented in the derived class. + virtual void Merge(const TRestMetadata&); + /// Making default settings. virtual void Initialize() {} diff --git a/source/framework/core/src/TRestMetadata.cxx b/source/framework/core/src/TRestMetadata.cxx index 4fcccc1fe..82f31fa72 100644 --- a/source/framework/core/src/TRestMetadata.cxx +++ b/source/framework/core/src/TRestMetadata.cxx @@ -2661,3 +2661,14 @@ TString TRestMetadata::GetWarningMessage() { else return "No warning!"; } + +void TRestMetadata::Merge(const TRestMetadata& metadata) { + if (!metadata.InheritsFrom(ClassName())) { + RESTError << "TRestMetadata::Merge. Metadata is not of type " << ClassName() << RESTendl; + exit(1); + } + + if (fName.IsNull()) { + fName = metadata.GetName(); + } +}