Skip to content

Commit

Permalink
Explicitly allow move semantics with ParameterSet
Browse files Browse the repository at this point in the history
ParameterSet and its internals now explicitly allow copy and move.
  • Loading branch information
Dr15Jones committed Aug 31, 2018
1 parent 6e2e834 commit 4bec48b
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 30 deletions.
6 changes: 5 additions & 1 deletion FWCore/ParameterSet/interface/Entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,11 @@ namespace edm {
Entry(std::string const& name, std::string const& type,
std::vector<std::string> const& value, bool is_tracked);

~Entry();
~Entry() = default;
Entry(Entry const&) = default;
Entry(Entry&&) = default;
Entry& operator=(Entry const&) = default;
Entry& operator=(Entry&&) = default;
// encode

std::string toString() const;
Expand Down
11 changes: 5 additions & 6 deletions FWCore/ParameterSet/interface/ParameterSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,11 @@ namespace edm {
// construct from coded string.
explicit ParameterSet(std::string const& rep);

~ParameterSet();

// instantiate in this library, so these methods don't cause code bloat
ParameterSet(ParameterSet const& other);

ParameterSet& operator=(ParameterSet const& other);
~ParameterSet() = default;
ParameterSet(ParameterSet const& other) = default;
ParameterSet(ParameterSet&& other) = default;
ParameterSet& operator=(ParameterSet const& other) = default;
ParameterSet& operator=(ParameterSet&& other) = default;

void swap(ParameterSet& other);

Expand Down
6 changes: 5 additions & 1 deletion FWCore/ParameterSet/interface/ParameterSetEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ namespace edm {
ParameterSetEntry(ParameterSetID const& id, bool isTracked);
explicit ParameterSetEntry(std::string const& rep);

~ParameterSetEntry();
~ParameterSetEntry() = default;
ParameterSetEntry(ParameterSetEntry const&) = default;
ParameterSetEntry(ParameterSetEntry&&) = default;
ParameterSetEntry& operator=(ParameterSetEntry const&) = default;
ParameterSetEntry& operator=(ParameterSetEntry&&) = default;

std::string toString() const;
void toString(std::string& result) const;
Expand Down
6 changes: 5 additions & 1 deletion FWCore/ParameterSet/interface/VParameterSetEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ namespace edm {
VParameterSetEntry(std::vector<ParameterSet> const& vpset, bool isTracked);
VParameterSetEntry(std::string const& rep);

~VParameterSetEntry();
~VParameterSetEntry() = default;
VParameterSetEntry(VParameterSetEntry const&) = default;
VParameterSetEntry(VParameterSetEntry&&) = default;
VParameterSetEntry& operator=(VParameterSetEntry const&) = default;
VParameterSetEntry& operator=(VParameterSetEntry&&) = default;

std::string toString() const;
void toString(std::string& result) const;
Expand Down
2 changes: 0 additions & 2 deletions FWCore/ParameterSet/src/Entry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ namespace edm {
static pset::TypeTrans const sTypeTranslations;
typedef std::map<std::string, char> Type2Code;

Entry::~Entry() {}

// ----------------------------------------------------------------------
// consistency-checker
// ----------------------------------------------------------------------
Expand Down
15 changes: 0 additions & 15 deletions FWCore/ParameterSet/src/ParameterSet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ namespace edm {
}
}

ParameterSet::~ParameterSet() {}

void
ParameterSet::registerFromString(std::string const& rep) {
// from coded string. Will cause registration
Expand All @@ -107,19 +105,6 @@ namespace edm {
return ParameterSetID(newDigest.digest().toString());
}

ParameterSet::ParameterSet(ParameterSet const& other)
: tbl_(other.tbl_),
psetTable_(other.psetTable_),
vpsetTable_(other.vpsetTable_),
id_(other.id_) {
}

ParameterSet& ParameterSet::operator=(ParameterSet const& other) {
ParameterSet temp(other);
swap(temp);
return *this;
}

void ParameterSet::copyForModify(ParameterSet const& other) {
ParameterSet temp(other);
swap(temp);
Expand Down
2 changes: 0 additions & 2 deletions FWCore/ParameterSet/src/ParameterSetEntry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ namespace edm {
theID_.swap(newID);
}

ParameterSetEntry::~ParameterSetEntry() {}

void
ParameterSetEntry::toString(std::string& result) const {
result += isTracked() ? "+Q(" : "-Q(";
Expand Down
2 changes: 0 additions & 2 deletions FWCore/ParameterSet/src/VParameterSetEntry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ namespace edm {
}
}

VParameterSetEntry::~VParameterSetEntry() {}

void
VParameterSetEntry::toString(std::string& result) const {
assert(theIDs_);
Expand Down

0 comments on commit 4bec48b

Please sign in to comment.