Converts between local currencies that are part of the European Monetary Union (EMU). More...
#include <rw/currency/triexchange.h>
Public Member Functions | |
RWTriangularExchange () | |
RWTriangularExchange (const RWTriangularExchange< T > &) | |
RWTriangularExchange (const RWCString &source, const RWCString &target, const RWCString &interm, double intermToSource, double intermToTarget) | |
virtual RWExchangeImpl< T > * | clone () const |
virtual RWMoney< T > | exchange (const RWMoney< T > &) const |
RWCString | intermediate () const |
double | intermediateToSourceFactor () const |
double | intermediateToTargetFactor () const |
virtual RWCString | name () const |
RWTriangularExchange< T > & | operator= (const RWTriangularExchange< T > &t) |
void | setIntermediate (const RWCString &i) |
void | setIntermediateToSourceFactor (double f) |
void | setIntermediateToTargetFactor (double f) |
Public Member Functions inherited from RWExchangeImpl< T > | |
void | setSource (const RWCString &src) |
void | setTarget (const RWCString &trg) |
RWCString | source () const |
RWCString | target () const |
Static Public Attributes | |
static const char * | exchangeMethodName |
RWTriangularExchange derives from the abstract base class RWExchangeImpl and implements the currency conversion method used to convert between local currencies that are part of the European Monetary Union (EMU). This class may be used as an implementation class for the RWExchange class, or by itself.
In the triangular currency exchange method of conversion, the source currency is converted to an intermediate currency, for example, the Euro, and the result is converted to the target currency. In a direct currency exchange, the source currency is converted directly to the target currency.
Classes RWMultiplicationExchange and RWDivisionExchange allow a direct conversion from a source to a target currency.
RWTriangularExchange< T >::RWTriangularExchange | ( | ) |
Default constructor. The exchange rate is set to zero and source and target mnemonic strings are set to null.
RWTriangularExchange< T >::RWTriangularExchange | ( | const RWTriangularExchange< T > & | ) |
Copy constructor.
RWTriangularExchange< T >::RWTriangularExchange | ( | const RWCString & | source, |
const RWCString & | target, | ||
const RWCString & | interm, | ||
double | intermToSource, | ||
double | intermToTarget | ||
) |
Constructs a triangular exchange object with source currency mnemonic source, target currency mnemonic target, and intermediate currency mnemonic intermediate. The conversion factor intermToSource is the multiplicative factor for converting amounts in the intermediate currency to amounts in the source currency. The second conversion factor, intermToTarget, is the multiplicative factor for converting amounts in the intermediate currency to amounts in the target currency.
|
virtual |
Returns a copy of self off the heap.
Implements RWExchangeImpl< T >.
|
virtual |
Pure virtual function for converting money from the source currency to the target currency. If the currency associated with money does not match the source currency for self, an exception will be thrown.
Implements RWExchangeImpl< T >.
|
inline |
Returns the intermediate currency's mnemonic.
|
inline |
Returns the multiplicative conversion factor used to convert the intermediate currency to the source currency.
|
inline |
Returns the multiplicative conversion factor used to convert the intermediate currency to the target currency.
|
inlinevirtual |
Pure virtual function that 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.
Implements RWExchangeImpl< T >.
RWTriangularExchange<T>& RWTriangularExchange< T >::operator= | ( | const RWTriangularExchange< T > & | t | ) |
Assignment operator. Copies contents of t to self.
|
inline |
Sets the intermediate currency using the given currency mnemonic.
|
inline |
Sets the multiplicative conversion factor used to convert the intermediate currency to the source currency.
|
inline |
Sets the multiplicative conversion factor used to convert the intermediate currency to the target currency.
|
static |
This data member is the name returned by the name() function.
Copyright © 2021 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |