-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSplitPointStrategyFactory.hpp
More file actions
43 lines (32 loc) · 1.07 KB
/
SplitPointStrategyFactory.hpp
File metadata and controls
43 lines (32 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
42
43
/*SplitPointStrategyFactory.hpp
*
* Created on: Jan 22, 2017
* Author: benross
*/
#ifndef INCLUDE_SPLITPOINTSTRATEGYFACTORY_HPP_
#define INCLUDE_SPLITPOINTSTRATEGYFACTORY_HPP_
#include "SplitPointStrategy.hpp"
#include "SplitPointSortStrategy.hpp"
#include "SplitPointSelectStrategy.hpp"
#include <unordered_map>
#include <string>
#include <map>
namespace rossb83 {
/*
* class to create strategy to split point at median based on input string decision
*/
template <typename T>
class SplitPointStrategyFactory {
public:
static std::shared_ptr<SplitPointStrategy<T>> createSplitPointStrategy(const std::string& strategy) {
if (strategy == "sort") {
return std::make_shared<SplitPointSortStrategy<T>>();
} else if (strategy == "select") {
return std::make_shared<SplitPointSelectStrategy<T>>();
} else {
return std::make_shared<SplitPointSortStrategy<T>>();
}
}
}; // class SplitPointStrategyFactory
} // namespace rossb83
#endif /* INCLUDE_SPLITPOINTSTRATEGYFACTORY_HPP_ */