Money.h++ provides three different conversion methods:
Multiplication. Multiply the source currency amount by a conversion factor to determine the target currency amount. Corresponds to C++ class RWMultiplicationExchange; Java class MultiplicationExchange.
Division. Divide the source currency amount by a conversion factor to determine the target currency amount. Corresponds to C++ class RWDivisionExchange; Java class DivisionExchange.
Triangulation. Convert the source currency amount to an intermediate currency amount, then convert the intermediate currency amount to the target currency amount. This is the conversion method that is used to convert among currencies that are in transition to the Euro currency. Corresponds to C++ class RWTriangularExchange; Java class TriangularExchange.
The C++ class RWExchange contains a pointer to implementation class of type RWExchangeImpl, and defers to that implementation when actually performing a currency conversion. Money.h++ provides three C++ currency exchange classes, corresponding to the conversion methods listed above, that derived from the abstract base class RWExchangeImpl. The three exchange classes are implementation classes of class RWExchange, which presents a generic interface for performing currency exchanges.
The different implementations share an interface, but work differently from one another. For example, an RWExchange object that contains an RWMultiplicationExchange implementation performs a currency exchange by invoking an implementation multiplies the amount in the source currency by a conversion factor to get the amount in the target currency.
Contrast this with an RWExchange object that contains an RWTriangularExchange implementation. RWTriangularExchange invokes an implementation that converts the source currency to a base currency, then converts the base currency to the target. First, the RWTriangularExchange implementation converts the source to the base by dividing the source by a base-to-source conversion factor. Then it multiplies the result by a base-to-target conversion factor to obtain the target. This is the algorithm mandated by the European Monetary Union (EMU) for converting between local EMU currencies during the Euro transition period.
In Java, MultiplicationExchange and DivisionExchange inherit directly from abstract base class BilateralExchange. Class BilateralExchange and class TriangularExchange both inherit from the abstract base class Exchange.
©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.