#pragma once /* MOUNT CONTROL COMPONENTS LIBRARY */ /* PROHIBITED ZONE IMPLEMENTATION */ #include #include #include "mcc_mount_coord.h" #include "mcc_traits.h" namespace mcc { class MccProhibitedZone { public: // floating-point time duration (seconds) typedef std::chrono::duration pz_duration_t; struct pz_request_t { bool in_zone{false}; // true if given coordinates are within the zone pz_duration_t time_to{0.0}; // a time duration to reach the zone pz_duration_t time_from{0.0}; // a time duration to exit the zone }; struct pz_context_t { }; MccProhibitedZone(std::string_view name) : _name(name) {} std::string_view name() const { return _name; } // check if given position (x,y) in the zone template XT, std::derived_from YT> bool inZone(const XT& x, const YT& y, const pz_context_t& context, traits::mcc_systime_c auto const& utc = std::chrono::system_clock::now()) { static constexpr size_t coord_kind = traits::mcc_type_pair_hash(); return false; } // returns a time duration to reach the zone // 0 - if already within // Inf - if it never reaches the zone template XT, std::derived_from YT> pz_duration_t timeTo(const XT& x, const YT& y, const pz_context_t& context, traits::mcc_systime_c auto const& utc = std::chrono::system_clock::now()) { static constexpr size_t coord_kind = traits::mcc_type_pair_hash(); } // returns a time duration to exit from the zone // 0 - if given position (x,y) is out of the zone // Inf - if (x,y) is always within the zone template XT, std::derived_from YT> pz_duration_t timeFrom(const XT& x, const YT& y, const pz_context_t& context, traits::mcc_systime_c auto const& utc = std::chrono::system_clock::now()) { static constexpr size_t coord_kind = traits::mcc_type_pair_hash(); } template XT, std::derived_from YT> pz_request_t request(const XT& x, const YT& y, const pz_context_t& context, traits::mcc_systime_c auto const& utc = std::chrono::system_clock::now()) { pz_request_t res{.in_zone = false, .time_to = pz_duration_t{0.0}, .time_from{0.0}}; res.in_zone = inZone(x, y, context, utc); if (res.in_zone) { res.time_from = timeFrom(x, y, context, utc); } else { res.time_to = timeFrom(x, y, context, utc); } return res; } protected: std::string_view _name; }; } // namespace mcc