SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
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& source, const RWCString& target,
const RWExchangeRateTable& rates) const;
Offers powerful and convenient facilities for manipulating strings.
Definition stdcstring.h:826
virtual RWExchange< T > getExchange(const RWCString &srcMnemonic, const RWCString &tragetMnemonic, const RWExchangeRateTable &rates) const =0
Stores exchange rates as unique pairs of source and target currencies.
Definition exchgratetbl.h:110
Handle class for the abstract body class RWExchangeImpl from which all concrete currency converters d...
Definition currexchange.h:69

Currency Module includes three currency exchange group implementation classes:

Synopsis
#include <rw/currency/exchggroup.h>

Constructor & Destructor Documentation

◆ RWExchangeGroup() [1/3]

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

Default constructor.

◆ RWExchangeGroup() [2/3]

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

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

◆ RWExchangeGroup() [3/3]

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

◆ getExchange()

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.

◆ impl()

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

Returns a pointer to the implementation class.

◆ name()

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

Returns a name to be associated with the group.

◆ operator=()

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.

◆ setImpl()

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

Sets self to the RWExchangeGroupImpl object pointed to by i.

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