components concepts - beta version stage
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <concepts>
|
||||
|
||||
#include "mcc_mount_coord.h"
|
||||
#include "mcc_traits.h"
|
||||
|
||||
|
||||
@@ -213,6 +214,48 @@ concept mcc_mount_telemetry_c = requires(T t, const T t_const) {
|
||||
|
||||
|
||||
|
||||
/* MOUNT PROHIBITED ZONE */
|
||||
template <typename T>
|
||||
concept mcc_prohibited_zone_c = std::movable<T> && requires(T t, const T t_const) {
|
||||
typename T::coord_t;
|
||||
typename T::time_point_t;
|
||||
|
||||
// the type 'T' must define static constexpr member of type MccCoordPairKind
|
||||
// to declarate type of coordinate pair used to describe the zone.
|
||||
// This coordinate pair must be used as input in the class methods.
|
||||
requires requires {
|
||||
requires std::same_as<decltype(T::zoneCoordPairKind), const MccCoordPairKind>;
|
||||
[]() {
|
||||
constexpr MccCoordPairKind val = T::zoneCoordPairKind;
|
||||
}(); // to ensure that 'zoneCoordPairKind' can be used at compile-time context
|
||||
};
|
||||
|
||||
// return a name of the zone
|
||||
{ t_const.name() } -> mcc_formattable;
|
||||
|
||||
|
||||
// check if given coordinates are in the zone at given time point
|
||||
{
|
||||
t.inZone(std::declval<typename T::coord_t>(), std::declval<typename T::coord_t>(),
|
||||
std::declval<typename T::time_point_t>())
|
||||
} -> std::convertible_to<bool>;
|
||||
|
||||
|
||||
// for given coordinates and time the method computes a time to reach the zone
|
||||
{
|
||||
t.timeTo(std::declval<typename T::coord_t>(), std::declval<typename T::coord_t>(),
|
||||
std::declval<typename T::time_point_t>())
|
||||
} -> mcc_time_duration_c;
|
||||
|
||||
|
||||
// for given coordinates and time the method computes a time to exit from the zone
|
||||
{
|
||||
t.timeFrom(std::declval<typename T::coord_t>(), std::declval<typename T::coord_t>(),
|
||||
std::declval<typename T::time_point_t>())
|
||||
} -> mcc_time_duration_c;
|
||||
};
|
||||
|
||||
|
||||
/* MOUNT GENERIC CONFIGURATION */
|
||||
|
||||
template <typename T>
|
||||
@@ -221,4 +264,7 @@ concept mcc_mount_config_c = requires(T t) {
|
||||
{ t.pec() } -> mcc_mount_pec_c;
|
||||
{ t.hardware() } -> mcc_mount_hardware_c;
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace mcc::traits
|
||||
|
||||
Reference in New Issue
Block a user