123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- /*
- * @Author: your name
- * @Date: 2021-11-18 22:53:19
- * @LastEditTime: 2021-11-19 11:39:00
- * @LastEditors: lishengyin
- * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
- * @FilePath: /MIVA/modules/dataType/include/SendPassengerFlow.h
- */
- #pragma once
- #include <iostream>
- using namespace std;
- #include <rapidjson/document.h>
- #include <rapidjson/rapidjson.h>
- #include <rapidjson/stringbuffer.h>
- #include <rapidjson/writer.h>
- #include <vector>
- class PassengerFlow
- {
- public:
- // 检测设备
- std::string deviceIp;
- // 车辆编号
- std::string carCode;
- // 车厢编号
- std::string carriageCode;
- // 拥挤度检测值
- int crNum = 0;
- // 拥挤度,1/2/3
- int crType;
- // 车厢人数
- int personNum;
- // 检测时间
- std::string detectionTime;
- // 流播放地址
- std::string detectionVideo;
- // 备注
- std::string remark;
-
- // 扩展字段
- std::string attr1;
- std::string attr2;
- std::string attr3;
-
- public:
- PassengerFlow() {}
- ~PassengerFlow() {}
-
- void objectToJson(rapidjson::Writer<rapidjson::StringBuffer>& writer)
- {
- writer.StartObject();
- writer.Key("deviceIp");
- writer.String(deviceIp.c_str());
- writer.Key("carCode");
- writer.String(carCode.c_str());
-
- writer.Key("carriageCode");
- writer.String(carriageCode.c_str());
- writer.Key("crNum");
- writer.Int(crNum);
-
- writer.Key("crType");
- writer.Int(crType);
- writer.Key("personNum");
- writer.Int(personNum);
- writer.Key("detectionTime");
- writer.String(detectionTime.c_str());
- writer.Key("detectionVideo");
- writer.String(detectionVideo.c_str());
- writer.Key("remark");
- writer.String(remark.c_str());
- writer.Key("attr1");
- writer.String(attr1.c_str());
- writer.Key("attr2");
- writer.String(attr2.c_str());
- writer.Key("attr3");
- writer.String(attr3.c_str());
- writer.EndObject();
- }
- };
- class SendPassengerFlow
- {
- public:
- vector<PassengerFlow> PassengerFlows;
- public:
- SendPassengerFlow() {}
- ~SendPassengerFlow() {}
- void objectToJson(rapidjson::Writer<rapidjson::StringBuffer>& writer)
- {
- writer.StartArray();
- for(auto& passengerFlow: PassengerFlows){
- passengerFlow.objectToJson(writer);
- }
- writer.EndArray();
- }
- };
|