rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWExchangeGroup< T > Class Template Reference
[Currency Conversions]

The handle for the implementation class RWExchangeGroupImpl<T> , the abstract base class for all currency exchange group implementations. A currency exchange group is a collection of currencies that use the same currency-conversion rules. More...

#include <rw/currency/exchggroup.h>

List of all members.

Public Member Functions

 RWExchangeGroup ()
 RWExchangeGroup (const RWExchangeGroup< T > &eg)
 RWExchangeGroup (RWExchangeGroupImpl< T > *imp)
RWExchange< T > getExchange (const RWCString &srcMnemonic, const RWCString &targetMnemonic, const RWExchangeRateTable &rates) const
RWCString name () const
RWExchangeGroupImpl< T > * impl () const
void setImpl (RWExchangeGroupImpl< T > *i)
RWExchangeGroup< T > & operator= (const RWExchangeGroup< T > &eg)

Detailed Description

template<class T>
class RWExchangeGroup< T >

A currency exchange group is a collection of currencies that have a common distinguishing characteristic related to converting money from one currency to money of another currency. For example, the Euro Currency Exchange Group consists of all the currencies that will eventually be replaced by the Euro. All currencies in the Euro Currency Exchange Group use the same, special rule for converting money between currencies in this group.

The exchange group classes are implemented using a handle/body or bridge design pattern. The handle class is RWExchangeGroup<T>. This class contains a pointer to implementation class RWExchangeGroupImpl<T>. RWExchangeGroupImpl is an abstract base class from which all currency group implementations must derive. The purpose of an exchange group object is to take as input a source currency, target currency, and an exchange rate table, then produce an exchange object. Thus a key component of the class RWExchangeGroupImpl is a pure virtual method:

 virtual  RWExchange<T>
 RWExchangeGroupImpl<T>::getExchange(const  RWCString&  source,
                                     const  RWCString&  target,
                                     const  RWExchangeRateTable&  rates)  const;

Currency Module includes three currency exchange group implementation classes:

Synopsis

 #include<rw/currency/exchggroup.h>

Constructor & Destructor Documentation

template<class T >
RWExchangeGroup< T >::RWExchangeGroup (  )  [inline]

Default constructor.

template<class T >
RWExchangeGroup< T >::RWExchangeGroup ( const RWExchangeGroup< T > &  eg  )  [inline]

Makes a (deep) copy of the implementation for currency exchange group object eg.

template<class T >
RWExchangeGroup< T >::RWExchangeGroup ( RWExchangeGroupImpl< T > *  imp  )  [inline]

Constructs an exchange group object with the provided implementation imp. The object's destructor will delete imp.


Member Function Documentation

template<class T >
RWExchange<T> RWExchangeGroup< T >::getExchange ( const RWCString srcMnemonic,
const RWCString targetMnemonic,
const RWExchangeRateTable rates 
) const [inline]

Creates and returns a currency exchange object for converting money in the source currency to money in the target currency using the exchange rates table rates. If the parameters are not valid, an invalid exchange object is returned.

template<class T >
RWExchangeGroupImpl<T>* RWExchangeGroup< T >::impl (  )  const [inline]

Returns a pointer to the implementation class.

template<class T >
RWCString RWExchangeGroup< T >::name (  )  const [inline]

Returns a name to be associated with the group.

template<class T >
RWExchangeGroup<T>& RWExchangeGroup< T >::operator= ( const RWExchangeGroup< T > &  eg  )  [inline]

Deletes self's current implementation and clones a copy of the implementation for eg.

template<class T >
void RWExchangeGroup< T >::setImpl ( RWExchangeGroupImpl< T > *  i  )  [inline]

Sets self to the RWExchangeGroupImpl object pointed to by i.

 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.