Browse Source

增加两个函数get_event_area get_event_reader

daiyueteng 6 years ago
parent
commit
ee349c6bc2
1 changed files with 12 additions and 2 deletions
  1. 12 2
      event.h

+ 12 - 2
event.h

@@ -160,6 +160,16 @@ public:
 
     std::shared_ptr<ya_event> get_event_card(uint32_t card_id, int card_type, EVENT_TYPE ev_type);
 
+    std::shared_ptr<ya_event> get_event_area(int32_t area_id, EVENT_TYPE ev_type)
+    {
+        return base::get(to_list_id(ev_type, OT_AREA, static_cast<uint64_t>(area_id)));
+    }
+
+    std::shared_ptr<ya_event> get_event_reader(int32_t reader_id, EVENT_TYPE ev_type)
+    {
+        return base::get(to_list_id(ev_type,OT_DEVICE_READER, static_cast<uint64_t>(reader_id)));
+    }
+
     void load_his_data_from_db();
 
     ~event_list(){}
@@ -174,8 +184,8 @@ public:
     static std::string evs_to_json(std::vector<std::shared_ptr<ya_event>> arr);
 private:
     static void _ev_to_node(std::shared_ptr<ya_event> ev_ptr,
-                           rapidjson::Document::AllocatorType& allocator,
-                           rapidjson::Value& out_data);
+                            rapidjson::Document::AllocatorType& allocator,
+                            rapidjson::Value& out_data);
 
 };
 #endif