diff options
| author | Rutger Broekhoff | 2026-12-01 16:03:28 +0100 |
|---|---|---|
| committer | Rutger Broekhoff | 2026-12-01 16:03:28 +0100 |
| commit | a2b46df66ce12ac31392cbfe80b1f983a9350278 (patch) | |
| tree | 76805a95b221ecf8afed3075f09290f98789238a /server/src/api.cppm | |
| parent | 9b8d8fccaec087031ba37dd68e516929c3ddb4a2 (diff) | |
| download | routemon-a2b46df66ce12ac31392cbfe80b1f983a9350278.tar.gz routemon-a2b46df66ce12ac31392cbfe80b1f983a9350278.zip | |
Reloading
Diffstat (limited to 'server/src/api.cppm')
| -rw-r--r-- | server/src/api.cppm | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/server/src/api.cppm b/server/src/api.cppm index a0ab878..31263e3 100644 --- a/server/src/api.cppm +++ b/server/src/api.cppm | |||
| @@ -73,26 +73,48 @@ auto tag_invoke( | |||
| 73 | boost::json::value_from_tag, boost::json::value& jv, sysinfo const& info) | 73 | boost::json::value_from_tag, boost::json::value& jv, sysinfo const& info) |
| 74 | -> void; | 74 | -> void; |
| 75 | 75 | ||
| 76 | class handler | 76 | class indexed_pub |
| 77 | { | 77 | { |
| 78 | public: | ||
| 79 | using blse_index_value_t = std::shared_ptr<datex2::road_closure>; | ||
| 80 | using blse_index_t = | ||
| 81 | geo::utm::multizonal::linestring_rtree<blse_index_value_t>; | ||
| 82 | using bpe_index_value_t = std::shared_ptr<datex2::road_closure>; | ||
| 83 | using bpe_index_t = geo::utm::multizonal::point_rtree<bpe_index_value_t>; | ||
| 84 | |||
| 85 | private: | ||
| 78 | constexpr static auto const min_distance_ = 5.0; | 86 | constexpr static auto const min_distance_ = 5.0; |
| 79 | 87 | ||
| 80 | using blse_index_value = std::shared_ptr<datex2::road_closure>; | 88 | datex2::situation_publication pub_; |
| 81 | using blse_index = geo::utm::multizonal::linestring_rtree<blse_index_value>; | 89 | blse_index_t blse_index_; |
| 82 | using bpe_index_value = std::shared_ptr<datex2::road_closure>; | 90 | bpe_index_t bpe_index_; |
| 83 | using bpe_index = geo::utm::multizonal::point_rtree<bpe_index_value>; | 91 | |
| 92 | public: | ||
| 93 | explicit indexed_pub(log::logger const& l, datex2::situation_publication pub); | ||
| 94 | |||
| 95 | inline auto pub() const -> datex2::situation_publication const& | ||
| 96 | { | ||
| 97 | return pub_; | ||
| 98 | } | ||
| 84 | 99 | ||
| 100 | inline auto blse_index() const -> blse_index_t const& { return blse_index_; } | ||
| 101 | |||
| 102 | inline auto bpe_index() const -> bpe_index_t const& { return bpe_index_; } | ||
| 103 | }; | ||
| 104 | |||
| 105 | class handler | ||
| 106 | { | ||
| 85 | log::logger l_; | 107 | log::logger l_; |
| 86 | std::shared_ptr<database::connection> dbc_; | 108 | std::shared_ptr<database::connection> dbc_; |
| 87 | datex2::situation_publication pub_; | 109 | std::atomic<std::shared_ptr<indexed_pub>> ipub_; |
| 88 | blse_index blse_index_; | ||
| 89 | bpe_index bpe_index_; | ||
| 90 | 110 | ||
| 91 | public: | 111 | public: |
| 92 | explicit handler( | 112 | explicit handler( |
| 93 | log::logger const& l, std::shared_ptr<database::connection> dbc, | 113 | log::logger const& l, std::shared_ptr<database::connection> dbc, |
| 94 | datex2::situation_publication pub); | 114 | datex2::situation_publication pub); |
| 95 | 115 | ||
| 116 | auto situation_publication(datex2::situation_publication pub) -> void; | ||
| 117 | |||
| 96 | auto process_gpx( | 118 | auto process_gpx( |
| 97 | trace::id trace_id, gpx::file&& gpx_file, | 119 | trace::id trace_id, gpx::file&& gpx_file, |
| 98 | time::period_seq<std::chrono::minutes> const& check_periods) | 120 | time::period_seq<std::chrono::minutes> const& check_periods) |