+struct PolicyHandler : public BaseReaderHandler<UTF8<>, PolicyHandler> {
+ unordered_map<string, string> cell_pred;
+ std::string ue_id;
+ bool ue_id_found = false;
+ string curr_key = "";
+ string curr_value = "";
+ int policy_type_id;
+ int policy_instance_id;
+ int threshold;
+ std::string operation;
+ bool found_threshold = false;
+
+
+ bool Null() { cout << "Null()" << endl; return true; }
+ bool Bool(bool b) { cout << "Bool(" << boolalpha << b << ")" << endl; return true; }
+ bool Int(int i) {
+ cout << "Int(" << i << ")" << endl;
+ if (curr_key.compare("policy_type_id") == 0) {
+ policy_type_id = i;
+ } else if (curr_key.compare("policy_instance_id") == 0) {
+ policy_instance_id = i;
+ } else if (curr_key.compare("threshold") == 0) {
+ found_threshold = true;
+ threshold = i;
+ }
+
+ return true;
+ }
+ bool Uint(unsigned u) {
+ cout << "Int(" << u << ")" << endl;
+ if (curr_key.compare("policy_type_id") == 0) {
+ policy_type_id = u;
+ } else if (curr_key.compare("policy_instance_id") == 0) {
+ policy_instance_id = u;
+ } else if (curr_key.compare("threshold") == 0) {
+ found_threshold = true;
+ threshold = u;
+ }
+
+ return true;
+ }
+ bool Int64(int64_t i) { cout << "Int64(" << i << ")" << endl; return true; }
+ bool Uint64(uint64_t u) { cout << "Uint64(" << u << ")" << endl; return true; }
+ bool Double(double d) { cout << "Double(" << d << ")" << endl; return true; }
+ bool String(const char* str, SizeType length, bool copy) {
+ cout << "String(" << str << ", " << length << ", " << boolalpha << copy << ")" << endl;
+ if (curr_key.compare("operation") != 0) {
+ operation = str;
+ }
+
+ return true;
+ }
+ bool StartObject() {
+ cout << "StartObject()" << endl;
+ return true;
+ }
+ bool Key(const char* str, SizeType length, bool copy) {
+ cout << "Key(" << str << ", " << length << ", " << boolalpha << copy << ")" << endl;
+ curr_key = str;
+
+ return true;
+ }
+ bool EndObject(SizeType memberCount) { cout << "EndObject(" << memberCount << ")" << endl; return true; }
+ bool StartArray() { cout << "StartArray()" << endl; return true; }
+ bool EndArray(SizeType elementCount) { cout << "EndArray(" << elementCount << ")" << endl; return true; }
+
+};
+