15#include "detail/signature_macros.hpp"
16#include "detail/call.hpp"
69 return call_callable<guard_signature, Guard::signature>
84template<guard_signature Sig,
class Callable>
91#define MAKI_DETAIL_X(name) \
97 template<class Callable> \
98 constexpr guard<guard_signature::name, Callable> guard_##name(const Callable& callable) \
102MAKI_DETAIL_GUARD_SIGNATURES
115constexpr auto operator&&
123 [lhs, rhs](
const auto& ctx,
const auto& mach,
const auto& event)
126 detail::call_guard(lhs, ctx, mach, event) &&
127 detail::call_guard(rhs, ctx, mach, event)
143constexpr auto operator||
151 [lhs, rhs](
const auto& ctx,
const auto& mach,
const auto& event)
154 detail::call_guard(lhs, ctx, mach, event) ||
155 detail::call_guard(rhs, ctx, mach, event)
171constexpr auto operator!=
179 [lhs, rhs](
const auto& ctx,
const auto& mach,
const auto& event)
182 detail::call_guard(lhs, ctx, mach, event) !=
183 detail::call_guard(rhs, ctx, mach, event)
193template<guard_signature Signature,
class Callable>
198 [grd](
const auto& ctx,
const auto& mach,
const auto& event)
200 return !detail::call_guard(grd, ctx, mach, event);
207 inline constexpr auto null_guard =
guard_v([]{
return true;});
209 template<guard_signature Sig,
class Callable>
210 constexpr const auto& to_guard(
const guard<Sig, Callable>& grd)
215 constexpr const auto& to_guard(
null_t )
223 static constexpr auto value =
false;
226 template<guard_signature Sig,
class Callable>
227 struct is_guard<guard<Sig, Callable>>
229 static constexpr auto value =
true;
233 constexpr bool is_guard_v = is_guard<T>::value;
constexpr auto operator!(const event_set< Predicate > &evt_set)
Creates a maki::event_set that contains all the event types that are not contained in evt_set.
Definition event_set.hpp:117
IMPLEMENTATION_DETAIL null_t
The type of maki::null
Definition null.hpp:26
guard_signature
The set of arguments taken by a guard callable.
Definition guard.hpp:26
@ c
void action(context&)
Definition action.hpp:31
@ m
void action(machine&)
Definition action.hpp:43
@ cm
void action(context&, machine&)
Definition action.hpp:34
@ cme
void action(context&, machine&, const event&)
Definition action.hpp:37
@ ce
void action(context&, const event&)
Definition action.hpp:40
@ v
void action()
Definition action.hpp:28
@ me
void action(machine&, const event&)
Definition action.hpp:46
@ e
void action(const event&)
Definition action.hpp:49
Represents a guard to be given to maki::transition_table. Use the builder functions (maki::guard_v() ...
Definition guard.hpp:86
constexpr guard< guard_signature::v, Callable > guard_v(const Callable &callable)
Makes a maki::guard with the indicated signature and given callable.
Definition guard.hpp:98
constexpr guard< guard_signature::cme, Callable > guard_cme(const Callable &callable)
Makes a maki::guard with the indicated signature and given callable.
Definition guard.hpp:98