rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWTriangularExchange< T > Class Template Reference
[Currency Conversions]

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 >

List of all members.

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
virtual RWCString name () const
RWCString intermediate () const
double intermediateToSourceFactor () const
double intermediateToTargetFactor () const
void setIntermediate (const RWCString &i)
void setIntermediateToSourceFactor (double f)
void setIntermediateToTargetFactor (double f)
RWTriangularExchange< T > & operator= (const RWTriangularExchange< T > &t)

Static Public Attributes

static const char * exchangeMethodName

Detailed Description

template<class T>
class RWTriangularExchange< T >

RWTriangularExchange<T> derives from the abstract base class RWExchangeImpl<T> 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<T> 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<T> and RWDivisionExchange<T> 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 [inline, virtual]

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

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© 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.