Design Patterns
Main Page
Namespaces
Classes
Files
File List
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>
14
class
StrategyContext
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>
30
std::string
StrategyContext<AStrategy>::result
()
const
31
{
32
return
result_;
33
}
34
}
35
}
36
37
#endif
38
operational
Definition:
application.cc:10
operational::strategy::StrategyContext::Operation
void Operation()
Definition:
strategy_context.h:17
operational::strategy::StrategyContext
Definition:
strategy_context.h:14
operational::strategy::StrategyContext::result
std::string result() const
Definition:
strategy_context.h:30
src
operational
src
strategy
strategy_context.h
Generated by
1.8.10