From bbb371cf8a75e10ae29af99c49b8d925c37d399e Mon Sep 17 00:00:00 2001 From: wmtan Date: Thu, 8 Aug 2013 00:32:44 +0200 Subject: [PATCH] Do not register parameter set in a constructor --- DQMServices/FwkIO/plugins/DQMRootSource.cc | 4 +--- FWCore/ParameterSet/interface/ParameterSet.h | 11 ++++++++--- FWCore/ParameterSet/src/ParameterSet.cc | 12 ++++++++++-- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/DQMServices/FwkIO/plugins/DQMRootSource.cc b/DQMServices/FwkIO/plugins/DQMRootSource.cc index 96e16db3e7048..fe4df114e7b79 100644 --- a/DQMServices/FwkIO/plugins/DQMRootSource.cc +++ b/DQMServices/FwkIO/plugins/DQMRootSource.cc @@ -800,9 +800,7 @@ DQMRootSource::setupFile(unsigned int iIndex) for(unsigned int index = 0; index != parameterSetTree->GetEntries();++index) { parameterSetTree->GetEntry(index); - cms::Digest dg(blob); - edm::ParameterSetID psID(dg.digest().toString()); - edm::ParameterSet temp(blob,psID); + edm::ParameterSet::registerFromString(blob); } } diff --git a/FWCore/ParameterSet/interface/ParameterSet.h b/FWCore/ParameterSet/interface/ParameterSet.h index bfb4f7a34edaa..66009d9c5b904 100644 --- a/FWCore/ParameterSet/interface/ParameterSet.h +++ b/FWCore/ParameterSet/interface/ParameterSet.h @@ -46,9 +46,6 @@ namespace edm { // construct from coded string. explicit ParameterSet(std::string const& rep); - // construct from coded string and id. Will cause registration - ParameterSet(std::string const& rep, ParameterSetID const& id); - ~ParameterSet(); // instantiate in this library, so these methods don't cause code bloat @@ -272,7 +269,15 @@ namespace edm { VParameterSetEntry* getPSetVectorForUpdate(std::string const& name); + // construct from coded string and register it. + static + void + registerFromString(std::string const& rep); + private: + // construct from coded string and id. + ParameterSet(std::string const& rep, ParameterSetID const& id); + // decode bool fromString(std::string const&); diff --git a/FWCore/ParameterSet/src/ParameterSet.cc b/FWCore/ParameterSet/src/ParameterSet.cc index ebca3bb59cc87..7bc798d55c1a2 100644 --- a/FWCore/ParameterSet/src/ParameterSet.cc +++ b/FWCore/ParameterSet/src/ParameterSet.cc @@ -74,7 +74,7 @@ namespace edm { } // ---------------------------------------------------------------------- - // from coded string and ID. Will cause registration + // from coded string and ID. ParameterSet::ParameterSet(std::string const& code, ParameterSetID const& id) : tbl_(), @@ -87,11 +87,19 @@ namespace edm { << "passed to a ParameterSet during construction is invalid:\n" << code; } - pset::Registry::instance()->insertMapped(*this); } ParameterSet::~ParameterSet() {} + void + ParameterSet::registerFromString(std::string const& rep) { + // from coded string. Will cause registration + cms::Digest dg(rep); + edm::ParameterSetID psID(dg.digest().toString()); + edm::ParameterSet ps(rep, psID); + pset::Registry::instance()->insertMapped(ps); + } + ParameterSet::ParameterSet(ParameterSet const& other) : tbl_(other.tbl_), psetTable_(other.psetTable_),