-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommandsDealer.h
More file actions
41 lines (33 loc) · 1.07 KB
/
commandsDealer.h
File metadata and controls
41 lines (33 loc) · 1.07 KB
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
#ifndef COMMANDSDEALER_H
#define COMMANDSDEALER_H
#include <map>
#include <iostream>
#include "algorithmInterface.h"
#include "algorithmContainer.h"
class commandsDealer
{
public:
commandsDealer() {
algorithms = new algorithmContainer();
}
~commandsDealer() {
delete algorithms;
}
// Return algorithm of choise or the default algorithm
algorithmInterface* getAlgorithm(std::string algorithID) {
std::map<std::string, algorithmInterface*>::const_iterator iter;
iter = algorithms->container.find( algorithID );
if( iter != algorithms->container.end() )
return iter->second;
else{
std::cout << "Warning: Algorithm identifier " << algorithID << " is invalid!" << std::endl;
iter = algorithms->container.find( commandsDealer::defaultAlgorithmID );
return iter->second;
}
}
private:
algorithmContainer* algorithms;
static const std::string defaultAlgorithmID;
};
const std::string commandsDealer::defaultAlgorithmID = "DEC";
#endif // COMMANDSDEALER_H