Skip to content

Commit

Permalink
Merge pull request #256 from wmtan/doNotUpdateRegistryInConstructor
Browse files Browse the repository at this point in the history
Do not register parameter set in a constructor
  • Loading branch information
ktf committed Aug 8, 2013
2 parents aa48289 + bbb371c commit 961c994
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
4 changes: 1 addition & 3 deletions DQMServices/FwkIO/plugins/DQMRootSource.cc
Expand Up @@ -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);
}
}

Expand Down
11 changes: 8 additions & 3 deletions FWCore/ParameterSet/interface/ParameterSet.h
Expand Up @@ -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
Expand Down Expand Up @@ -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&);

Expand Down
12 changes: 10 additions & 2 deletions FWCore/ParameterSet/src/ParameterSet.cc
Expand Up @@ -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_(),
Expand All @@ -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_),
Expand Down

0 comments on commit 961c994

Please sign in to comment.