This commit is contained in:
2025-04-16 18:12:02 +03:00
parent e80116d4ae
commit ea99bc721b
3 changed files with 25 additions and 11 deletions

View File

@@ -151,7 +151,7 @@ public:
MccMount(traits::mcc_input_char_range auto const& logger_mark = "[MOUNT]",
std::shared_ptr<spdlog::logger> logger = spdlog::null_logger_mt("NULL"))
: utils::MccSpdlogLogger(logger), _exitCurrentState([]() {})
: utils::MccSpdlogLogger(logger), _exitCurrentState([]() {}), _currentStateName([]() {})
{
std::istringstream strst;
@@ -180,9 +180,15 @@ public:
_exitCurrentState(); // exit from current state
_exitCurrentState = [&state]() { state.exit(); };
_currentStateName = [&state]() { return state.name(); };
state.enter();
}
std::string_view currenStateName() const
{
return _currentStateName();
}
MccMountPosition getMountData() const noexcept
{
@@ -271,7 +277,7 @@ public:
// returns a time to reach the prohibited area:
// 0 - already in the zone
// std::chrono::sys_time<>::max() - never reach the zone
// std::chrono::duration<>::max() - never reach the zone
// the kind of cordinates (e.g. IRCS or apparent, equatorial or horizontal) is a subject of implementation
auto pzTimeTo(const MccCoordinate& xcoord,
const MccCoordinate& ycoord,
@@ -284,7 +290,7 @@ public:
// returns a time to exit the prohibited area:
// 0 - already out of the zone
// std::chrono::sys_time<>::max() - the zone itself
// std::chrono::duration<>::max() - the zone itself
// the kind of cordinates (e.g. IRCS or apparent, equatorial or horizontal) is a subject of implementation
auto pzTimeFrom(const MccCoordinate& xcoord,
const MccCoordinate& ycoord,
@@ -296,6 +302,12 @@ public:
}
// above two methods in one call
// returns a std::tuple with elements
// 0 - boolean: true - coordinates in zone, false - otherwise
// 1 - time duration to reach the zone (0 - if already in the zone, chrono::duration<>::max() if never reach the
// zone)
// 2 - time duration to exit the zone (0 - if already out of the zone, chrono::duration<>::max() if never
// exit the zone)
auto pzCheck(const MccCoordinate& xcoord,
const MccCoordinate& ycoord,
traits::mcc_systime_c auto const& utc = std::chrono::system_clock::now())
@@ -342,6 +354,7 @@ protected:
// std::shared_ptr<spdlog::logger> _mountLogger;
std::function<void()> _exitCurrentState;
std::function<std::string_view()> _currentStateName;
// time scales related databases
astrom::MccLeapSeconds _leapSecondsDB;