SourcePro® API Reference Guide

 
List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | Related Functions
RWEuroGroup< T > Class Template Reference

A collection of all currencies replaced by the Euro, in which each object implements the RWTriangularExchange conversion type. More...

#include <rw/currency/euroexchggrp.h>

Inheritance diagram for RWEuroGroup< T >:
RWExchangeGroupImpl< T >

Public Member Functions

 RWEuroGroup (const char *euro_mnemonic="EUR")
 
 RWEuroGroup (const RWEuroGroup< T > &)
 
 RWEuroGroup (const RWTValSlist< RWCString > &euroCurrencies, const char *euroMnemonic="EUR")
 
bool addCurrency (const RWCString &)
 
void clear ()
 
virtual RWExchangeGroupImpl< T > * clone () const
 
bool containsCurrency (const RWCString &) const
 
RWCString euroMnemonic () const
 
RWTValSlist< RWCStringgetCurrencies () const
 
virtual RWExchange< T > getExchange (const RWCString &srcMnemonic, const RWCString &tragetMnemonic, const RWExchangeRateTable &rates) const
 
virtual RWCString name () const
 
size_t numCurrencies () const
 
RWEuroGroup< T > & operator= (const RWEuroGroup< T > &)
 
bool removeCurrency (const RWCString &)
 
void setCurrencies (const RWTValSlist< RWCString > &list)
 
void setEuroMnemonic (const RWCString &em)
 
- Public Member Functions inherited from RWExchangeGroupImpl< T >
 RWExchangeGroupImpl ()
 

Static Public Member Functions

static RWExchangeGroup< T > create ()
 
static RWExchangeGroup< T > create (std::istream &strm, const char *euroMnem="EUR")
 
static RWExchangeGroup< T > create (const RWTValSlist< RWCString > &currencyList, const char *euroMnem="EUR")
 

Static Public Attributes

static const char * groupName
 

Related Functions

(Note that these are not member functions.)

template<class T >
std::ostream & operator<< (std::ostream &strm, const RWEuroGroup< T > &grp)
 
template<class T >
std::istream & operator>> (std::istream &strm, RWEuroGroup< T > &grp)
 

Detailed Description

template<class T>
class RWEuroGroup< T >

Currency exchange groups are collections of currencies that have a common distinguishing characteristic when it comes to converting money from one currency to money of another currency. RWEuroGroup is a currency exchange group class that consists of all currencies replaced by the Euro. RWEuroGroup objects create and return RWExchange objects with the RWTriangularExchange implementation.

Note
The Euro itself is not in the Euro exchange group because the triangular exchange algorithm is not used when converting to or from Euros.
Synopsis
#include <rw/currency/euroexchggrp.h>
#include <rw/tvslist.h>
RWTValSlist<RWCString> euroCurrencies;
RWEuroGroup<double> euroGroup(euroCurrencies);

Constructor & Destructor Documentation

template<class T>
RWEuroGroup< T >::RWEuroGroup ( const char *  euro_mnemonic = "EUR")
inline

Default constructor. Constructs an empty group. The default value of euro_mnemonic identifies the Euro currency and is used to look up rates in the exchange rate table, information in the currency book, and so forth.

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

Copy constructor.

template<class T>
RWEuroGroup< T >::RWEuroGroup ( const RWTValSlist< RWCString > &  euroCurrencies,
const char *  euroMnemonic = "EUR" 
)

Constructs a Euro exchange group containing the currencies whose mnemonics are contained in euroCurrencies. The default value of euroMnemonic identifies the Euro currency and is used to look up rates in the exchange rate table, information in the currency book, and so forth.

Member Function Documentation

template<class T>
bool RWEuroGroup< T >::addCurrency ( const RWCString )

Adds the currency mnemonic to the Euro exchange group. Returns false if the currency was already in the group and true otherwise.

template<class T>
void RWEuroGroup< T >::clear ( )

Removes all Euro currencies from the group.

template<class T>
virtual RWExchangeGroupImpl<T>* RWEuroGroup< T >::clone ( ) const
inlinevirtual

Returns a copy of self allocated off the heap.

Implements RWExchangeGroupImpl< T >.

template<class T>
bool RWEuroGroup< T >::containsCurrency ( const RWCString ) const

Returns true if the given currency is in the Euro exchange group. Note that the Euro is not in the Euro exchange group since you do not use the triangulation algorithm when converting from or to Euros.

template<class T>
static RWExchangeGroup<T> RWEuroGroup< T >::create ( )
static

Creates and returns an RWExchangeGroup object with a RWEuroGroup implementation. The list of Euro currencies contained in the implementation is empty.

template<class T>
static RWExchangeGroup<T> RWEuroGroup< T >::create ( std::istream &  strm,
const char *  euroMnem = "EUR" 
)
static

Creates and returns an RWExchangeGroup object with a RWEuroGroup implementation. This implementation uses strm to define the currencies in the Euro group. The stream format must have one currency mnemonic per line, as in the following example:

ATS
BEF
FIM
FRF
DEM
IEP
ITL
LUF
NLG
ESP
PTE
template<class T>
static RWExchangeGroup<T> RWEuroGroup< T >::create ( const RWTValSlist< RWCString > &  currencyList,
const char *  euroMnem = "EUR" 
)
static

Creates and returns an RWExchangeGroup object with an RWEuroGroup implementation. This implementation uses the currencies in currencyList to define the currencies in the Euro group.

template<class T>
RWCString RWEuroGroup< T >::euroMnemonic ( ) const
inline

Returns the RWCString for the Euro currency mnemonic.

template<class T>
RWTValSlist<RWCString> RWEuroGroup< T >::getCurrencies ( ) const

Returns a list of currency mnemonics that are in the Euro group.

template<class T>
virtual RWExchange<T> RWEuroGroup< T >::getExchange ( const RWCString srcMnemonic,
const RWCString tragetMnemonic,
const RWExchangeRateTable rates 
) const
virtual

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 invalid, the Rogue Wave classes that derive from this class return an invalid exchange object.

Implements RWExchangeGroupImpl< T >.

template<class T>
virtual RWCString RWEuroGroup< T >::name ( ) const
inlinevirtual

Returns a name to be associated with the group.

Implements RWExchangeGroupImpl< T >.

template<class T>
size_t RWEuroGroup< T >::numCurrencies ( ) const

Returns the number of currencies in the Euro group.

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

Assignment operator.

template<class T>
bool RWEuroGroup< T >::removeCurrency ( const RWCString )

Removes the given currency from the Euro group. Returns false if the currency was not found in the group, and true otherwise.

template<class T>
void RWEuroGroup< T >::setCurrencies ( const RWTValSlist< RWCString > &  list)

Replaces the list of Euro currencies with list.

template<class T>
void RWEuroGroup< T >::setEuroMnemonic ( const RWCString em)
inline

Sets the Euro currency mnemonic for this object.

Friends And Related Function Documentation

template<class T >
std::ostream & operator<< ( std::ostream &  strm,
const RWEuroGroup< T > &  grp 
)
related

Writes grp to a stream. The stream has the format described in the RWEuroGroup::create(std::istream&, const char*) method.

template<class T >
std::istream & operator>> ( std::istream &  strm,
RWEuroGroup< T > &  grp 
)
related

Reads grp from a stream. The stream has the format described in the RWEuroGroup::create(std::istream&, const char*) method.

Member Data Documentation

template<class T>
const char* RWEuroGroup< T >::groupName
static

Name that identifies the Euro exchange group. Returned by the name() method.

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