hce-node application
1.4.3
HCE Hierarchical Cluster Engine node application
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
CalculatorNodeExecution.hpp
Go to the documentation of this file.
1
14
#ifndef CALCULATOR_NODE_EXECUTION_HPP
15
#define CALCULATOR_NODE_EXECUTION_HPP
16
17
#include <Poco/SharedPtr.h>
18
19
#include "
DRCECommonList.hpp
"
20
#include "
Dictionary.hpp
"
21
#include "
ResourceUsageManager.hpp
"
22
23
namespace
HCE
24
{
25
namespace
handlers
26
{
27
//-----------------------------------------------------------------------------
28
class
CalculatorAlgorithmData
:
public
Dictionary
<std::string, double>
29
{
30
static
const
char
DELIMITER =
','
;
31
public
:
32
explicit
CalculatorAlgorithmData
(
unsigned
int
order_=0);
33
CalculatorAlgorithmData
(
const
CalculatorAlgorithmData
& rhs);
34
CalculatorAlgorithmData
(
CalculatorAlgorithmData
&& rhs);
35
~CalculatorAlgorithmData
(
void
) {}
36
37
CalculatorAlgorithmData
&
operator=
(
const
CalculatorAlgorithmData
& rhs);
38
CalculatorAlgorithmData
&
operator=
(
CalculatorAlgorithmData
&& rhs);
39
40
void
setOrder
(
unsigned
int
order_) {order=order_;}
41
unsigned
int
getOrder
(
void
)
const
{
return
order;}
42
private
:
43
unsigned
int
order;
44
45
typedef
Dictionary <std::string, double>
inherited;
46
};
47
//-----------------------------------------------------------------------------
48
//-----------------------------------------------------------------------------
49
class
CalculatorNodeResourceData
:
public
Dictionary
<std::string, double>
50
{
51
public
:
52
explicit
CalculatorNodeResourceData
(
const
std::string& identity_=
""
);
53
CalculatorNodeResourceData
(
const
CalculatorNodeResourceData
& rhs);
54
CalculatorNodeResourceData
(
CalculatorNodeResourceData
&& rhs);
55
~CalculatorNodeResourceData
(
void
) {}
56
57
CalculatorNodeResourceData
&
operator=
(
const
CalculatorNodeResourceData
& rhs);
58
CalculatorNodeResourceData
&
operator=
(
CalculatorNodeResourceData
&& rhs);
59
60
void
setIdentity
(
const
std::string& identity_) {identity=identity_;}
61
std::string
getIdentity
(
void
)
const
{
return
identity;}
62
private
:
63
std::string identity;
64
65
typedef
Dictionary <std::string, double>
inherited;
66
};
67
//-----------------------------------------------------------------------------
68
typedef
HCE::drce::DRCECommonList <CalculatorNodeResourceData>
NodeResourceDataList
;
69
//-----------------------------------------------------------------------------
70
//-----------------------------------------------------------------------------
71
class
CalculatorAlgorithm
72
{
73
public
:
74
enum class
Types
75
{
76
caDefault=0
77
};
78
79
CalculatorAlgorithm
(
void
) {}
80
virtual
~CalculatorAlgorithm
(
void
) {}
81
82
virtual
std::string
calculate
(
const
CalculatorAlgorithmData
& algorithmData,
NodeResourceDataList
& nodeDataList,
ResourceUsageManager
& resourceUsageManager) = 0;
83
virtual
std::vector<double>
getListWeights
(
const
CalculatorAlgorithmData
& algorithmData,
ResourceUsageCollection
& collection)=0;
84
};
85
//-----------------------------------------------------------------------------
86
//-----------------------------------------------------------------------------
87
class
CalculatorAlgorithmDefault
:
public
CalculatorAlgorithm
88
{
89
public
:
90
CalculatorAlgorithmDefault
(
void
);
91
virtual
~CalculatorAlgorithmDefault
(
void
) {}
92
93
std::string
calculate
(
const
CalculatorAlgorithmData
& algorithmData,
NodeResourceDataList
& nodeDataList,
ResourceUsageManager
& resourceUsageManager);
94
std::vector<double>
getListWeights
(
const
CalculatorAlgorithmData
& algorithmData,
ResourceUsageCollection
& collectionr);
95
private
:
96
typedef
CalculatorAlgorithm
inherited;
97
};
98
//-----------------------------------------------------------------------------
99
//-----------------------------------------------------------------------------
100
//-----------------------------------------------------------------------------
101
class
CalculatorNodeExecution
102
{
103
public
:
104
explicit
CalculatorNodeExecution
(
CalculatorAlgorithm::Types
type
=CalculatorAlgorithm::Types::caDefault);
105
virtual
~CalculatorNodeExecution
(
void
) {}
106
107
std::string
calculate
(
const
CalculatorAlgorithmData
& algorithmData,
NodeResourceDataList
& nodeDataList,
ResourceUsageManager
& resourceUsageManager);
108
std::vector<double>
getListWeights
(
const
CalculatorAlgorithmData
& algorithmData,
ResourceUsageCollection
& collection);
109
110
private
:
111
Poco::SharedPtr<CalculatorAlgorithm> createAlgorithm(
CalculatorAlgorithm::Types
type
);
112
private
:
113
Poco::SharedPtr<CalculatorAlgorithm> algorithm;
114
};
115
//-----------------------------------------------------------------------------
116
//-----------------------------------------------------------------------------
117
}
// end namespace handlers
118
}
// end namespace HCE
119
120
#endif // CALCULATOR_NODE_EXECUTION_HPP
sources
src
CalculatorNodeExecution.hpp
Generated on Tue Jun 30 2015 19:42:08 for hce-node application by
1.8.1.2