-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSplitAxisStrategyFactory.hpp
More file actions
43 lines (32 loc) · 1.06 KB
/
SplitAxisStrategyFactory.hpp
File metadata and controls
43 lines (32 loc) · 1.06 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
/*SplitAxisStrategyFactory.hpp
*
* Created on: Jan 22, 2017
* Author: benross
*/
#ifndef INCLUDE_SPLITAXISSTRATEGYFACTORY_HPP_
#define INCLUDE_SPLITAXISSTRATEGYFACTORY_HPP_
#include "SplitAxisStrategy.hpp"
#include "SplitAxisRoundRobinStrategy.hpp"
#include "SplitAxisRangeStrategy.hpp"
#include <unordered_map>
#include <string>
#include <map>
namespace rossb83 {
/*
* class to create strategy to split axis based on input string decision
*/
template <typename T>
class SplitAxisStrategyFactory {
public:
static std::shared_ptr<SplitAxisStrategy<T>> createSplitAxisStrategy(const std::string& strategy) {
if (strategy == "cycle") {
return std::make_shared<SplitAxisRoundRobinStrategy<T>>();
} else if (strategy == "range") {
return std::make_shared<SplitAxisRangeStrategy<T>>();
} else {
return std::make_shared<SplitAxisRoundRobinStrategy<T>>();
}
}
}; // class SplitAxisStrategyFactory
} // namespace rossb83
#endif /* INCLUDE_SPLITAXISSTRATEGYFACTORY_HPP_ */