7#ifndef MAKI_STATE_SET_HPP
8#define MAKI_STATE_SET_HPP
10#include "detail/state_builder_fwd.hpp"
11#include "detail/impl.hpp"
12#include "detail/set.hpp"
27 constexpr auto make_state_set_from_impl(
const Impl& impl)
29 return state_set<Impl>{impl};
37 constexpr state_set(
const state_set& other) =
default;
38 constexpr state_set(state_set&& other) =
default;
40 ~state_set() =
default;
42 constexpr state_set& operator=(
const state_set& other) =
default;
43 constexpr state_set& operator=(state_set&& other) =
default;
46 using impl_type = Impl;
49 friend constexpr auto detail::make_state_set_from_impl(
const Impl2&);
51 explicit constexpr state_set(
const Impl& impl):
56 MAKI_DETAIL_FRIENDLY_IMPL
59#ifdef MAKI_DETAIL_DOXYGEN
66inline constexpr auto all_states = detail::make_state_set_from_impl
68 detail::make_set_including_all()
72#ifdef MAKI_DETAIL_DOXYGEN
77inline constexpr auto no_state = IMPLEMENTATION_DETAIL;
79inline constexpr auto no_state = detail::make_state_set_from_impl
81 detail::make_set_excluding_all()
91constexpr auto operator!(
const state_set<Impl>& stt_set)
93 return detail::make_state_set_from_impl
95 detail::inverse_set(detail::impl_of(stt_set))
104template<
class StateBuilderImpl>
107 return detail::make_state_set_from_impl
109 detail::make_set_excluding(&stt_builder)
118template<
class LhsImpl,
class RhsImpl>
119constexpr auto operator||
121 const state_set<LhsImpl>& lhs,
122 const state_set<RhsImpl>& rhs
125 return detail::make_state_set_from_impl
127 detail::make_set_union(detail::impl_of(lhs), detail::impl_of(rhs))
136template<
class StateSetImpl,
class StateBuilderImpl>
137constexpr auto operator||
139 const state_set<StateSetImpl>& stt_set,
143 return detail::make_state_set_from_impl
145 detail::make_set_union(detail::impl_of(stt_set), &stt_builder)
154template<
class StateBuilderImpl,
class StateSetImpl>
155constexpr auto operator||
158 const state_set<StateSetImpl>& stt_set
161 return stt_set || stt_builder;
169template<
class LhsStateBuilderImpl,
class RhsStateBuilderImpl>
170constexpr auto operator||
176 return detail::make_state_set_from_impl
178 detail::make_set_including(&lhs, &rhs)
187template<
class LhsImpl,
class RhsImpl>
188constexpr auto operator&&
190 const state_set<LhsImpl>& lhs,
191 const state_set<RhsImpl>& rhs
194 return detail::make_state_set_from_impl
196 detail::make_set_intersection(detail::impl_of(lhs) && detail::impl_of(rhs))
202 template<
class StateBuilderImpl,
class StateBuilderImpl2>
205 return equals(&lhs, rhs);
208 template<
class StateBuilderImpl,
class... Predicates>
209 constexpr bool contained_in(
const state_builder<StateBuilderImpl>& stt_builder,
const state_set<Predicates>&... state_sets)
211 return (contains(impl_of(state_sets), &stt_builder) || ...);
217 static constexpr auto value =
false;
220 template<
class Predicate>
221 struct is_state_set<state_set<Predicate>>
223 static constexpr auto value =
true;
227 constexpr auto is_state_set_v = is_state_set<T>::value;
State builder.
Definition state_builder.hpp:42
Represents a state set.
Definition state_set.hpp:35
constexpr auto no_state
An empty maki::state_set.
Definition state_set.hpp:77
constexpr auto operator!(const state_builder< StateBuilderImpl > &stt_builder)
Creates a maki::state_set that contains all the states but the ones created by stt_builder.
Definition state_set.hpp:105
constexpr auto all_states
An infinite maki::state_set that contains all the states.
Definition state_set.hpp:64
constexpr auto operator!(const state_set< Impl > &stt_set)
Creates a maki::state_set that contains all the states that are not contained in stt_set.
Definition state_set.hpp:91