Skip to content

Commit

Permalink
Added Quantity::operator>(...).
Browse files Browse the repository at this point in the history
  • Loading branch information
eivindkv authored and wwmayer committed Feb 13, 2015
1 parent 75dab66 commit 8ec6b34
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Base/Quantity.cpp
Expand Up @@ -79,6 +79,14 @@ bool Quantity::operator <(const Quantity& that) const
return (this->_Value < that._Value) ;
}

bool Quantity::operator >(const Quantity& that) const
{
if(this->_Unit != that._Unit)
throw Base::Exception("Quantity::operator >(): quantities need to have same unit to compare");

return (this->_Value > that._Value) ;
}

Quantity Quantity::operator *(const Quantity &p) const
{
return Quantity(this->_Value * p._Value,this->_Unit * p._Unit);
Expand Down
1 change: 1 addition & 0 deletions src/Base/Quantity.h
Expand Up @@ -58,6 +58,7 @@ class BaseExport Quantity
Quantity operator /(const Quantity &p) const;
bool operator ==(const Quantity&) const;
bool operator < (const Quantity&) const;
bool operator > (const Quantity&) const;
Quantity& operator =(const Quantity&);
Quantity pow(const Quantity&)const;
//@}
Expand Down

0 comments on commit 8ec6b34

Please sign in to comment.