From 5054147043f10241ec11b41195ff682090edfd2a Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 22 May 2007 07:23:38 +0000 Subject: Finished documentation for balance_pair_t. --- src/numerics/balance.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/numerics/balance.h') diff --git a/src/numerics/balance.h b/src/numerics/balance.h index b132115f..34b2fcc7 100644 --- a/src/numerics/balance.h +++ b/src/numerics/balance.h @@ -77,14 +77,12 @@ class balance_t public: typedef std::map amounts_map; -protected: amounts_map amounts; // jww (2007-05-20): Remove these two by adding access methods friend class value_t; friend class entry_base_t; -public: /** * Constructors. balance_t supports similar forms of construction * to amount_t. @@ -233,7 +231,8 @@ public: balance_t& operator-=(const balance_t& bal); balance_t& operator-=(const amount_t& amt); - balance_t& operator*=(const amount_t& amt); + virtual balance_t& operator*=(const amount_t& amt); + balance_t& operator*=(const double val) { return *this *= amount_t(val); } @@ -244,7 +243,8 @@ public: return *this *= amount_t(val); } - balance_t& operator/=(const amount_t& amt); + virtual balance_t& operator/=(const amount_t& amt); + balance_t& operator/=(const double val) { return *this /= amount_t(val); } @@ -294,7 +294,7 @@ public: temp.in_place_negate(); return temp; } - balance_t& in_place_negate() { + virtual balance_t& in_place_negate() { for (amounts_map::iterator i = amounts.begin(); i != amounts.end(); i++) @@ -319,10 +319,10 @@ public: temp.in_place_reduce(); return temp; } - balance_t& in_place_reduce() { - balance_t temp; + virtual balance_t& in_place_reduce() { // A temporary must be used here because reduction may cause // multiple component amounts to collapse to the same commodity. + balance_t temp; for (amounts_map::const_iterator i = amounts.begin(); i != amounts.end(); i++) @@ -335,10 +335,10 @@ public: temp.in_place_unreduce(); return temp; } - balance_t& in_place_unreduce() { - balance_t temp; + virtual balance_t& in_place_unreduce() { // A temporary must be used here because unreduction may cause // multiple component amounts to collapse to the same commodity. + balance_t temp; for (amounts_map::const_iterator i = amounts.begin(); i != amounts.end(); i++) @@ -499,7 +499,7 @@ public: out << ")"; } - bool valid() const { + virtual bool valid() const { for (amounts_map::const_iterator i = amounts.begin(); i != amounts.end(); i++) -- cgit v1.2.3