SObjectizer is a small framework for simplification of development of concurrent and event-driven applications in C++ by using ideas from actor- and publish-subscribe models. SObjectizer is an OpenSource project which in distributed under 3-clauses BSD license.
This release adds a possibility to implement an agent as hierarchical state machine. Version 5.5.15 supports such features for agent's states as composite states, shallow- and deep-history, on_enter/on_exit handlers, time limits, transfer_to_state (a kind of deferring of events) and suppression of events.
Just a short example of new features: an agent which implements blinking of LED indicator. This agent receives turn_on_off signal for turning blinking on and off. When blinking is turned on then agent switches LED indicator on for 1.5s then switches it off for 0.75s then switches on again and so on until the agent receives next turn_on_off signal.
A code for such agent can look like:
class blinking_led final : public so_5::agent_t
{
state_t off{ this },
blinking{ this },
blink_on{ initial_substate_of{ blinking } },
blink_off{ substate_of{ blinking } };
public :
struct turn_on_off : public so_5::signal_t {};
blinking_led( context_t ctx ) : so_5::agent_t{ ctx }
{
this >>= off;
off.just_switch_to< turn_on_off >( blinking );
blinking.just_switch_to< turn_on_off >( off );
blink_on
.on_enter( []{ /* some device-specific code */ } )
.on_exit( []{ /* some device-specific code */ } )
.time_limit( std::chrono::milliseconds{1500}, blink_off );
blink_off
.time_limit( std::chrono::milliseconds{750}, blink_on );
}
};
For more details please look to the corresponding Wiki section:
https://sourceforge.net/p/sobjectizer/wiki/so-5.5%20In-depth%20-%20Agent%20States/
There is also updated version of second part of "Deep Dive into SObjectizer-5.5" presentation which gives an overview of agent's states in SObjectizer:
http://www.slideshare.net/YauheniAkhotnikau/dive-into-sobjectizer-55-second-part-states
The v.5.5.15 can be obtained from the corresponding Files section:
http://sourceforge.net/projects/sobjectizer/files/sobjectizer/SObjectizer%20Core%20v.5.5/
or can be checked out from Subversion repository:
http://svn.code.sf.net/p/sobjectizer/repo/tags/so_5/5.5.15
or from mirror on GitHub:
https://github.com/masterspline/SObjectizer/releases/tag/v5.5.15