Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not register parameter set in a constructor #256

Merged
merged 1 commit into from Aug 8, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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