SourcePro® API Reference Guide

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

Implements a standard form of currency conversion. More...

#include <rw/currency/biexchange.h>

Inheritance diagram for RWBilateralExchange< T >:
RWExchangeImpl< T > RWDivisionExchange< T > RWMultiplicationExchange< T >

Public Member Functions

 RWBilateralExchange ()
 
 RWBilateralExchange (const RWBilateralExchange< T > &)
 
 RWBilateralExchange (const RWCString &source, const RWCString &target, double f)
 
 RWBilateralExchange (const RWExchangeRate &rate)
 
double conversionFactor () const
 
RWExchangeRate exchangeRate () const
 
RWBilateralExchange< T > & operator= (const RWBilateralExchange< T > &)
 
void setConversionFactor (double f)
 
void setExchangeRate (const RWExchangeRate &rate)
 
- Public Member Functions inherited from RWExchangeImpl< T >
virtual RWExchangeImpl< T > * clone () const =0
 
virtual RWMoney< T > exchange (const RWMoney< T > &money) const =0
 
virtual RWCString name () const =0
 
void setSource (const RWCString &src)
 
void setTarget (const RWCString &trg)
 
RWCString source () const
 
RWCString target () const
 

Detailed Description

template<class T>
class RWBilateralExchange< T >

RWBilateralExchange is an abstract base class derived from the base class RWExchangeImpl, and is a parent of both the RWMultiplicationExchange and RWDivisionExchange classes. RWBilateralExchange implements the usual method of currency conversion: multiplying or dividing the amount of a source currency by a conversion factor to obtain the equivalent amount in the target currency.

Synopsis
#include <rw/currency/currexchange.h>
#include <rw/currency/divexchange.h>
#include <rw/currency/multexchange.h>

Constructor & Destructor Documentation

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

Default constructor. The source and target mnemonic strings are set to null, and the conversion factor is set to zero.

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

Copy constructor.

template<class T >
RWBilateralExchange< T >::RWBilateralExchange ( const RWCString source,
const RWCString target,
double  f 
)

Constructs a bilateral exchange object with source currency mnemonic given by source, target currency mnemonic given by target, and source to target conversion factor given by f.

template<class T >
RWBilateralExchange< T >::RWBilateralExchange ( const RWExchangeRate rate)

Constructs a bilateral exchange object with source currency, target currency and conversion factor provided by the RWExchangeRate object rate.

Member Function Documentation

template<class T >
double RWBilateralExchange< T >::conversionFactor ( ) const
inline

Returns the conversion factor.

template<class T >
RWExchangeRate RWBilateralExchange< T >::exchangeRate ( ) const

Returns the source currency, target currency and conversion factor in an RWExchangeRate object.

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

Assignment operator.

template<class T >
void RWBilateralExchange< T >::setConversionFactor ( double  f)
inline

Sets the conversion factor.

template<class T >
void RWBilateralExchange< T >::setExchangeRate ( const RWExchangeRate rate)

Sets the source currency, target currency and conversion factor to those contained in rate.

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