ant.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #ifndef _ANT_LIST_HPP_
  2. #define _ANT_LIST_HPP_
  3. #include <math.h>
  4. #include <array>
  5. #include <deque>
  6. #include <tuple>
  7. #include <memory>
  8. #include <algorithm>
  9. #include "line.h"
  10. #include "point.h"
  11. struct path
  12. {
  13. line_v m_line;
  14. double m_slope=0;
  15. };
  16. struct algo_config
  17. {
  18. const char*desc;
  19. int min_msg_cnt;
  20. int best_msg_cnt;
  21. int min_wait_time;
  22. int max_wait_time;
  23. };
  24. struct ant
  25. {
  26. static algo_config g_config[];
  27. int m_site_id;
  28. int m_algo; //TOF:0,TDOA:1
  29. int m_num_dims; //1维:0,2维:1,3维:2
  30. point m_position;
  31. std::vector<path> m_path;
  32. int index()const;
  33. const algo_config&config()const;
  34. };
  35. struct ant_list
  36. {
  37. std::vector<ant*> m_ant_list;
  38. ant*get(uint32_t site_id,uint32_t ant_id)
  39. {
  40. return 0;
  41. }
  42. void load_from_db()
  43. {
  44. }
  45. static ant_list*instance();
  46. };
  47. struct client;
  48. struct site
  49. {
  50. std::vector<ant*> m_ant_list;
  51. std::shared_ptr<client> m_socket;
  52. };
  53. struct site_list
  54. {
  55. std::vector<site*> m_site_list;
  56. site*get(uint32_t site_id)
  57. {
  58. return 0;
  59. }
  60. void load_from_db()
  61. {
  62. }
  63. static site_list*instance();
  64. };
  65. struct loc_message
  66. {
  67. ant* m_ant;
  68. uint64_t m_num_ticks; //tof时间片或tdoa相对root时间
  69. loc_message();
  70. loc_message(ant*a,uint64_t num_ticks)
  71. :m_ant(a)
  72. ,m_num_ticks(num_ticks)
  73. {}
  74. int tool_index()const;
  75. };
  76. #endif