SourcePro® API Reference Guide

 
List of all members | Public Member Functions
RWExchangeGroup< T > Class Template Reference

The handle for the implementation class RWExchangeGroupImpl, 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>

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
 
RWExchangeGroupImpl< T > * impl () const
 
RWCString name () const
 
RWExchangeGroup< T > & operator= (const RWExchangeGroup< T > &eg)
 
void setImpl (RWExchangeGroupImpl< T > *i)
 

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. This class contains a pointer to implementation class RWExchangeGroupImpl. 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:

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.

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