MonitorObject.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #pragma once
  2. #include <string>
  3. #include <map>
  4. #include <list>
  5. #include <vector>
  6. class CMonitorObject
  7. {
  8. public:
  9. CMonitorObject();
  10. virtual ~CMonitorObject();
  11. public:
  12. std::string id;
  13. std::string name;
  14. std::string type;
  15. std::string up;
  16. std::list<CMonitorObject*> m_lstMo;
  17. //如果type为mo.mp的, 可能存在报警参数
  18. //报警参数
  19. };
  20. class CMonitorObjectMng
  21. {
  22. CMonitorObjectMng();
  23. virtual ~CMonitorObjectMng();
  24. public:
  25. static CMonitorObjectMng* Instance() { return &obj; };
  26. BOOL LoadMonitorTree();
  27. BOOL LoadHistoryData();
  28. //获取战场站点名
  29. bool GetStationNameByMomP(const std::string& momp, std::string& station, std::string& momp_name);
  30. bool GetStationNameByMomP(const std::string& mo, const std::string& mp, std::string& station, std::string& momp_name);
  31. //获取测力曲线名称
  32. bool GetNameByMoMp(const std::string& momp, std::string& name1, std::string& name2, std::string& name3);
  33. bool GetNameByMoMp(const std::string& momp, std::string& name1, std::string& name2, std::string& name3, std::string& out_name, std::string& in_name);
  34. //设置测力曲线名称
  35. void SetNameByMoMp(const std::string& momp, std::string& name1, std::string& name2, std::string& name3);
  36. //获取转换阻力方向名称
  37. bool GetDirectByMoMp(const std::string& momp, std::string& direct1, std::string& direct2);
  38. //设置转换阻力方向名称
  39. void SetDirectByMoMp(const std::string& momp, std::string& direct1, std::string& direct2);
  40. static bool spiltByPoint(std::string&src, std::string& dst1, std::string& dst2);
  41. std::string concatStringByPoint(const std::string& src1, const std::string& src2);
  42. //通过ID来获取树节点
  43. CMonitorObject* GetTreeByID(string& id);
  44. static bool ReNameMO(string id, string name);
  45. static bool AddMO(string id, string name, string type, string up);
  46. static bool AddMO2(string id, string name, string type, string up);
  47. private:
  48. static CMonitorObject* GetTreeByID(CMonitorObject* p, string& id);
  49. void GetChild(std::list<CMonitorObject*>& lst, std::list<CMonitorObject*>& child, const std::string& id);
  50. bool GetStationNameByMomP(CMonitorObject* pInfo, const std::string& momp, std::string& station, std::string& momp_name);
  51. void Clear();
  52. CMonitorObject* m_treeroot = nullptr;//整棵树
  53. std::map<std::string, std::string> m_mapImeiIdxMoMp;//设备号对应momp
  54. std::map<std::string, std::string> m_mapMoMpImeiIdx;
  55. std::map<std::string, std::vector<string>> m_mapMoMpName; //mo, mp 对应三个测力曲线的名称
  56. std::map<std::string, std::vector<string>> m_mapMoMpDirect; //mo, mp 对应的两个阻力转换方向名称
  57. private:
  58. static CMonitorObjectMng obj;
  59. };