Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Currency Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWExchange<T>

Module:  Currency   Group:  Conversion


Does not inherit

Local Index

Members

Synopsis

#include <rw/currency/currexchange.h>
#include <rw/currency/divexchange.h>
#include <rw/currency/decimal.h>
#include <rw/currency/mp2int.h>

typedef RWDecimal<RWMP2Int> Decimal;
RWDivisionGroup<Decimal>* impl = 
  new RWDivisionGroup<Decimal>("LBP","CAD",971.8);
RWExchange<Decimal> divExchange(impl);

Description

Currency exchange objects are responsible for converting money of one currency into money of another currency. They encapsulate the source and target currency mnemonics, an exchange algorithm and any required exchange rates.

RWExchangeImpl is an abstract base class from which all currency implementation classes must derive. Class RWExchange<T> is the handle class, which forwards all conversion requests to its associated implementation class.

Currency Module provides three types of currency exchange objects. The first type implements a triangular exchange algorithm required for converting between local currencies through an intermediate currency, such as the EMU requires for the Euro transition. The second type of exchange object multiplies the source currency amount by the exchange factor to obtain a target amount. The third type of exchange object divides the source currency amount by the exchange factor to obtain the target currency amount. All of the exchange objects share a common API for performing the actual conversion of money.

Public Constructors

RWExchange();
RWExchange(const RWExchange<T>& e);
RWExchange(RWExchangeImpl<T>* impl);

Public Member Operators

RWExchange<T>& 
operator=(const RWExchange<T>& e);

Public Member Functions

RWMoney<T> 
exchange(const RWMoney<T>& money) const;
RWExchangeImpl<T>* 
impl() const;
bool
isValid() const;
RWCString
name()const;
void 
setImpl( RWExchangeImpl<T>* impl );
RWCString 
source() const;
RWCString 
target() const;


Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.