OSB_LIB::Subtotal Class Reference

Inheritance diagram for OSB_LIB::Subtotal:

Inheritance graph
[legend]
Collaboration diagram for OSB_LIB::Subtotal:

Collaboration graph
[legend]
List of all members.

Detailed Description

Subtotal.

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.

Public Types

Public Member Functions

Private Types

Private Member Functions

Private Attributes


Member Typedef Documentation

typedef std::vector<BaseAmount*> OSB_LIB::Subtotal::AmountList

Definition at line 329 of file amount.h.

typedef AmountList::const_iterator OSB_LIB::Subtotal::AmountListCI

Definition at line 330 of file amount.h.

typedef AmountList::iterator OSB_LIB::Subtotal::AmountListI

Definition at line 331 of file amount.h.


Member Enumeration Documentation

enum OSB_LIB::Subtotal::AttributeType

Charge traits attribute type.

A subtotal has two traits and two dates, one can be assigned explicitely,the other is computed when the subtotal is queried. traits() and refDate()

Returns:
The primary attributes.
Enumerator:
assigned 
computed 

Definition at line 302 of file amount.h.

enum OSB_LIB::Subtotal::SumType [private]

Enumerator:
su_precise 
su_rounded 

Definition at line 347 of file amount.h.


Constructor & Destructor Documentation

OSB_LIB::Subtotal::Subtotal (  )  [inline]

c'tor.

Definition at line 266 of file amount.h.

OSB_LIB::Subtotal::Subtotal ( const ChargeTraits ct,
const Date dt = Date() 
) [inline]

c'tor II.

Definition at line 268 of file amount.h.

OSB_LIB::Subtotal::Subtotal ( const Subtotal  ) 

c'tor III.

OSB_LIB::Subtotal::~Subtotal (  )  [inline]

d'tor.

Definition at line 275 of file amount.h.


Member Function Documentation

bool OSB_LIB::Subtotal::accumulateTaxes (  )  [virtual]

Accumulate taxes.

Implements OSB_LIB::BaseAmount.

void OSB_LIB::Subtotal::addItem ( BaseAmount  ) 

Add a new item to the subtotal (pointer to original!).

AmountListI OSB_LIB::Subtotal::amountListBegin (  )  [inline]

Definition at line 334 of file amount.h.

References items_.

AmountListCI OSB_LIB::Subtotal::amountListBegin (  )  const [inline]

Definition at line 333 of file amount.h.

References items_.

AmountListI OSB_LIB::Subtotal::amountListEnd (  )  [inline]

Definition at line 336 of file amount.h.

References items_.

AmountListCI OSB_LIB::Subtotal::amountListEnd (  )  const [inline]

Definition at line 335 of file amount.h.

References items_.

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().

Subtotal& OSB_LIB::Subtotal::operator= ( const Subtotal  ) 

c'tor IV.

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().

void OSB_LIB::Subtotal::sum ( MoneyList ml,
SumType   
) const [private]

Referenced by precise(), and rounded().

bool OSB_LIB::Subtotal::taxesReady (  )  const [virtual]

Returns taxesReady_ flag.

Reimplemented from OSB_LIB::BaseAmount.

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.


Member Data Documentation

Date OSB_LIB::Subtotal::computedRefDate_ [mutable, private]

Definition at line 357 of file amount.h.

Referenced by dateByType().

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().

AttributeType OSB_LIB::Subtotal::primaryAttribute_ [private]

Indicates which attribute type should be returned by refDate() and traits().

Definition at line 352 of file amount.h.

Referenced by refDate(), setTraits(), and traits().


The documentation for this class was generated from the following file:
Generated on Sat Sep 2 14:09:24 2006 for OSB Library by  doxygen 1.4.7