Handle class for the abstract body class RWExchangeImpl from which all concrete currency converters derive. More...
#include <rw/currency/currexchange.h>
Public Member Functions | |
RWExchange () | |
RWExchange (const RWExchange< T > &c) | |
RWExchange (RWExchangeImpl< T > *impl) | |
RWMoney< T > | exchange (const RWMoney< T > &m) const |
const RWExchangeImpl< T > * | impl () const |
bool | isValid () const |
RWCString | name () const |
RWExchange< T > & | operator= (const RWExchange< T > &c) |
void | setImpl (RWExchangeImpl< T > *impl) |
RWCString | source () const |
RWCString | target () const |
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 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 exchange objects share a common API for performing the actual conversion of money.
|
inline |
Default constructor.
|
inline |
Makes a (deep) copy of the implementation for currency exchange object c.
|
inline |
Constructs an exchange object with the provided implementation impl. The object's destructor will delete impl.
|
inline |
Converts the amount m from the source currency to the target currency. If the currency associated with m does not match the source currency of self, an exception is thrown.
|
inline |
Returns a pointer to the implementation class.
|
inline |
Returns true
if this exchange object has a valid implementation, false
otherwise.
|
inline |
Returns the name of the implementation class. Rogue Wave implementation classes return their static data member exchangeMethodName
. For example, when an RWExchange object contains an RWTriangularExchange implementation, name() returns RWTriangularExchange::exchangeMethodName.
|
inline |
Deletes self's current implementation and clones a copy of the implementation for c.
|
inline |
Sets impl as the implementation for this exchange object.
|
inline |
Returns the mnemonic for the source currency.
|
inline |
Returns the mnemonic for the target currency.
Copyright © 2021 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |