hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
DRCEResultDataSerializator.hpp
Go to the documentation of this file.
1 
14 #ifndef DRCE_RESULT_DATA_SERIALIZATOR_HPP
15 #define DRCE_RESULT_DATA_SERIALIZATOR_HPP
16 
17 #include <Poco/JSON/Object.h>
18 #include <Poco/JSON/Array.h>
19 
20 #include "DRCEJsonMessageConst.hpp"
21 #include "JsonSerializable.hpp"
22 #include "DRCEResultData.hpp"
23 
24 namespace HCE
25 {
26 namespace drce
27 {
28 //-----------------------------------------------------------------------------
30 {
31 public:
32  explicit DRCEResultDataSerializator(DRCEResultData& resultData);
34 
35  bool serialize(std::string& json);
36  bool unserialize(const std::string& json);
37 
38 private:
39  void packToObject(Poco::JSON::Object& obj, DRCEResultDataItem& resultDataItem) throw (Poco::Exception);
40  void packToArray(Poco::JSON::Array& arr, DRCEResultDataItem& resultDataItem) throw (Poco::Exception);
41  void unpackFromObject(Poco::JSON::Object& obj, DRCEResultDataItem& resultDataItem) throw (Poco::Exception);
42  void unpackFromArray(Poco::JSON::Array& arr, DRCEResultDataItem& resultDataItem) throw (Poco::Exception);
43 private:
44  DRCEResultData& resultData;
45 
46  typedef IJsonSerializable inherited;
47 };
48 //-----------------------------------------------------------------------------
49 //-----------------------------------------------------------------------------
50 } // namespace drce
51 } // namespace HCE
52 
53 #endif // DRCE_RESULT_DATA_SERIALIZATOR_HPP