Subtotal keeps the sum of all its underlying BaseAmounts. The sum is computed at the moment when it is queried. And a Subtotal can be used just like an Amount.
computedTraits() is only valid after computing a sum.
ToDo: traits() should possibly compute traits_. Performance concern: precise(), traits() scans twice.
Definition at line 263 of file amount.h.
typedef std::vector<BaseAmount*> OSB_LIB::Subtotal::AmountList |
typedef AmountList::const_iterator OSB_LIB::Subtotal::AmountListCI |
typedef AmountList::iterator OSB_LIB::Subtotal::AmountListI |
enum OSB_LIB::Subtotal::SumType [private] |
OSB_LIB::Subtotal::Subtotal | ( | const ChargeTraits & | ct, | |
const Date & | dt = Date() | |||
) | [inline] |
OSB_LIB::Subtotal::Subtotal | ( | const Subtotal & | ) |
c'tor III.
bool OSB_LIB::Subtotal::accumulateTaxes | ( | ) | [virtual] |
void OSB_LIB::Subtotal::addItem | ( | BaseAmount & | ) |
Add a new item to the subtotal (pointer to original!).
AmountListI OSB_LIB::Subtotal::amountListBegin | ( | ) | [inline] |
AmountListCI OSB_LIB::Subtotal::amountListBegin | ( | ) | const [inline] |
AmountListI OSB_LIB::Subtotal::amountListEnd | ( | ) | [inline] |
AmountListCI OSB_LIB::Subtotal::amountListEnd | ( | ) | const [inline] |
Date OSB_LIB::Subtotal::dateByType | ( | AttributeType | dt | ) | const [inline] |
Returns date of a given attribute type.
Definition at line 315 of file amount.h.
References assigned, computedRefDate_, and OSB_LIB::BaseAmount::refDate().
Referenced by refDate().
void OSB_LIB::Subtotal::precise | ( | MoneyList & | ml | ) | const [inline, virtual] |
Returns total precise amount by currency.
Implements OSB_LIB::BaseAmount.
Definition at line 278 of file amount.h.
References su_precise, and sum().
Date OSB_LIB::Subtotal::refDate | ( | ) | const [inline, virtual] |
Returns date reference of primary type attribute.
Reimplemented from OSB_LIB::BaseAmount.
Definition at line 312 of file amount.h.
References dateByType(), and primaryAttribute_.
void OSB_LIB::Subtotal::rounded | ( | MoneyList & | ml | ) | const [inline, virtual] |
Returns total rounded amount by currency.
Implements OSB_LIB::BaseAmount.
Definition at line 282 of file amount.h.
References su_rounded, and sum().
void OSB_LIB::Subtotal::setTraits | ( | const ChargeTraits & | ct, | |
const Date & | dt = Date() | |||
) | [inline, virtual] |
setTraits() sets assigned traits and reDate and makes them primary.
Reimplemented from OSB_LIB::BaseAmount.
Definition at line 321 of file amount.h.
References assigned, primaryAttribute_, and OSB_LIB::BaseAmount::setTraits().
bool OSB_LIB::Subtotal::taxesReady | ( | ) | const [virtual] |
ChargeTraits OSB_LIB::Subtotal::traits | ( | ) | const [inline, virtual] |
Returns primary attribute charge traits.
Reimplemented from OSB_LIB::BaseAmount.
Definition at line 304 of file amount.h.
References primaryAttribute_, and traitsByType().
ChargeTraits OSB_LIB::Subtotal::traitsByType | ( | AttributeType | tt | ) | const [inline] |
Returns charge traits of a given attribute type.
Definition at line 307 of file amount.h.
References assigned, computedTraits_, and OSB_LIB::BaseAmount::traits().
Referenced by traits().
virtual std::ostream& OSB_LIB::Subtotal::write | ( | std::ostream & | ) | const [virtual] |
Implements OSB_LIB::BaseAmount.
Date OSB_LIB::Subtotal::computedRefDate_ [mutable, private] |
ChargeTraits OSB_LIB::Subtotal::computedTraits_ [mutable, private] |
Contains the 'logical sum' of the traits and refDate of all items.
This is set by the functions which build the sum.
Definition at line 356 of file amount.h.
Referenced by traitsByType().
AmountList OSB_LIB::Subtotal::items_ [private] |
Subtotal amount list.
Definition at line 359 of file amount.h.
Referenced by amountListBegin(), and amountListEnd().