#include <iostream>
{
public:
{
.
event( [](mhood_t<msg_hello>) {
std::cout << "hello from the default mbox" << std::endl;
} )
.event( [this](mhood_t<msg_bye>) {
} );
.
event( [](mhood_t<msg_hello>) {
std::cout << "hello from a new direct mbox" << std::endl;
} );
}
};
int main()
{
try
{
{
} );
}
catch( const std::exception & ex )
{
std::cerr << "Error: " << ex.what() << std::endl;
return 1;
}
return 0;
}
A helper header file for including all public SObjectizer stuff.
subscription_bind_t so_subscribe_self()
Initiate subscription to agent's direct mbox.
agent_t(environment_t &env)
Constructor.
mbox_t so_make_new_direct_mbox()
Create a new direct mbox for that agent.
void so_deregister_agent_coop_normally()
A helper method for deregistering agent's coop in case of normal deregistration.
subscription_bind_t so_subscribe(const mbox_t &mbox_ref)
Initiate subscription.
virtual void so_evt_start()
Hook on agent start inside SObjectizer.
coop_handle_t register_agent_as_coop(std::unique_ptr< A > agent)
Register single agent as a cooperation.
std::unique_ptr< Agent > make_agent(Args &&... args)
Helper method for simplification of agents creation.
A base class for agent signals.
std::enable_if< details::is_agent_method_pointer< details::method_arity::unary, Method_Pointer >::value, subscription_bind_t & >::type event(Method_Pointer pfn, thread_safety_t thread_safety=not_thread_safe)
Make subscription to the message.
void launch(Init_Routine &&init_routine)
Launch a SObjectizer Environment with default parameters.
void send(Target &&to, Args &&... args)
A utility function for creating and delivering a message or a signal.