balance_t is no longer a superclass
This commit is contained in:
parent
a8e2a674a8
commit
e1eb12a6e4
1 changed files with 9 additions and 10 deletions
|
|
@ -146,7 +146,7 @@ public:
|
||||||
* Destructor. Destroys all of the accumulated amounts in the
|
* Destructor. Destroys all of the accumulated amounts in the
|
||||||
* balance.
|
* balance.
|
||||||
*/
|
*/
|
||||||
virtual ~balance_t() {
|
~balance_t() {
|
||||||
TRACE_DTOR(balance_t);
|
TRACE_DTOR(balance_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -232,7 +232,7 @@ public:
|
||||||
balance_t& operator-=(const balance_t& bal);
|
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 amount_t& amt);
|
||||||
|
|
||||||
balance_t& operator*=(const double val) {
|
balance_t& operator*=(const double val) {
|
||||||
return *this *= amount_t(val);
|
return *this *= amount_t(val);
|
||||||
|
|
@ -244,7 +244,7 @@ public:
|
||||||
return *this *= amount_t(val);
|
return *this *= amount_t(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual balance_t& operator/=(const amount_t& amt);
|
balance_t& operator/=(const amount_t& amt);
|
||||||
|
|
||||||
balance_t& operator/=(const double val) {
|
balance_t& operator/=(const double val) {
|
||||||
return *this /= amount_t(val);
|
return *this /= amount_t(val);
|
||||||
|
|
@ -295,10 +295,9 @@ public:
|
||||||
temp.in_place_negate();
|
temp.in_place_negate();
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
virtual balance_t& in_place_negate() {
|
void in_place_negate() {
|
||||||
foreach (amounts_map::value_type& pair, amounts)
|
foreach (amounts_map::value_type& pair, amounts)
|
||||||
pair.second.in_place_negate();
|
pair.second.in_place_negate();
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
balance_t operator-() const {
|
balance_t operator-() const {
|
||||||
return negate();
|
return negate();
|
||||||
|
|
@ -352,13 +351,13 @@ public:
|
||||||
temp.in_place_reduce();
|
temp.in_place_reduce();
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
virtual balance_t& in_place_reduce() {
|
void in_place_reduce() {
|
||||||
// A temporary must be used here because reduction may cause
|
// A temporary must be used here because reduction may cause
|
||||||
// multiple component amounts to collapse to the same commodity.
|
// multiple component amounts to collapse to the same commodity.
|
||||||
balance_t temp;
|
balance_t temp;
|
||||||
foreach (const amounts_map::value_type& pair, amounts)
|
foreach (const amounts_map::value_type& pair, amounts)
|
||||||
temp += pair.second.reduced();
|
temp += pair.second.reduced();
|
||||||
return *this = temp;
|
*this = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
balance_t unreduced() const {
|
balance_t unreduced() const {
|
||||||
|
|
@ -366,13 +365,13 @@ public:
|
||||||
temp.in_place_unreduce();
|
temp.in_place_unreduce();
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
virtual balance_t& in_place_unreduce() {
|
void in_place_unreduce() {
|
||||||
// A temporary must be used here because unreduction may cause
|
// A temporary must be used here because unreduction may cause
|
||||||
// multiple component amounts to collapse to the same commodity.
|
// multiple component amounts to collapse to the same commodity.
|
||||||
balance_t temp;
|
balance_t temp;
|
||||||
foreach (const amounts_map::value_type& pair, amounts)
|
foreach (const amounts_map::value_type& pair, amounts)
|
||||||
temp += pair.second.unreduced();
|
temp += pair.second.unreduced();
|
||||||
return *this = temp;
|
*this = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
optional<balance_t>
|
optional<balance_t>
|
||||||
|
|
@ -522,7 +521,7 @@ public:
|
||||||
out << ")";
|
out << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool valid() const {
|
bool valid() const {
|
||||||
foreach (const amounts_map::value_type& pair, amounts)
|
foreach (const amounts_map::value_type& pair, amounts)
|
||||||
if (! pair.second.valid())
|
if (! pair.second.valid())
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue