Skip to content

Commit 406c15d

Browse files
committed
refactor(backmp11): event pool container config
1 parent 98ceca9 commit 406c15d

6 files changed

Lines changed: 15 additions & 14 deletions

File tree

doc/modules/ROOT/pages/tutorial/backmp11-back-end.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ struct default_state_machine_config
7070
using compile_policy = favor_runtime_speed;
7171
// Which container to use for the event pool.
7272
template <typename T>
73-
using event_container = std::deque<T>;
73+
using event_pool_container = std::deque<T>;
7474
// Type of the Fsm parameter passed in actions and guards.
7575
using fsm_parameter = local_transition_owner;
7676
// Identifier for the upper-most SM
@@ -169,7 +169,7 @@ The state machine utilizes an event pool for events that are not processed immed
169169
- `erase(iterator)`
170170
- `clear()`
171171

172-
You can deactivate the event pool with `using event_container = no_event_container;`. A state machine requires the event pool to handle completion events, deferred events, and enqueued events.
172+
You can deactivate the event pool with `using event_pool_container = no_event_pool_container<T>;`. A state machine requires the event pool to handle completion events, deferred events, and enqueued events.
173173

174174

175175
=== Compile policy

include/boost/msm/backmp11/detail/state_machine_base.hpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,18 +199,19 @@ class state_machine_base : public FrontEnd
199199
protected:
200200
using processable_event = basic_polymorphic<event_occurrence>;
201201
template <typename T>
202-
using event_container = typename config_t::template event_container<T>;
203-
using event_container_t = event_container<processable_event>;
202+
using event_pool_container =
203+
typename config_t::template event_pool_container<T>;
204+
using event_pool_container_t = event_pool_container<processable_event>;
204205

205206
struct event_pool_t
206207
{
207-
event_container_t events;
208+
event_pool_container_t events;
208209
uint16_t cur_seq_cnt{};
209210
};
210211

211212
using event_pool_member = optional_instance<
212213
event_pool_t,
213-
!std::is_same_v<event_container<void>, no_event_container<void>>>;
214+
!std::is_same_v<event_pool_container<void>, no_event_pool_container<void>>>;
214215

215216
template <bool C = event_pool_member::value,
216217
typename = std::enable_if_t<C>>

include/boost/msm/backmp11/detail/transition_table.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -448,10 +448,10 @@ struct transition_table_impl
448448
using completion_transition_table =
449449
mp11::mp_copy_if<transition_table, has_completion_event>;
450450
static_assert(
451-
mp11::mp_empty<completion_transition_table>::value ||
452-
!std::is_same_v<
453-
typename StateMachine::template event_container<void>,
454-
no_event_container<void>>,
451+
mp11::mp_empty<completion_transition_table>::value ||
452+
!std::is_same_v<
453+
typename StateMachine::template event_pool_container<void>,
454+
no_event_pool_container<void>>,
455455
"Completion transitions require an event pool");
456456
template <typename State, typename Table = completion_transition_table>
457457
struct completion_transitions_impl

include/boost/msm/backmp11/state_machine_config.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct local_transition_owner{};
4949

5050
// Config for disabling the event pool.
5151
template <typename T>
52-
struct no_event_container;
52+
struct no_event_pool_container;
5353

5454
using transition_owner [[deprecated("Use local_transition_owner instead")]] =
5555
local_transition_owner;
@@ -65,7 +65,7 @@ struct default_state_machine_config
6565
using compile_policy = favor_runtime_speed;
6666
// Which container to use for the event pool.
6767
template <typename T>
68-
using event_container = std::deque<T>;
68+
using event_pool_container = std::deque<T>;
6969
// Type of the Fsm parameter passed in actions and guards.
7070
using fsm_parameter = local_transition_owner;
7171
// Identifier for the upper-most SM

test/Backmp11.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class StateMachine
2828
{
2929
using base = state_machine<FrontEnd, Config, StateMachine<FrontEnd, Config>>;
3030
public:
31-
const typename base::event_container_t& get_pending_events() const
31+
const typename base::event_pool_container_t& get_pending_events() const
3232
{
3333
return this->get_event_pool().events;
3434
}

test/Backmp11Transitions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ struct default_config : state_machine_config
8181
{
8282
// using root_sm = StateMachine;
8383
template <typename T>
84-
using event_container = no_event_container<T>;
84+
using event_pool_container = no_event_pool_container<T>;
8585
};
8686
struct favor_compile_time_config : default_config
8787
{

0 commit comments

Comments
 (0)