Design Patterns
strategy_context.h
Go to the documentation of this file.
1 // Based on "Design Patterns: Elements of Reusable Object-Oriented Software"
2 // book by Erich Gamma, John Vlissides, Ralph Johnson, and Richard Helm
3 //
4 // Created by Bartosz Rachwal. The National Institute of Advanced Industrial Science and Technology, Japan.
5 
6 #ifndef OPERATIONAL_STRATEGY_CONTEXT_H_
7 #define OPERATIONAL_STRATEGY_CONTEXT_H_
8 
9 namespace operational
10 {
11 namespace strategy
12 {
13 template<class AStrategy>
15 {
16  public:
17  void Operation()
18  {
19  result_ = strategy_.DoAlgorithm();
20  }
21 
22  std::string result() const;
23 
24  private:
25  std::string result_;
26  AStrategy strategy_;
27 };
28 
29 template<class AStrategy>
31 {
32  return result_;
33 }
34 }
35 }
36 
37 #endif
38 
Definition: application.cc:10
void Operation()
Definition: strategy_context.h:17
Definition: strategy_context.h:14
std::string result() const
Definition: strategy_context.h:30