diff options
author | John Wiegley <johnw@newartisans.com> | 2007-05-22 07:23:38 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 03:39:07 -0400 |
commit | 5054147043f10241ec11b41195ff682090edfd2a (patch) | |
tree | e8331d5ce88bff624679c2a3665b40a7dae74f01 /src/numerics/balance.h | |
parent | ce4ed2b25cd4ead67a52cf42e05c7091aff9b3c7 (diff) | |
download | fork-ledger-5054147043f10241ec11b41195ff682090edfd2a.tar.gz fork-ledger-5054147043f10241ec11b41195ff682090edfd2a.tar.bz2 fork-ledger-5054147043f10241ec11b41195ff682090edfd2a.zip |
Finished documentation for balance_pair_t.
Diffstat (limited to 'src/numerics/balance.h')
-rw-r--r-- | src/numerics/balance.h | 20 |
1 files changed, 10 insertions, 10 deletions
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<const commodity_t *, amount_t> 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++) |