hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
PocoJSONExtractor.cpp
Go to the documentation of this file.
1 #include "PocoJSONExtractor.hpp"
2 #include <Poco/JSON/Parser.h>
3 
4 namespace HCE {
5 
6 namespace reduce_convertors {
7 
8 using namespace Poco;
9 
10 PocoJSONExtractor::PocoJSONExtractor(const std::string& json)
11 {
12  JSON::Parser parser;
13  Dynamic::Var res;
14  res = parser.parse(json);
15  obj = res.extract<JSON::Object::Ptr>();
16 }
17 
19 }
20 
21 int PocoJSONExtractor::extractAsInt(const std::string & key)
22 {
23  Dynamic::Var tmp = obj->get(key);
24  return tmp.convert<int>();
25 }
26 
27 std::string PocoJSONExtractor::extractAsString(const std::string & key)
28 {
29  Dynamic::Var tmp = obj->get(key);
30  return tmp.convert<std::string>();
31 }
32 
33 }
34 }