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
DRCEAvgCountsConverter.cpp
Go to the documentation of this file.
1
#include "
DRCEAvgCountsConverter.hpp
"
2
#include "
DRCEJsonMessageConst.hpp
"
3
4
namespace
HCE
5
{
6
namespace
drce
7
{
8
//-----------------------------------------------------------------------------
9
AvgCountsConverter::AvgCountsConverter
(
void
)
10
: avgCounts()
11
{
12
}
13
//-----------------------------------------------------------------------------
14
AvgCountsConverter::AvgCountsConverter
(
const
AvgCounts
& rhs)
15
: avgCounts(rhs)
16
{
17
}
18
//-----------------------------------------------------------------------------
19
AvgCountsConverter::AvgCountsConverter
(
const
Dictionary
& rhs)
20
: avgCounts()
21
{
22
fromDictionary
(rhs);
23
}
24
//-----------------------------------------------------------------------------
25
void
AvgCountsConverter::toDictionary
(
const
std::string&
key
,
const
size_t
& value, Dictionary& dic)
26
{
27
dic[
key
] = value;
28
}
29
//-----------------------------------------------------------------------------
30
void
AvgCountsConverter::fromDictionary
(
const
std::string&
key
,
size_t
& value,
const
Dictionary& dic)
31
{
32
Dictionary
dictionary(dic);
33
Poco::Dynamic::Var tmp = dictionary[
key
];
34
if
(tmp.isInteger())
35
value = tmp.convert<
size_t
>();
36
}
37
//-----------------------------------------------------------------------------
38
AvgCountsConverter::Dictionary
AvgCountsConverter::toDictionary
(
void
)
39
{
40
Dictionary
dictionary;
41
toDictionary
(
HCE::drce::drce_json_message_const::TIME_ASYNC_TASK_COUNT
, avgCounts.
timeAsyncTaskCount
, dictionary);
42
toDictionary
(
HCE::drce::drce_json_message_const::TIME_SYNC_TASK_COUNT
, avgCounts.
timeSyncTaskCount
, dictionary);
43
toDictionary
(
HCE::drce::drce_json_message_const::SIZE_INPUT_BUFFER_SYNC_TASKS_COUNT
, avgCounts.
sizeInputBufferSyncTasksCount
, dictionary);
44
toDictionary
(
HCE::drce::drce_json_message_const::SIZE_OUTPUT_BUFFER_SYNC_TASKS_COUNT
, avgCounts.
sizeOutputBufferSyncTasksCount
, dictionary);
45
toDictionary
(
HCE::drce::drce_json_message_const::SIZE_INPUT_BUFFER_ASYNC_TASKS_COUNT
, avgCounts.
sizeInputBufferAsyncTasksCount
, dictionary);
46
toDictionary
(
HCE::drce::drce_json_message_const::SIZE_OUTPUT_BUFFER_ASYNC_TASKS_COUNT
, avgCounts.
sizeOutputBufferAsyncTasksCount
, dictionary);
47
toDictionary
(
HCE::drce::drce_json_message_const::CPU_USAGE_ASYNC_TASKS_COUNT
, avgCounts.
cpuUsageAsyncTasksCount
, dictionary);
48
toDictionary
(
HCE::drce::drce_json_message_const::MEMORY_USAGE_ASYNC_TASKS_COUNT
, avgCounts.
memoryUsageAsyncTasksCount
, dictionary);
49
toDictionary
(
HCE::drce::drce_json_message_const::COUNT_SYNC_TASKS_FOR_MINUTE_COUNT
, avgCounts.
countSyncTasksForMinuteCount
, dictionary);
50
toDictionary
(
HCE::drce::drce_json_message_const::COUNT_ASYNC_TASKS_FOR_MINUTE_COUNT
, avgCounts.
countAsyncTasksForMinuteCount
, dictionary);
51
return
dictionary;
52
}
53
//-----------------------------------------------------------------------------
54
void
AvgCountsConverter::fromObject
(
const
AvgCounts
& rhs)
55
{
56
avgCounts = rhs;
57
}
58
//-----------------------------------------------------------------------------
59
void
AvgCountsConverter::fromDictionary
(
const
Dictionary
& rhs)
60
{
61
fromDictionary
(
HCE::drce::drce_json_message_const::TIME_ASYNC_TASK_COUNT
, avgCounts.
timeAsyncTaskCount
, rhs);
62
fromDictionary
(
HCE::drce::drce_json_message_const::TIME_SYNC_TASK_COUNT
, avgCounts.
timeSyncTaskCount
, rhs);
63
fromDictionary
(
HCE::drce::drce_json_message_const::SIZE_INPUT_BUFFER_SYNC_TASKS_COUNT
, avgCounts.
sizeInputBufferSyncTasksCount
, rhs);
64
fromDictionary
(
HCE::drce::drce_json_message_const::SIZE_OUTPUT_BUFFER_SYNC_TASKS_COUNT
, avgCounts.
sizeOutputBufferSyncTasksCount
, rhs);
65
fromDictionary
(
HCE::drce::drce_json_message_const::SIZE_INPUT_BUFFER_ASYNC_TASKS_COUNT
, avgCounts.
sizeInputBufferAsyncTasksCount
, rhs);
66
fromDictionary
(
HCE::drce::drce_json_message_const::SIZE_OUTPUT_BUFFER_ASYNC_TASKS_COUNT
, avgCounts.
sizeOutputBufferAsyncTasksCount
, rhs);
67
fromDictionary
(
HCE::drce::drce_json_message_const::CPU_USAGE_ASYNC_TASKS_COUNT
, avgCounts.
cpuUsageAsyncTasksCount
, rhs);
68
fromDictionary
(
HCE::drce::drce_json_message_const::MEMORY_USAGE_ASYNC_TASKS_COUNT
, avgCounts.
memoryUsageAsyncTasksCount
, rhs);
69
fromDictionary
(
HCE::drce::drce_json_message_const::COUNT_SYNC_TASKS_FOR_MINUTE_COUNT
, avgCounts.
countSyncTasksForMinuteCount
, rhs);
70
fromDictionary
(
HCE::drce::drce_json_message_const::COUNT_ASYNC_TASKS_FOR_MINUTE_COUNT
, avgCounts.
countAsyncTasksForMinuteCount
, rhs);
71
}
72
//-----------------------------------------------------------------------------
73
//-----------------------------------------------------------------------------
74
}
// end namespace drce
75
}
// end namespace HCE
sources
utils
DRCE
src
DRCEAvgCountsConverter.cpp
Generated on Tue Jun 30 2015 19:42:11 for hce-node application by
1.8.1.2