Skip to content

Commit

Permalink
Merge pull request #4487 from macumber/less_than_bcl
Browse files Browse the repository at this point in the history
Add operator< for BCLComponent and BCLMeasure
  • Loading branch information
tijcolem committed Nov 3, 2021
2 parents 93c1b91 + dd22a5f commit 3731f8c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/utilities/bcl/BCLComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,8 @@ bool BCLComponent::operator!=(const BCLComponent& other) const {
return !(operator==(other));
}

bool BCLComponent::operator<(const BCLComponent& other) const {
return (uid() + versionId()) < (other.uid() + other.versionId());
}

} // namespace openstudio
3 changes: 3 additions & 0 deletions src/utilities/bcl/BCLComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ class UTILITIES_API BCLComponent
/// Negation of ==.
bool operator!=(const BCLComponent& other) const;

/// Less than
bool operator<(const BCLComponent& other) const;

//@}
private:
REGISTER_LOGGER("openstudio.BCLComponent");
Expand Down
4 changes: 4 additions & 0 deletions src/utilities/bcl/BCLMeasure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,10 @@ bool BCLMeasure::operator!=(const BCLMeasure& other) const {
return !(operator==(other));
}

bool BCLMeasure::operator<(const BCLMeasure& other) const {
return (uid() + versionId()) < (other.uid() + other.versionId());
}

bool BCLMeasure::save() const {
return m_bclXML.save();
}
Expand Down
3 changes: 3 additions & 0 deletions src/utilities/bcl/BCLMeasure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ class UTILITIES_API BCLMeasure

bool operator!=(const BCLMeasure& other) const;

/// Less than
bool operator<(const BCLMeasure& other) const;

/// Save the measure.xml back to the directory
bool save() const;

Expand Down

0 comments on commit 3731f8c

Please sign in to comment.