-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCurrencyCollection.cpp
50 lines (42 loc) · 964 Bytes
/
CurrencyCollection.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "stdafx.h"
#include "CurrencyCollection.h"
#include "Tradeables.h"
using namespace std;
CCurrencyCollection::CCurrencyCollection(void)
{
}
CCurrencyCollection::~CCurrencyCollection(void)
{
}
bool CCurrencyCollection::Initialise()
{
// Make sure the collection class is empty
m_mapCurrencies.clear();
// Build up the map with the items keyed on name
for (int i=0;i<CURRENCY_PAIRS;i++)
{
CurrencyPairDetails cpd = Tradeables[i];
m_mapCurrencies[cpd.Ticker] = cpd;
}
return true;
}
bool CCurrencyCollection::GetCurrency(const std::string &Currency, CurrencyPairDetails &cpd)
{
auto it = m_mapCurrencies.find(Currency);
if (it != m_mapCurrencies.end())
{
cpd = it->second;
return true;
}
return false;
}
bool CCurrencyCollection::GetCurrencyID(const string &Currency, int &CurrencyID)
{
auto it = m_mapCurrencies.find(Currency);
if (it != m_mapCurrencies.end())
{
CurrencyID = it->second.ID;
return true;
}
return false;
}