All examples for sml::process_queue and sml::defer_queue are based on std::queue.
While this approach is fine for desktop c++, some use cases exist where dynamic allocations are not allowed / desired.
Some examples are:
embedded systems (no dynamic memory allocations available)
real-time systems with pre-allocated objects
As boost::sml is a library that targets embedded systems, it should allow the use of pre-allocated queues.
Solution:
I enabled the use of pre-allocated queues by making queue_event default constructible.
This allows storing instances of queue_event in a container that pre-allocates all elements upon construction (e.g.
std::array).
I added additional tests in actions_process.cpp, actions_defer.cpp and actions_process_n_defer.cpp that
use std::array based queues and deques.
Problem:
All examples for
sml::process_queue
andsml::defer_queue
are based onstd::queue
. While this approach is fine for desktop c++, some use cases exist where dynamic allocations are not allowed / desired.Some examples are:
As boost::sml is a library that targets embedded systems, it should allow the use of pre-allocated queues.
Solution:
I enabled the use of pre-allocated queues by making
queue_event
default constructible. This allows storing instances ofqueue_event
in a container that pre-allocates all elements upon construction (e.g.std::array
).I added additional tests in
actions_process.cpp
,actions_defer.cpp
andactions_process_n_defer.cpp
that usestd::array
based queues and deques.