hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
DRCEStatVariablesConverter.cpp
Go to the documentation of this file.
3 
4 namespace HCE
5 {
6 namespace drce
7 {
8 //-----------------------------------------------------------------------------
10 : statVariables()
11 {
12 }
13 //-----------------------------------------------------------------------------
15 : statVariables(rhs)
16 {
17 }
18 //-----------------------------------------------------------------------------
20 : statVariables()
21 {
22  fromDictionary(rhs);
23 }
24 //-----------------------------------------------------------------------------
25 template <typename T> void StatVariablesConverter::toDictionary(const std::string& key, const StatVariableData<T>& data, Dictionary& dic)
26 {
30 }
31 //-----------------------------------------------------------------------------
32 template <typename T> void StatVariablesConverter::fromDictionary(const std::string& key, StatVariableData<T>& data, const Dictionary& dic)
33 {
34  Dictionary dictionary(dic);
36  if (tmp.isNumeric())
37  data.min = tmp.convert<T>();
38 
40  if (tmp.isNumeric())
41  data.avg = tmp.convert<T>();
42 
44  if (tmp.isNumeric())
45  data.max = tmp.convert<T>();
46 }
47 //-----------------------------------------------------------------------------
48 void StatVariablesConverter::toDictionary(const std::string& key, const size_t& value, Dictionary& dic)
49 {
50  dic[key] = value;
51 }
52 //-----------------------------------------------------------------------------
53 void StatVariablesConverter::fromDictionary(const std::string& key, size_t& value, const Dictionary& dic)
54 {
55  Dictionary dictionary(dic);
56  Poco::Dynamic::Var tmp = dictionary[key];
57  if (tmp.isInteger())
58  value = tmp.convert<size_t>();
59 }
60 //-----------------------------------------------------------------------------
62 {
63  Dictionary dictionary;
78 
79  return dictionary;
80 }
81 //-----------------------------------------------------------------------------
83 {
84  statVariables = rhs;
85 }
86 //-----------------------------------------------------------------------------
88 {
103 }
104 //-----------------------------------------------------------------------------
105 //-----------------------------------------------------------------------------
106 } // end namespace drce
107 } // end namespace HCE