33 lines
725 B
C++
33 lines
725 B
C++
#pragma once
|
|
|
|
/* MOUNT CONTROL COMPONENTS LIBRARY */
|
|
|
|
/* FINITE-STATE MACHINE IMPLEMENTATION */
|
|
|
|
|
|
#include <string_view>
|
|
#include "mcc_fsm_utils.h"
|
|
|
|
|
|
namespace mcc::fsm
|
|
{
|
|
|
|
|
|
namespace traits
|
|
{
|
|
|
|
template <typename T>
|
|
concept fsm_event_c = std::is_default_constructible_v<T> && std::is_move_constructible_v<T> && std::movable<T>;
|
|
|
|
template <typename T>
|
|
concept fsm_state_c =
|
|
std::is_default_constructible_v<T> && std::is_move_constructible_v<T> && std::movable<T> && requires {
|
|
[]<mcc::traits::pair_holder_c PHT>(std::type_identity<PHT>) {}(T::transition_t);
|
|
|
|
{ T::name } -> std::same_as<const std::string_view>; // static constant of state name
|
|
};
|
|
|
|
} // namespace traits
|
|
|
|
} // namespace mcc::fsm
|