|
@@ -8,7 +8,6 @@ struct area_business_factory
|
|
|
{
|
|
|
area_business_factory()
|
|
|
{
|
|
|
-
|
|
|
}
|
|
|
|
|
|
void regist(int type,std::shared_ptr<area_business> ab)
|
|
@@ -45,6 +44,30 @@ struct area_business_factory
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+/*
|
|
|
+ 确定需要推送人员
|
|
|
+ 人员推送哪个区域,存储在card_localtion_base上,每次调用前清空,该类只将优先级最高的区域设定给该值即可
|
|
|
+*/
|
|
|
+
|
|
|
+struct area_business_post_area:area_business
|
|
|
+{
|
|
|
+ virtual int area_business_type()
|
|
|
+ {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ //记录所在区域
|
|
|
+ virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>*ptr)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据超速检测的策略,进行超速判断,超速时进行告警
|
|
|
+ //建议使用最近M秒内N秒超时进行判断,M=20,N=15,策略数据记录在area_hove中
|
|
|
+ virtual void on_hover(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+};
|
|
|
/*
|
|
|
判断车辆超速,确定超速后记录日志、数据库并告警
|
|
|
每张卡在每个区域的超速相关的数据信息记录在 area_hover 对象
|
|
@@ -53,103 +76,176 @@ struct area_business_factory
|
|
|
|
|
|
struct area_business_speed_checker:area_business
|
|
|
{
|
|
|
+ virtual int area_business_type()
|
|
|
+ {
|
|
|
+ return 4;
|
|
|
+
|
|
|
+ }
|
|
|
//在area_hover对象中初始化超速检测所需的对象
|
|
|
- virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c)
|
|
|
+ virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>*ptr)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
//根据超速检测的策略,进行超速判断,超速时进行告警
|
|
|
//建议使用最近M秒内N秒超时进行判断,M=20,N=15,策略数据记录在area_hove中
|
|
|
- virtual void on_hover(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c)
|
|
|
+ virtual void on_hover(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
//清除超速检测所需的对象
|
|
|
- virtual void on_leave(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c)
|
|
|
+ virtual void on_leave(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
{
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+
|
|
|
/*
|
|
|
- 判断当前区域a中的人数是否超过设定人数,超过后告警
|
|
|
- 区域内实时人数存储在area对象中,在当前类on_enter/on_leave中进行更新
|
|
|
+ 禁区
|
|
|
*/
|
|
|
-struct area_business_person_count_checker:area_business
|
|
|
+struct area_business_restricted:area_business
|
|
|
{
|
|
|
- //增加计数,并进行判断
|
|
|
- virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c)
|
|
|
+ virtual int area_business_type()
|
|
|
+ {
|
|
|
+
|
|
|
+ return 7;
|
|
|
+ }
|
|
|
+ //记录进入时间等信息
|
|
|
+ virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>*ptr)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
- //减少计数
|
|
|
- virtual void on_leave(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c)
|
|
|
+ //卡在猴车区域移动
|
|
|
+ virtual void on_hover(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ virtual void on_leave(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
+ {
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
-//同人员计数
|
|
|
-struct area_business_car_count_checker:area_business
|
|
|
+/*
|
|
|
+ 猴车区域
|
|
|
+*/
|
|
|
+struct area_business_monkey_area:area_business
|
|
|
{
|
|
|
- virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c)
|
|
|
+ virtual int area_business_type()
|
|
|
+ {
|
|
|
+
|
|
|
+ return 8;
|
|
|
+ }
|
|
|
+ //记录进入时间等信息,开始考勤
|
|
|
+ virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>*ptr)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
- virtual void on_hover(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c)
|
|
|
+ //记录离开考勤区域信息,结束考勤
|
|
|
+ virtual void on_leave(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
{
|
|
|
-
|
|
|
}
|
|
|
+};
|
|
|
|
|
|
- virtual void on_leave(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c)
|
|
|
+/*
|
|
|
+ 车辆考勤
|
|
|
+*/
|
|
|
+
|
|
|
+struct area_business_car_attendance:area_business
|
|
|
+{
|
|
|
+ virtual int area_business_type()
|
|
|
{
|
|
|
+ return 6;
|
|
|
|
|
|
}
|
|
|
+ //记录进入时间等信息,开始考勤
|
|
|
+ virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>*ptr)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //记录离开考勤区域信息,结束考勤
|
|
|
+ virtual void on_leave(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
+ {
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
/*
|
|
|
- 判断当前区域a中的人卡停留时间
|
|
|
- 人员进入区域时间存储在area_hover对象中,在当前类on_enter/on_leave中进行更新
|
|
|
- 人员&车辆的代码重用,请自行设计
|
|
|
+ 人员考勤
|
|
|
*/
|
|
|
|
|
|
-struct area_business_person_dwell_checker:area_business
|
|
|
+struct area_business_person_attendance:area_business
|
|
|
{
|
|
|
- //初始化 area_hover 的相关数据项
|
|
|
- virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c)
|
|
|
+ virtual int area_business_type()
|
|
|
{
|
|
|
+ return 5;
|
|
|
|
|
|
}
|
|
|
-
|
|
|
- //更新 area_hover 的相关数据项,并进行超时判断
|
|
|
- virtual void on_hover(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c)
|
|
|
+ //记录进入时间等信息,开始考勤
|
|
|
+ virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>*ptr)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ //记录离开考勤区域信息,结束考勤
|
|
|
+ virtual void on_leave(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
+ {
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
+/*
|
|
|
+ 判断当前区域a中的人数是否超过设定人数,超过后告警
|
|
|
+ 区域内实时人数存储在area对象中,在当前类on_enter/on_leave中进行更新
|
|
|
+*/
|
|
|
+struct area_business_count_checker:area_business
|
|
|
+{
|
|
|
+ virtual int area_business_type()
|
|
|
+ {
|
|
|
+ return 3;
|
|
|
+
|
|
|
+ }
|
|
|
+ //增加计数,并进行判断
|
|
|
+ virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>*ptr)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //减少计数
|
|
|
+ virtual void on_leave(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+};
|
|
|
|
|
|
/*
|
|
|
- 判断逻辑同人员超时
|
|
|
+ 判断当前区域a中的人卡停留时间
|
|
|
+ 人员进入区域时间存储在area_hover对象中,在当前类on_enter/on_leave中进行更新
|
|
|
+ 人员&车辆的代码重用,请自行设计
|
|
|
*/
|
|
|
-struct area_business_car_dwell_checker:area_business
|
|
|
+
|
|
|
+struct area_business_person_dwell_checker:area_business
|
|
|
{
|
|
|
+ virtual int area_business_type()
|
|
|
+ {
|
|
|
+ return 2;
|
|
|
+ }
|
|
|
//初始化 area_hover 的相关数据项
|
|
|
- virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c)
|
|
|
+ virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>*ptr)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
//更新 area_hover 的相关数据项,并进行超时判断
|
|
|
- virtual void on_hover(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c)
|
|
|
+ virtual void on_hover(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>*ptr)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+
|
|
|
std::vector<std::shared_ptr<area_business>> area_business::get_instance_list(int business_type)
|
|
|
{
|
|
|
return area_business_factory::instance().get_check_list(business_type);
|