SourcePro® API Reference Guide

 
List of all members | Public Member Functions | Static Public Attributes
RWTriangularExchange< T > Class Template Reference

Converts between local currencies that are part of the European Monetary Union (EMU). More...

#include <rw/currency/triexchange.h>

Inheritance diagram for RWTriangularExchange< T >:
RWExchangeImpl< T >

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
 

Detailed Description

template<class T>
class RWTriangularExchange< T >

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.

Synopsis
#include <rw/currency/triexchange.h>
RWTriangularExchange<double> t("ESP","PTE","EUR" 167.8,203.4);

Constructor & Destructor Documentation

template<class T>
RWTriangularExchange< T >::RWTriangularExchange ( )

Default constructor. The exchange rate is set to zero and source and target mnemonic strings are set to null.

template<class T>
RWTriangularExchange< T >::RWTriangularExchange ( const RWTriangularExchange< T > &  )

Copy constructor.

template<class T>
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.

Member Function Documentation

template<class T>
virtual RWExchangeImpl<T>* RWTriangularExchange< T >::clone ( ) const
virtual

Returns a copy of self off the heap.

Implements RWExchangeImpl< T >.

template<class T>
virtual RWMoney<T> RWTriangularExchange< T >::exchange ( const RWMoney< T > &  money) const
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 >.

template<class T>
RWCString RWTriangularExchange< T >::intermediate ( ) const
inline

Returns the intermediate currency's mnemonic.

template<class T>
double RWTriangularExchange< T >::intermediateToSourceFactor ( ) const
inline

Returns the multiplicative conversion factor used to convert the intermediate currency to the source currency.

template<class T>
double RWTriangularExchange< T >::intermediateToTargetFactor ( ) const
inline

Returns the multiplicative conversion factor used to convert the intermediate currency to the target currency.

template<class T>
virtual RWCString RWTriangularExchange< T >::name ( ) const
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 >.

template<class T>
RWTriangularExchange<T>& RWTriangularExchange< T >::operator= ( const RWTriangularExchange< T > &  t)

Assignment operator. Copies contents of t to self.

template<class T>
void RWTriangularExchange< T >::setIntermediate ( const RWCString i)
inline

Sets the intermediate currency using the given currency mnemonic.

template<class T>
void RWTriangularExchange< T >::setIntermediateToSourceFactor ( double  f)
inline

Sets the multiplicative conversion factor used to convert the intermediate currency to the source currency.

template<class T>
void RWTriangularExchange< T >::setIntermediateToTargetFactor ( double  f)
inline

Sets the multiplicative conversion factor used to convert the intermediate currency to the target currency.

Member Data Documentation

template<class T>
const char* RWTriangularExchange< T >::exchangeMethodName
static

This data member is the name returned by the name() function.

Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.