-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalgorithmContainer.h
More file actions
30 lines (25 loc) · 886 Bytes
/
algorithmContainer.h
File metadata and controls
30 lines (25 loc) · 886 Bytes
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
#ifndef ALGORITHMCONTAINER_H
#define ALGORITHMCONTAINER_H
#include "algorithmConvertBin.h"
#include "algorithmConvertDec.h"
#include "algorithmConvertOct.h"
#include "algorithmConvertHex.h"
// Container class handling algorithm instances
class algorithmContainer
{
public:
std::map<std::string, algorithmInterface*> container;
algorithmContainer(){
container.insert( std::make_pair( "DEC", new dec_converter ) );
container.insert( std::make_pair( "BIN", new bin_converter ) );
container.insert( std::make_pair( "OCT", new oct_converter ) );
container.insert( std::make_pair( "HEX", new hex_converter ) );
}
~algorithmContainer() {
while( container.begin() != container.end() ) {
delete container.begin()->second;
container.erase( container.begin() );
}
}
};
#endif // ALGORITHMCONTAINER_H