Member Functions | ||
getExchange() impl() |
name() operator=() |
setImpl() |
#include<rw/money/exchggroup.h>
com.roguewave.money.currency.v1_0.ExchangeGroup
A currency exchange group is a collection of currencies that have a common distinguishing characteristic related to converting money from one currency to money of another currency. For example, the Euro Currency Exchange Group consists of all the currencies that will eventually be replaced by the Euro. All currencies in the Euro Currency Exchange Group use the same, special rule for converting money between currencies in this group.
The exchange group classes are implemented using a handle/body or bridge design pattern. The handle class is RWExchangeGroup<T>. This class contains a pointer to implementation class RWExchangeGroupImpl<T>. RWExchangeGroupImpl is an abstract base class from which all currency group implementations must derive. The purpose of an exchange group object is to take as input a source currency, target currency, and an exchange rate table, then produce an exchange object. Thus a key component of the class RWExchangeGroupImpl is a pure virtual method:
virtual RWExchange<T> RWExchangeGroupImpl<T>::getExchange(const RWCString& source, const RWCString& target, const RWExchangeRateTable& rates) const;
Money.h++ includes three currency exchange group implementation classes:
RWEuroGroup<T>, which creates and returns an RWExchange<T> object with the RWTriangularExchange<T> implementation;
RWMultiplicationGroup<T>, which creates and returns an RWExchange<T> object with the RWMultiplicationExchange<T> implementation.
RWDivisionGroup<T>, which creates and returns an RWExchange<T> object with the RWDivisionExchange<T> implementation.
RWExchangeGroup();
Default constructor.
RWExchangeGroup(const RWExchangeGroup<T>& eg);
Makes a (deep) copy of the implementation for currency exchange group object eg.
RWExchangeGroup(RWExchangeGroupImpl<T>* imp);
Constructs an exchange group object with the provided implementation imp. The object's destructor will delete imp.
RWExchange<T> getExchange(const RWCString& sourceMnemonic const RWCString& targetMnemnoic const RWExchangeRateTable& rates)const;
Creates and returns a currency exchange object for converting money in the source currency to money in the target currency using the exchange rates table rates. If the parameters are not valid, an invalid exchange object is returned.
RWExchangeGroupImpl<T>* impl() const;
Returns a pointer to the implementation class.
RWCString name() const = 0;
Returns a name to be associated with the group.
void setImpl(RWExchangeGroupImpl<T>* i);
Sets self to the RWExchangeGroupImpl object pointed to by i.
RWExchangeGroup<T>& operator=(const RWExchange<T>& eg);
Deletes self's current implementation and clones a copy of the implementation for eg.
©Copyright 1999, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.