SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
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 (const RWTValSlist< RWCString > &currencyList, const char *euroMnem="EUR")
 
static RWExchangeGroup< T > create (std::istream &strm, const char *euroMnem="EUR")
 

Static Public Attributes

static const char * groupName
 

Related Symbols

(Note that these are not member symbols.)

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);
A collection of all currencies replaced by the Euro, in which each object implements the RWTriangular...
Definition euroexchggrp.h:57
Maintains a collection of values implemented as a singly-linked list.
Definition tvslist.h:111

Constructor & Destructor Documentation

◆ RWEuroGroup() [1/3]

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.

◆ RWEuroGroup() [2/3]

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

Copy constructor.

◆ RWEuroGroup() [3/3]

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

◆ addCurrency()

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.

◆ clear()

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

Removes all Euro currencies from the group.

◆ clone()

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

Returns a copy of self allocated off the heap.

Implements RWExchangeGroupImpl< T >.

◆ containsCurrency()

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.

◆ create() [1/3]

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.

◆ create() [2/3]

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.

◆ create() [3/3]

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

◆ euroMnemonic()

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

Returns the RWCString for the Euro currency mnemonic.

◆ getCurrencies()

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

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

◆ getExchange()

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 >.

◆ name()

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

Returns a name to be associated with the group.

Implements RWExchangeGroupImpl< T >.

◆ numCurrencies()

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

Returns the number of currencies in the Euro group.

◆ operator=()

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

Assignment operator.

◆ removeCurrency()

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.

◆ setCurrencies()

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

Replaces the list of Euro currencies with list.

◆ setEuroMnemonic()

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

Sets the Euro currency mnemonic for this object.

Friends And Related Symbol Documentation

◆ operator<<()

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.

◆ operator>>()

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

◆ groupName

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

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

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