SObjectizer  5.5
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
so_5 Namespace Reference

Public part of message limit implementation. More...

Namespaces

 anonymous_namespace{agent.cpp}
 
 anonymous_namespace{environment.cpp}
 
 anonymous_namespace{event_exception_logger.cpp}
 
 anonymous_namespace{queue_locks_defaults_manager.cpp}
 
 anonymous_namespace{wrapped_env.cpp}
 
 api
 Public API functions of SObjectizer-5.
 
 custom_mbox_details
 
 delivery_filter_templates
 Template-based implementations of delivery filters.
 
 dereg_reason
 Enumeration of cooperation deregistration reasons.
 
 details
 Some reusable and low-level classes/functions which can be used in public header files.
 
 disp
 Event dispatchers.
 
 env_infrastructures
 Various implementations of environment_infrastructure.
 
 enveloped_msg
 
 experimental
 
 impl
 Details of SObjectizer run-time implementations.
 
 internal_timer_helpers
 
 log_msg_details
 Implementation details of error_logging facility.
 
 low_level_api
 
 mchain_auto_close_details
 
 mchain_props
 Various properties and parameters of message chains.
 
 message_limit
 All stuff related to message limits.
 
 msg_tracing
 Public part of message delivery tracing mechanism.
 
 prio
 Helpers for working with priorities.
 
 rt
 All code related to implementation of SObjectizer run-time.
 
 send_functions_details
 Implementation details for send-family and request_future/value helper functions.
 
 stats
 All stuff related to run-time monitoring and statistics.
 
 thread_auto_join_details
 
 timer_thread
 Old timer thread related stuff.
 
 timers_details
 Timers implementation details.
 

Classes

class  abstract_message_box_t
 Mail box class. More...
 
class  abstract_message_chain_t
 An interace of message chain. More...
 
class  agent_context_t
 A context for agent construction and tuning. More...
 
class  agent_state_listener_t
 Interface of the agent state listener. More...
 
class  agent_t
 A base class for agents. More...
 
class  agent_tuning_options_t
 A collector for agent tuning options. More...
 
class  atomic_refcounted_t
 The base class for the object with a reference counting. More...
 
class  coop_dereg_notificators_container_t
 Container for cooperation deregistration notificators. More...
 
class  coop_dereg_reason_t
 
class  coop_handle_t
 Type of smart handle for a cooperation. More...
 
class  coop_listener_t
 Interface for the cooperation listener. More...
 
class  coop_reg_notificators_container_t
 Container for cooperation registration notificators. More...
 
class  coop_t
 Agent cooperation. More...
 
class  coop_unique_holder_t
 A special type that plays role of unique_ptr for coop. More...
 
class  delivery_filter_t
 An interface of delivery filter object. More...
 
class  disp_binder_t
 Interface for dispatcher binders. More...
 
class  environment_infrastructure_t
 An interface for environment_infrastructure entity. More...
 
class  environment_params_t
 Parameters for the SObjectizer Environment initialization. More...
 
class  environment_t
 SObjectizer Environment. More...
 
class  error_logger_t
 An interface for logging error messages. More...
 
class  event_exception_logger_t
 An interface for the exception logging. More...
 
class  event_queue_hook_t
 Interface of event_queue_hook object. More...
 
class  event_queue_t
 An interface of event queue for agent. More...
 
class  exception_t
 The base class for all SObjectizer exceptions. More...
 
struct  execution_demand_t
 A description of event execution demand. More...
 
class  execution_hint_t
 A hint for a dispatcher for execution of event for the concrete execution_demand. More...
 
class  extensible_select_t
 Special container for holding select parameters and select cases. More...
 
struct  immutable_msg
 A special marker for immutable message. More...
 
struct  initial_substate_of
 Helper for marking initial substate of composite state. More...
 
class  intrusive_ptr_t
 Template class for smart reference wrapper on the atomic_refcounted_t. More...
 
struct  is_classical_message
 A helper class for checking that message is a classical message derived from message_t class. More...
 
struct  is_mutable_message
 A helper class for checking that message is a mutable message. More...
 
struct  is_mutable_message< mutable_msg< T > >
 
struct  is_signal
 A helper class for checking that message is a signal. More...
 
struct  is_user_type_message
 A helper for detection presence of message of user type. More...
 
struct  is_user_type_message< user_type_message_t< M > >
 
class  layer_t
 An interface of the additional SObjectizer Environment layer. More...
 
struct  mbox_creation_data_t
 An information which is necessary for creation of a new mbox. More...
 
class  mchain_bulk_processing_params_t
 Basic parameters for advanced receive from mchain and for multi chain select. More...
 
class  mchain_master_handle_t
 Helper class for automatic close of a mchain at the destruction of master handle instance. More...
 
class  mchain_params_t
 Parameters for message chain. More...
 
class  mchain_receive_params_t
 Parameters for advanced receive from mchain. More...
 
class  mchain_receive_result_t
 A result of receive from mchain. More...
 
class  mchain_select_params_t
 Parameters for advanced select from multiple mchains. More...
 
class  message_holder_t
 A class for holding an instance of a message. More...
 
struct  message_payload_type
 A helper class for detection of payload type of message. More...
 
struct  message_payload_type< user_type_message_t< T > >
 
struct  message_payload_type_impl
 Implementation details for message_payload_type. More...
 
struct  message_payload_type_impl< T, false >
 Implementation details for message_payload_type. More...
 
class  message_t
 A base class for agent messages. More...
 
class  mhood_t
 A message wrapped to be used as type of argument for event handlers. More...
 
struct  msg_coop_deregistered
 Message about cooperation deregistration completion. More...
 
struct  msg_coop_registered
 Message about cooperation registration completion. More...
 
struct  mutable_msg
 A special marker for mutable message. More...
 
class  nonempty_name_t
 A class for the name which cannot be empty. More...
 
class  null_mutex_t
 A class which is like std::mutex but does not do any real actions. More...
 
class  outliving_reference_t
 Helper class for indication of long-lived reference via its type. More...
 
class  pause_backoff_t
 An implementation of backoff object using assembly instruction. More...
 
class  prepared_receive_t
 Special container for holding receive parameters and receive cases. More...
 
class  prepared_select_t
 Special container for holding select parameters and select cases. More...
 
class  queue_locks_defaults_manager_t
 A base class for manager of default locks for event queues. More...
 
class  read_lock_guard_t
 Scoped guard for shared locks. More...
 
class  rw_spinlock_t
 A simple multi-readers/single-writer spinlock (analog of std::shared_mutex). More...
 
class  signal_t
 A base class for agent signals. More...
 
class  spinlock_t
 A simple spinlock (analog of std::mutex). More...
 
class  state_t
 Class for the representing agent state. More...
 
class  stderr_logger_t
 A standard implementation of error_logger interface. More...
 
class  stop_guard_t
 An interface of stop_guard entity. More...
 
class  subscription_bind_t
 A class for creating a subscription to messages from the mbox. More...
 
struct  substate_of
 Helper for marking a substate of composite state. More...
 
class  timer_id_t
 An indentificator for the timer. More...
 
class  timer_manager_t
 Timer manager interface. More...
 
class  timer_t
 A base class for timer identificator. More...
 
struct  timer_thread_stats_t
 Statistics for run-time monitoring. More...
 
class  timer_thread_t
 Timer thread interface. More...
 
struct  user_type_message_t
 Template class for representing object of user type as a message. More...
 
class  wrapped_env_t
 A wrapped environment. More...
 
class  yield_backoff_t
 An implementation of backoff object with usage of std::yield. More...
 

Typedefs

using agent_ref_t = intrusive_ptr_t< agent_t >
 A smart reference to an agent. More...
 
using agent_state_listener_unique_ptr_t = std::unique_ptr< agent_state_listener_t >
 Typedef for the agent_state_listener autopointer. More...
 
using generic_simple_init_t = std::function< void(so_5::environment_t &) >
 Generic type for a simple SObjectizer-initialization function. More...
 
using generic_simple_so_env_params_tuner_t = std::function< void(so_5::environment_params_t &) >
 Generic type for a simple SO Environment paramenters tuning function. More...
 
using coop_reg_notificator_t = std::function< void(environment_t &, const coop_handle_t &) >
 Type of cooperation registration notificator. More...
 
using coop_reg_notificators_container_ref_t = intrusive_ptr_t< coop_reg_notificators_container_t >
 Typedef for smart pointer to notificators_container. More...
 
using coop_dereg_notificator_t = std::function< void(environment_t &, const coop_handle_t &, const coop_dereg_reason_t &) >
 Type of cooperation deregistration notificator. More...
 
using coop_dereg_notificators_container_ref_t = intrusive_ptr_t< coop_dereg_notificators_container_t >
 Typedef for smart pointer to notificators_container. More...
 
using coop_shptr_t = std::shared_ptr< coop_t >
 Typedef for the agent_coop smart pointer. More...
 
using coop_listener_unique_ptr_t = std::unique_ptr< coop_listener_t >
 Typedef for the coop_listener autopointer. More...
 
using current_thread_id_t = std::thread::id
 Type of the current thread id. More...
 
using disp_binder_shptr_t = std::shared_ptr< disp_binder_t >
 Typedef for the disp_binder smart pointer. More...
 
using environment_infrastructure_deleter_fnptr_t = void(*)(environment_infrastructure_t *)
 A type for deleter for environment_infrastructure objects. More...
 
using environment_infrastructure_unique_ptr_t = std::unique_ptr< environment_infrastructure_t, environment_infrastructure_deleter_fnptr_t >
 A type of unique pointer for environment_infrastructure entity. More...
 
using environment_infrastructure_factory_t = std::function< environment_infrastructure_unique_ptr_t(environment_t &, environment_params_t &, mbox_t) >
 Type of factory for environment infrastructure. More...
 
using error_logger_shptr_t = std::shared_ptr< error_logger_t >
 An alias for shared_ptr to error_logger. More...
 
using event_exception_logger_unique_ptr_t = std::unique_ptr< event_exception_logger_t >
 Typedef for the event_exception_logger autopointer. More...
 
using event_queue_hook_deleter_fnptr_t = void(*)(event_queue_hook_t *)
 A type for deleter of event_queue_hook object. More...
 
using event_queue_hook_unique_ptr_t = std::unique_ptr< event_queue_hook_t, event_queue_hook_deleter_fnptr_t >
 Alias for unique pointer to event_queue_hook. More...
 
using event_handler_method_t = std::function< void(message_ref_t &) >
 Type of event handler method. More...
 
using demand_handler_pfn_t = void(*)(current_thread_id_t, execution_demand_t &)
 Demand handler prototype. More...
 
using delivery_filter_unique_ptr_t = std::unique_ptr< delivery_filter_t >
 An alias of unique_ptr for delivery_filter. More...
 
using mbox_t = intrusive_ptr_t< abstract_message_box_t >
 Smart reference for the abstract_message_box. More...
 
using mchain_t = intrusive_ptr_t< abstract_message_chain_t >
 Short name for smart pointer to message chain. More...
 
using message_ref_t = intrusive_ptr_t< message_t >
 A smart reference to the message. More...
 
template<typename M >
using mutable_mhood_t = mhood_t< mutable_msg< M > >
 A short name for message hood for mutable message. More...
 
using queue_locks_defaults_manager_unique_ptr_t = std::unique_ptr< queue_locks_defaults_manager_t >
 An alias of unique_ptr for queue_locks_defaults_manager. More...
 
using layer_unique_ptr_t = std::unique_ptr< layer_t >
 Typedef for the layer's autopointer. More...
 
using layer_ref_t = std::shared_ptr< layer_t >
 Typedef for the layer's smart pointer. More...
 
using layer_map_t = std::map< std::type_index, layer_ref_t >
 Typedef for the map from a layer typeid to the layer. More...
 
using default_spinlock_t = spinlock_t< pause_backoff_t >
 
using default_rw_spinlock_t = rw_spinlock_t< pause_backoff_t >
 
using stop_guard_shptr_t = std::shared_ptr< stop_guard_t >
 An alias of shared_ptr for stop_guard. More...
 
using subscription_storage_factory_t = std::function< impl::subscription_storage_unique_ptr_t(agent_t *) >
 Type of subscription_storage factory. More...
 
using timer_thread_unique_ptr_t = std::unique_ptr< timer_thread_t >
 Auxiliary typedef for timer_thread autopointer. More...
 
using timer_thread_factory_t = std::function< timer_thread_unique_ptr_t(error_logger_shptr_t) >
 Type of factory for creating timer_thread objects. More...
 
using timer_manager_unique_ptr_t = std::unique_ptr< timer_manager_t >
 Auxiliary typedef for timer_manager autopointer. More...
 
using timer_manager_factory_t = std::function< timer_manager_unique_ptr_t(error_logger_shptr_t, outliving_reference_t< timer_manager_t::elapsed_timers_collector_t >) >
 Type of factory for creating timer_manager objects. More...
 
using atomic_counter_t = std::atomic_ulong
 Atomic counter type. More...
 
using atomic_flag_t = std::atomic_ulong
 Atomic flag type. More...
 
using mbox_id_t = unsigned long long
 A type for mbox indentifier. More...
 
using coop_id_t = std::uint_fast64_t
 ID of cooperation. More...
 

Enumerations

enum  exception_reaction_t {
  abort_on_exception = 1, shutdown_sobjectizer_on_exception = 2, deregister_coop_on_exception = 3, ignore_exception = 4,
  inherit_exception_reaction = 5
}
 A reaction of SObjectizer to an exception from agent event. More...
 
enum  delivery_possibility_t { delivery_possibility_t::must_be_delivered, delivery_possibility_t::no_subscription, delivery_possibility_t::disabled_by_delivery_filter, delivery_possibility_t::hidden_by_envelope }
 Result of checking delivery posibility. More...
 
enum  mbox_type_t { mbox_type_t::multi_producer_multi_consumer, mbox_type_t::multi_producer_single_consumer }
 Type of the message box. More...
 
enum  message_ownership_t { message_ownership_t::autodetected, message_ownership_t::unique, message_ownership_t::shared }
 Type of ownership of a message instance inside message_holder. More...
 
enum  priority_t : unsigned char {
  priority_t::p_min = 0, priority_t::p0 = p_min, priority_t::p1, priority_t::p2,
  priority_t::p3, priority_t::p4, priority_t::p5, priority_t::p6,
  priority_t::p7, priority_t::p_max = p7
}
 Definition of supported priorities. More...
 
enum  thread_safety_t : std::uint8_t { thread_safety_t::unsafe = 0, thread_safety_t::safe = 1 }
 Thread safety indicator. More...
 
enum  work_thread_activity_tracking_t { work_thread_activity_tracking_t::unspecified, work_thread_activity_tracking_t::off, work_thread_activity_tracking_t::on }
 Values for dispatcher's work thread activity tracking. More...
 
enum  message_mutability_t { message_mutability_t::immutable_message, message_mutability_t::mutable_message }
 A enum with variants of message mutability or immutability. More...
 
enum  message_kind_t { message_kind_t::signal, message_kind_t::classical_message, message_kind_t::user_type_message, message_kind_t::enveloped_msg }
 A enum with variants of message kinds. More...
 
enum  infinite_wait_indication { infinite_wait_indication::infinite_wait }
 A type for special marker for infitite waiting on service request or on receive from mchain. More...
 
enum  no_wait_indication { no_wait_indication::no_wait }
 A type for special marker for no waiting on service request or on receive from mchain. More...
 

Functions

SO_5_FUNC void swap (environment_params_t &a, environment_params_t &b)
 
SO_5_FUNC error_logger_shptr_t create_stderr_logger ()
 A factory for creating error_logger implemenation which uses std::stderr as log stream. More...
 
SO_5_FUNC event_exception_logger_unique_ptr_t create_std_event_exception_logger ()
 Create the default exception logger. More...
 
SO_5_FUNC subscription_storage_factory_t adaptive_subscription_storage_factory ( std::size_t threshold)
 Factory for adaptive subscription storage. More...
 
SO_5_FUNC subscription_storage_factory_t adaptive_subscription_storage_factory ( std::size_t threshold, const subscription_storage_factory_t &small_storage_factory, const subscription_storage_factory_t &large_storage_factory)
 Factory for adaptive subscription storage. More...
 
SO_5_FUNC subscription_storage_factory_t default_subscription_storage_factory ()
 Factory for default subscription storage object. More...
 
SO_5_FUNC subscription_storage_factory_t hash_table_based_subscription_storage_factory ()
 Factory for default subscription storage based on std::unordered_map. More...
 
SO_5_FUNC subscription_storage_factory_t map_based_subscription_storage_factory ()
 Factory for subscription storage based on std::map. More...
 
SO_5_FUNC subscription_storage_factory_t vector_based_subscription_storage_factory ( std::size_t initial_capacity)
 Factory for subscription storage based on std::vector. More...
 
SO_5_FUNC queue_locks_defaults_manager_unique_ptr_t make_defaults_manager_for_simple_locks ()
 A factory for queue_locks_defaults_manager with generators for simple locks. More...
 
SO_5_FUNC queue_locks_defaults_manager_unique_ptr_t make_defaults_manager_for_combined_locks ()
 A factory for queue_locks_defaults_manager with generators for combined locks. More...
 
void operator>>= (agent_t *agent, const state_t &new_state)
 A shortcat for switching the agent state. More...
 
template<typename Option >
agent_context_t operator+ (environment_t &env, Option arg)
 A plus operator for creating agent_context object from a reference to Environment and single agent tuning option. More...
 
auto make_coop_reg_notificator (mbox_t target) noexcept
 Create notificator about cooperation registration completion. More...
 
auto make_coop_dereg_notificator (mbox_t target) noexcept
 Create notificator about cooperation deregistration completion. More...
 
template<typename Init_Routine >
void launch (Init_Routine &&init_routine)
 Launch a SObjectizer Environment with default parameters. More...
 
template<typename Init_Routine , typename Params_Tuner >
void launch (Init_Routine &&init_routine, Params_Tuner &&params_tuner)
 Launch a SObjectizer Environment with explicitely specified parameters. More...
 
template<typename T >
 intrusive_ptr_t (std::unique_ptr< T >) -> intrusive_ptr_t< T >
 
current_thread_id_t query_current_thread_id ()
 Get the ID of the current thread. More...
 
current_thread_id_t null_current_thread_id ()
 Get NULL thread id. More...
 
std::thread::id raw_id_from_current_thread_id (const current_thread_id_t &w)
 Get the raw thread id from current_thread_id. More...
 
template<typename... Args>
SO_5_NODISCARD coop_unique_holder_t create_child_coop (agent_t &owner, Args &&... args)
 A simple way for creating child cooperation. More...
 
template<typename... Args>
SO_5_NODISCARD coop_unique_holder_t create_child_coop (coop_handle_t parent, Args &&... args)
 A simple way for creating child cooperation when there is a reference to the parent cooperation object. More...
 
template<typename... Args>
decltype(auto) introduce_child_coop (agent_t &owner, Args &&... args)
 A simple way for creating and registering child cooperation. More...
 
template<typename... Args>
decltype(auto) introduce_child_coop (coop_handle_t parent, Args &&... args)
 A simple way for creating and registering child cooperation when there is a reference to parent coop. More...
 
disp_binder_shptr_t make_default_disp_binder (environment_t &env)
 Create an instance of the default dispatcher binder. More...
 
template<typename Hook_Type , typename... Args>
event_queue_hook_unique_ptr_t make_event_queue_hook (event_queue_hook_deleter_fnptr_t deleter, Args &&...args)
 Helper function for simplify creation of event_queue_hook object. More...
 
SO_5_NODISCARD event_queue_hook_unique_ptr_t make_empty_event_queue_hook_unique_ptr ()
 Helper function for creation of empty unique_ptr for event_queue_hook. More...
 
template<typename Method_Pointer >
std::enable_if< details::is_agent_method_pointer< details::method_arity::unary, Method_Pointer >::value, details::msg_type_and_handler_pair_t >::type preprocess_agent_event_handler (const mbox_t &mbox, agent_t &agent, Method_Pointer pfn)
 Do preprocessing and some verification of event handler and return msg_type_and_handler_pair for it. More...
 
template<typename Lambda >
std::enable_if< details::lambda_traits::is_lambda< Lambda >::value, details::msg_type_and_handler_pair_t >::type preprocess_agent_event_handler (const mbox_t &mbox, agent_t &, Lambda &&lambda)
 Do preprocessing and some verification of event handler and return msg_type_and_handler_pair for it. More...
 
void close_drop_content (const mchain_t &ch)
 Helper function for closing a message chain with dropping all its content. More...
 
void close_retain_content (const mchain_t &ch)
 Helper function for closing a message chain with retaining all its content. More...
 
mchain_receive_params_t< mchain_props::msg_count_status_t::undefinedfrom (mchain_t chain)
 A helper function for simplification of creation of mchain_receive_params instance. More...
 
template<mchain_props::msg_count_status_t Msg_Count_Status, typename... Handlers>
mchain_receive_result_t receive (const mchain_receive_params_t< Msg_Count_Status > &params, Handlers &&... handlers)
 Advanced version of receive from mchain. More...
 
template<mchain_props::msg_count_status_t Msg_Count_Status, typename... Handlers>
prepared_receive_t< sizeof...(Handlers) > prepare_receive (const mchain_receive_params_t< Msg_Count_Status > &params, Handlers &&... handlers)
 Create parameters for receive function to be used later. More...
 
template<std::size_t Handlers_Count>
mchain_receive_result_t receive (const prepared_receive_t< Handlers_Count > &prepared)
 A receive operation to be done on previously prepared receive params. More...
 
mchain_t create_mchain (environment_t &env, mchain_props::duration_t waiting_time, std::size_t max_size, mchain_props::memory_usage_t memory_usage, mchain_props::overflow_reaction_t overflow_reaction)
 Create size-limited chain with waiting on overflow. More...
 
mchain_t create_mchain (wrapped_env_t &sobj, mchain_props::duration_t waiting_time, std::size_t max_size, mchain_props::memory_usage_t memory_usage, mchain_props::overflow_reaction_t overflow_reaction)
 Create size-limited chain without waiting on overflow. More...
 
template<typename... Tail>
mchain_auto_close_details::auto_closer_t< sizeof...(Tail) > auto_close_mchains (mchain_props::close_mode_t close_mode, Tail &&... tail)
 Helper function for creation of automatic closer of mchains. More...
 
template<typename... Tail>
mchain_auto_close_details::auto_closer_t< sizeof...(Tail) > auto_close_retain_content (Tail &&... tail)
 Helper function for automatic closing of mchains with retaining their content. More...
 
template<typename... Tail>
mchain_auto_close_details::auto_closer_t< sizeof...(Tail) > auto_close_drop_content (Tail &&... tail)
 Helper function for automatic closing of mchains with dropping their content. More...
 
mchain_select_params_t< mchain_props::msg_count_status_t::undefinedfrom_all ()
 Helper function for creation of mchain_select_params instance with default values. More...
 
template<typename... Handlers>
mchain_props::select_case_unique_ptr_t case_ (mchain_t chain, Handlers &&... handlers)
 A helper for creation of select_case object for one multi chain select. More...
 
template<mchain_props::msg_count_status_t Msg_Count_Status, typename... Cases>
mchain_receive_result_t select (const mchain_select_params_t< Msg_Count_Status > &params, Cases &&... cases)
 An advanced form of multi chain select. More...
 
template<mchain_props::msg_count_status_t Msg_Count_Status, typename... Cases>
prepared_select_t< sizeof...(Cases) > prepare_select (mchain_select_params_t< Msg_Count_Status > params, Cases &&... cases)
 Create prepared select statement to be used later. More...
 
template<std::size_t Cases_Count>
mchain_receive_result_t select (const prepared_select_t< Cases_Count > &prepared)
 A select operation to be done on previously prepared select params. More...
 
template<mchain_props::msg_count_status_t Msg_Count_Status, typename... Cases>
extensible_select_t make_extensible_select (mchain_select_params_t< Msg_Count_Status > params, Cases &&... cases)
 Creation of extensible-select instance. More...
 
template<typename... Cases>
void add_select_cases (extensible_select_t &extensible_select, Cases &&... cases)
 Add a portion of cases to extensible-select instance. More...
 
mchain_receive_result_t select (const extensible_select_t &extensible_select)
 A select operation to be done on previously prepared extensible-select object. More...
 
template<class Msg >
void ensure_not_signal ()
 A special compile-time checker to guarantee that the message class is not a signal class. More...
 
template<class Msg >
void ensure_message_with_actual_data (const Msg *m)
 A special checker to guarantee that the message is an instance of the message_t (not signal_t) and has a not-null pointer to the message data. More...
 
template<class S >
void ensure_not_mutable_signal ()
 A special compile-time checker to guarantee that S is not a mutable signal. More...
 
template<class Msg >
void ensure_signal ()
 A special compile-time checker to guarantee that the Msg is derived from the signal_t. More...
 
template<typename Msg >
void ensure_classical_message ()
 A special compile-time checker to guarantee that Msg is derived from message_t. More...
 
template<typename M >
std::enable_if< !is_signal< M >::value, mhood_t< immutable_msg< M > > >::type to_immutable (mhood_t< mutable_msg< M > > msg)
 Transform mutable message instance into immutable. More...
 
template<typename M >
std::enable_if< is_signal< M >::value, mhood_t< immutable_msg< M > > >::type to_immutable (mhood_t< mutable_msg< M > >)
 
template<typename T >
outliving_reference_t< T > outliving_mutable (T &r)
 Make outliving_reference wrapper for mutable reference. More...
 
template<typename T >
outliving_reference_t< const T > outliving_const (T const &r)
 Make outliving_reference wrapper for const reference. More...
 
template<typename T >
outliving_reference_t< const T > outliving_const (outliving_reference_t< T > r)
 Make outliving_reference wrapper for const reference. More...
 
std::size_t to_size_t (priority_t priority)
 Helper function for conversion from priority to size_t. More...
 
priority_t to_priority_t (std::size_t v)
 Helper function for conversion from size_t to priority. More...
 
template<typename Message , typename Target , typename... Args>
void send (Target &&to, Args &&... args)
 A utility function for creating and delivering a message or a signal. More...
 
template<typename Target , typename Message >
std::enable_if< !is_signal< Message >::value >::type send (Target &&to, mhood_t< Message > what)
 A version of send function for redirection of a message from exising message hood. More...
 
template<typename Target , typename Message >
std::enable_if< is_signal< Message >::value >::type send (Target &&to, mhood_t< Message >)
 A version of send function for redirection of a signal from exising message hood. More...
 
template<typename Target , typename Message , message_ownership_t Ownership>
void send (Target &&to, message_holder_t< Message, Ownership > what)
 A version of send function for redirection of a message from exising message_holder instance. More...
 
template<typename Message , typename Target , typename... Args>
void send_delayed (Target &&target, std::chrono::steady_clock::duration pause, Args &&... args)
 A utility function for creating and delivering a delayed message to the specified destination. More...
 
template<typename Target , typename Message >
std::enable_if< !message_payload_type< Message >::is_signal >::type send_delayed (Target &&to, std::chrono::steady_clock::duration pause, mhood_t< Message > msg)
 A utility function for delayed redirection of a message from existing message hood. More...
 
template<typename Target , typename Message >
std::enable_if< message_payload_type< Message >::is_signal >::type send_delayed (Target &&to, std::chrono::steady_clock::duration pause, mhood_t< Message >)
 A utility function for delayed redirection of a signal from existing message hood. More...
 
template<typename Target , typename Message , message_ownership_t Ownership>
void send_delayed (Target &&to, std::chrono::steady_clock::duration pause, message_holder_t< Message, Ownership > msg)
 A version of send_delayed function for redirection of a message from exising message_holder instance. More...
 
template<typename Message , typename Target , typename... Args>
SO_5_NODISCARD timer_id_t send_periodic (Target &&target, std::chrono::steady_clock::duration pause, std::chrono::steady_clock::duration period, Args &&... args)
 A utility function for creating and delivering a periodic message to the specified destination. More...
 
template<typename Target , typename Message >
SO_5_NODISCARD std::enable_if< !is_signal< Message >::value, timer_id_t >::type send_periodic (Target &&target, std::chrono::steady_clock::duration pause, std::chrono::steady_clock::duration period, mhood_t< Message > mhood)
 A utility function for delivering a periodic from an existing message hood. More...
 
template<typename Target , typename Message >
SO_5_NODISCARD std::enable_if< is_signal< Message >::value, timer_id_t >::type send_periodic (Target &&target, std::chrono::steady_clock::duration pause, std::chrono::steady_clock::duration period, mhood_t< Message >)
 A utility function for periodic redirection of a signal from existing message hood. More...
 
template<typename Target , typename Message , message_ownership_t Ownership>
SO_5_NODISCARD timer_id_t send_periodic (Target &&target, std::chrono::steady_clock::duration pause, std::chrono::steady_clock::duration period, message_holder_t< Message, Ownership > what)
 A version of send_periodic function for redirection of a message from exising message_holder instance. More...
 
template<typename... Tail>
thread_auto_join_details::auto_joiner_t< 1+sizeof...(Tail) > auto_join (std::thread &first_thread, Tail &&... tail)
 Helper function for creation of automatic joiner of std::threads. More...
 
mbox_id_t null_mbox_id ()
 Default value for null mbox_id. More...
 
Tools for creating timer threads.
SO_5_FUNC timer_thread_unique_ptr_t create_timer_wheel_thread ( error_logger_shptr_t logger)
 Create timer thread based on timer_wheel mechanism. More...
 
SO_5_FUNC timer_thread_unique_ptr_t create_timer_wheel_thread ( error_logger_shptr_t logger, unsigned int wheel_size, std::chrono::steady_clock::duration granuality)
 Create timer thread based on timer_wheel mechanism. More...
 
SO_5_FUNC timer_thread_unique_ptr_t create_timer_heap_thread ( error_logger_shptr_t logger)
 Create timer thread based on timer_heap mechanism. More...
 
SO_5_FUNC timer_thread_unique_ptr_t create_timer_heap_thread ( error_logger_shptr_t logger, std::size_t initial_heap_capacity)
 Create timer thread based on timer_heap mechanism. More...
 
SO_5_FUNC timer_thread_unique_ptr_t create_timer_list_thread ( error_logger_shptr_t logger)
 Create timer thread based on timer_list mechanism. More...
 
Tools for creating timer managers.
SO_5_FUNC timer_manager_unique_ptr_t create_timer_wheel_manager ( error_logger_shptr_t logger, outliving_reference_t< timer_manager_t::elapsed_timers_collector_t > collector)
 Create timer manager based on timer_wheel mechanism. More...
 
SO_5_FUNC timer_manager_unique_ptr_t create_timer_wheel_manager ( error_logger_shptr_t logger, outliving_reference_t< timer_manager_t::elapsed_timers_collector_t > collector, unsigned int wheel_size, std::chrono::steady_clock::duration granuality)
 Create timer manager based on timer_wheel mechanism. More...
 
SO_5_FUNC timer_manager_unique_ptr_t create_timer_heap_manager ( error_logger_shptr_t logger, outliving_reference_t< timer_manager_t::elapsed_timers_collector_t > collector)
 Create timer manager based on timer_heap mechanism. More...
 
SO_5_FUNC timer_manager_unique_ptr_t create_timer_heap_manager ( error_logger_shptr_t logger, outliving_reference_t< timer_manager_t::elapsed_timers_collector_t > collector, std::size_t initial_heap_capacity)
 Create timer manager based on timer_heap mechanism. More...
 
SO_5_FUNC timer_manager_unique_ptr_t create_timer_list_manager ( error_logger_shptr_t logger, outliving_reference_t< timer_manager_t::elapsed_timers_collector_t > collector)
 Create timer thread based on timer_list mechanism. More...
 
Operators for tuning agent_context.
agent_context_t operator+ (agent_context_t ctx, subscription_storage_factory_t factory)
 
template<class M >
agent_context_t operator+ (agent_context_t ctx, message_limit::drop_indicator_t< M > limit)
 
template<class M >
agent_context_t operator+ (agent_context_t ctx, message_limit::abort_app_indicator_t< M > limit)
 
template<class M , class L >
agent_context_t operator+ (agent_context_t ctx, message_limit::log_then_abort_app_indicator_t< M, L > limit)
 
template<class M , class L >
agent_context_t operator+ (agent_context_t ctx, message_limit::redirect_indicator_t< M, L > limit)
 
template<class M >
agent_context_t operator+ (agent_context_t ctx, message_limit::transform_indicator_t< M > limit)
 
agent_context_t operator+ (agent_context_t ctx, so_5::priority_t agent_priority)
 
Helper functions for creating parameters for mchain.
mchain_params_t make_unlimited_mchain_params ()
 Create parameters for size-unlimited mchain. More...
 
mchain_params_t make_limited_without_waiting_mchain_params (std::size_t max_size, mchain_props::memory_usage_t memory_usage, mchain_props::overflow_reaction_t overflow_reaction)
 Create parameters for size-limited mchain without waiting on overflow. More...
 
mchain_params_t make_limited_with_waiting_mchain_params (std::size_t max_size, mchain_props::memory_usage_t memory_usage, mchain_props::overflow_reaction_t overflow_reaction, mchain_props::duration_t wait_timeout)
 Create parameters for size-limited mchain with waiting on overflow. More...
 
Helper functions for mchain creation.
mchain_t create_mchain (environment_t &env)
 Create size-unlimited chain. More...
 
mchain_t create_mchain (wrapped_env_t &sobj)
 Create size-unlimited chain. More...
 
mchain_t create_mchain (environment_t &env, std::size_t max_size, mchain_props::memory_usage_t memory_usage, mchain_props::overflow_reaction_t overflow_reaction)
 Create size-limited chain without waiting on overflow. More...
 
mchain_t create_mchain (wrapped_env_t &sobj, std::size_t max_size, mchain_props::memory_usage_t memory_usage, mchain_props::overflow_reaction_t overflow_reaction)
 Create size-limited chain without waiting on overflow. More...
 
Standard timer thread factories.
timer_thread_factory_t timer_wheel_factory ()
 Factory for timer_wheel thread with default parameters. More...
 
timer_thread_factory_t timer_wheel_factory (unsigned int wheel_size, std::chrono::steady_clock::duration granularity)
 Factory for timer_wheel thread with explicitely specified parameters. More...
 
timer_thread_factory_t timer_heap_factory ()
 Factory for timer_heap thread with default parameters. More...
 
timer_thread_factory_t timer_heap_factory (std::size_t initial_heap_capacity)
 Factory for timer_heap thread with explicitely specified parameters. More...
 
timer_thread_factory_t timer_list_factory ()
 Factory for timer_list thread with default parameters. More...
 
Standard timer manager factories.
timer_manager_factory_t timer_wheel_manager_factory ()
 Factory for timer_wheel manager with default parameters. More...
 
timer_manager_factory_t timer_wheel_manager_factory (unsigned int wheel_size, std::chrono::steady_clock::duration granularity)
 Factory for timer_wheel manager with explicitely specified parameters. More...
 
timer_manager_factory_t timer_heap_manager_factory ()
 Factory for timer_heap manager with default parameters. More...
 
timer_manager_factory_t timer_heap_manager_factory (std::size_t initial_heap_capacity)
 Factory for timer_heap manager with explicitely specified parameters. More...
 
timer_manager_factory_t timer_list_manager_factory ()
 Factory for timer_list manager with default parameters. More...
 

Variables

const int rc_environment_error = 1
 so_environment launch is failed. More...
 
const int rc_another_state_switch_in_progress = 170
 An attempt to switch agent state when another switch operation is in progress. More...
 
const int rc_autoshutdown_must_be_enabled = 171
 An attempt to launch environment with autoshutdown disabled in conditions where autoshutdown must be enabled. More...
 
const int rc_mutable_msg_cannot_be_delivered_via_mpmc_mbox = 172
 An attempt to deliver mutable message via MPMC mbox. More...
 
const int rc_mutable_msg_cannot_be_periodic = 173
 An attempt to send mutable message as a periodic message. More...
 
const int rc_subscription_to_mutable_msg_from_mpmc_mbox = 174
 An attempt to make subscription on mutable message from MPMC mbox. More...
 
const int rc_cannot_set_stop_guard_when_stop_is_started = 175
 An attempt to set up a new stop_guard when the stop operation is already in progress. More...
 
const int rc_negative_value_for_pause = 176
 An attempt to use negative value for pause argument for delayed or periodic message/signal. More...
 
const int rc_negative_value_for_period = 177
 An attempt to use negative value for period argument for periodic message/signal. More...
 
const int rc_transfer_to_state_loop = 178
 A loop in transfer_to_state detected. More...
 
const int rc_attempt_to_cast_to_envelope_on_nullptr = 180
 An attempt to cast message to message envelope when a pointer to message is NULL. More...
 
const int rc_unable_to_define_new_step = 181
 New step can't be defined if testing scenario is already started or finished. More...
 
const int rc_scenario_must_be_completed = 182
 Testing scenario must be completed before an attempt to do the current operation. More...
 
const int rc_stored_state_name_not_found = 183
 There is no stored state name in the testing scenario. More...
 
const int rc_coop_already_destroyed = 184
 An attempt to get a pointer to already destroyed cooperation. More...
 
const int rc_coop_is_not_in_registered_state = 185
 An attempt to do something with coop that is not in registered state. More...
 
const int rc_unable_to_join_thread_by_itself = 186
 An attempt to call join() from the joinable thread itself. More...
 
const int rc_extensible_select_is_active_now = 187
 An attempt to modify or activate extensible-select when an operation on that extensible-select object is already active. More...
 
const int rc_prepared_select_is_active_now = 188
 An attempt to activate prepared-select when an operation on that prepared-select object is already active. More...
 
const thread_safety_t not_thread_safe = thread_safety_t::unsafe
 Shorthand for thread unsafety indicator. More...
 
const thread_safety_t thread_safe = thread_safety_t::safe
 Shorthand for thread safety indicator. More...
 
const infinite_wait_indication infinite_wait
 A special indicator for infinite waiting on service request or on receive from mchain. More...
 
const no_wait_indication no_wait = no_wait_indication::no_wait
 A special indicator for no waiting on service request or on receive from mchain. More...
 
Error codes for agent's methods.
const int rc_agent_unknown_state = 10
 Trying to switch to the unknown state. More...
 
const int rc_agent_is_already_bind_to_env = 11
 Agent is already bound to the SObjectizer Environment. More...
 
const int rc_agent_is_already_bind_to_disp = 12
 Agent is already bound to the dispatcher. More...
 
const int rc_named_disp_not_found = 13
 Dispatcher with that name is not found. More...
 
const int rc_agent_has_no_cooperation = 14
 Agent is not bound to a cooperation. More...
 
const int rc_agent_incompatible_type_conversion = 15
 It is impossible to make a cast to that type. More...
 
const int rc_operation_enabled_only_on_agent_working_thread = 16
 An attempt to perform an operation which is enabled only on agent's working thread. More...
 
const int rc_no_initial_substate = 17
 An attempt to change agent state to a new composite state which have no initial state defined. More...
 
const int rc_state_nesting_is_too_deep = 18
 Nesting of agent states is too deep. More...
 
const int rc_initial_substate_already_defined = 19
 Initial substate for a composite state is already defined. More...
 
Error codes for cooperations of agents.
const int rc_zero_ptr_to_coop = 20
 A zero pointer is detected. More...
 
const int rc_coop_with_specified_name_is_already_registered = 21
 Cooperation name is not unique. More...
 
const int rc_coop_has_references_to_null_agents_or_binders = 22
 Cooperation has the null reference to an agent or dispatcher binding. More...
 
const int rc_coop_has_not_found_among_registered_coop = 23
 There is no registered cooperation with that name. More...
 
const int rc_coop_define_agent_failed = 24
 Cooperation couldn't be registered. More...
 
const int rc_agent_to_disp_binding_failed = 27
 Binding of agent to dispatcher failed. More...
 
const int rc_unable_to_register_coop_during_shutdown = 28
 It is impossible to register cooperation during SObjectizer Environment shutdown. More...
 
Error codes for dispatchers.
const int rc_disp_start_failed = 30
 Unable to start a dispatcher. More...
 
const int rc_disp_create_failed = 31
 Unable to create a dispatcher. More...
 
const int rc_disp_type_mismatch = 32
 
const int rc_disp_cannot_be_added = 34
 New dispatcher cannot be added because of illegal state of SObjectizer Environment. More...
 
Error codes for event handlers and message interceptors registration.
const int rc_evt_handler_already_provided = 40
 A handler for that event/mbox/state is already registered. More...
 
const int rc_no_event_handler_provided = 41
 
const int rc_event_handler_match_error = 42
 Unable to deregister that handler. More...
 
const int rc_agent_is_not_the_state_owner = 43
 Agent doesn't own this state. More...
 
const int rc_intercept_handler_already_provided = 44
 An interceptor for the event/mbox/state is already registered. More...
 
const int rc_no_interception_handler_provided = 45
 
const int rc_interception_handler_match_error = 46
 Unable to deregister this interceptor. More...
 
const int rc_illegal_subscriber_for_mpsc_mbox = 47
 An attempt to create illegal subscription to mpsc_mbox. More...
 
const int rc_message_has_no_limit_defined = 48
 An attempt to create subscription to message without predefined limit for that message type. More...
 
const int rc_several_limits_for_one_message_type = 49
 An attempt to define several limits for one message type. More...
 
Error codes for mboxes.
const int rc_mbox_duplicating_name = 80
 The mbox name is not unique. More...
 
const int rc_mbox_unable_to_find_mbox = 81
 The name of mbox is unknown. More...
 
const int rc_null_message_data = 82
 Null message data. More...
 
const int rc_no_svc_handlers = 83
 No handlers for service request found. More...
 
const int rc_more_than_one_svc_handler = 84
 There are more then one handler for service request. More...
 
const int rc_svc_not_handled = 85
 Service request has not been handled. Service handler is disabled in the current agent state. More...
 
const int rc_svc_result_not_received_yet = 86
 Service request result has not beed received yet. More...
 
const int rc_msg_service_request_bad_cast = 87
 Unable to cast service call description object to the appropriate type. More...
 
const int rc_svc_request_cannot_be_transfomred_on_overlimit = 88
 Unable to transform service request as part of overlimit reaction. More...
 
const int rc_delivery_filter_cannot_be_used_on_mpsc_mbox = 89
 Delivery filter is not applicable to MPSC-mboxes. More...
 
Error codes for delayed or repeated events.
const int rc_unable_to_schedule_timer_act = 90
 Unable to schedule a timer event. More...
 
Error codes for layers.
const int rc_layer_not_binded_to_so_env = 100
 The layer is not bound to the SObjectizer Environment. More...
 
const int rc_trying_to_add_nullptr_extra_layer = 101
 Unable to bind a layer by the null pointer to it. More...
 
const int rc_trying_to_add_extra_layer_that_already_exists_in_default_list = 102
 The layer is already bound to the SObjectizer Environment as a default layer. More...
 
const int rc_trying_to_add_extra_layer_that_already_exists_in_extra_list = 103
 The layer is already bound to the SObjectizer Environment as an extra layer. More...
 
const int rc_unable_to_start_extra_layer = 104
 Layer initialization is failed. More...
 
const int rc_layer_does_not_exist = 105
 A layer with the specified type doesn't exist. More...
 
Error codes for priorities.
const int rc_priority_quote_illegal_value = 120
 Illegal value of quote for a priority. More...
 
Error codes for SObjectizer Environment related errors.
const int rc_msg_tracing_disabled = 140
 Message delivery tracing is disabled and cannot be used. More...
 
Error codes for message chains.
const int rc_msg_chain_is_empty = 160
 Attempt to get message from empty message queue. More...
 
const int rc_msg_chain_is_full = 161
 Attempt to push a message to full message queue. More...
 
const int rc_msg_chain_doesnt_support_subscriptions = 162
 Attempt to make subscription for message chain. More...
 
const int rc_msg_chain_doesnt_support_delivery_filters = 163
 Attempt to set delivery_filter for message chain. More...
 
const int rc_msg_chain_overflow = 164
 
const int rc_several_handlers_for_one_message_type = 165
 Attempt to define several handlers for one msg_type. More...
 
Common error codes.
const int rc_empty_name = 500
 The empty name doesn't allowed. More...
 
const int rc_invalid_time_limit_for_state = 501
 Invalid value of time limit for an agent's state. More...
 
const int rc_not_implemented = 502
 Feature or method has no implementation yet. More...
 
const int rc_unknown_exception_type = 503
 An exception of unknown type is caught. More...
 
const int rc_unexpected_error = 0xFFFFFF
 Unclassified error. More...
 

Detailed Description

Public part of message limit implementation.

Private part of message limit implementation.

Main SObjectizer-5 namespace.

Since
v.5.5.4

Typedef Documentation

◆ agent_ref_t

A smart reference to an agent.

Note
Defined as typedef since v.5.2.0

◆ agent_state_listener_unique_ptr_t

Typedef for the agent_state_listener autopointer.

◆ atomic_counter_t

using so_5::atomic_counter_t = typedef std::atomic_ulong

Atomic counter type.

◆ atomic_flag_t

using so_5::atomic_flag_t = typedef std::atomic_ulong

Atomic flag type.

◆ coop_dereg_notificator_t

using so_5::coop_dereg_notificator_t = typedef std::function< void( environment_t &, const coop_handle_t &, const coop_dereg_reason_t &) >

Type of cooperation deregistration notificator.

Since
v.5.2.3

Cooperation notificator should be a function with the following prototype:

void
notificator(
// SObjectizer Environment for cooperation.
// Coop's handle.
const coop_handle_t & coop,
// Reason of deregistration.
const so_5::coop_dereg_reason_t & reason );

◆ coop_dereg_notificators_container_ref_t

Typedef for smart pointer to notificators_container.

Since
v.5.2.3

◆ coop_id_t

using so_5::coop_id_t = typedef std::uint_fast64_t

ID of cooperation.

Since
v.5.6.0

◆ coop_listener_unique_ptr_t

using so_5::coop_listener_unique_ptr_t = typedef std::unique_ptr< coop_listener_t >

Typedef for the coop_listener autopointer.

◆ coop_reg_notificator_t

using so_5::coop_reg_notificator_t = typedef std::function< void(environment_t &, const coop_handle_t &) >

Type of cooperation registration notificator.

Since
v.5.2.3

Cooperation notificator should be a function with the following prototype:

void
notificator(
// SObjectizer Environment for cooperation.
// Coop's handle.
const coop_handle_t & coop );

◆ coop_reg_notificators_container_ref_t

Typedef for smart pointer to notificators_container.

Since
v.5.2.3

◆ coop_shptr_t

using so_5::coop_shptr_t = typedef std::shared_ptr< coop_t >

Typedef for the agent_coop smart pointer.

◆ current_thread_id_t

using so_5::current_thread_id_t = typedef std::thread::id

Type of the current thread id.

◆ default_rw_spinlock_t

◆ default_spinlock_t

◆ delivery_filter_unique_ptr_t

using so_5::delivery_filter_unique_ptr_t = typedef std::unique_ptr< delivery_filter_t >

An alias of unique_ptr for delivery_filter.

Since
v.5.5.5

◆ demand_handler_pfn_t

Demand handler prototype.

Since
v.5.2.0

◆ disp_binder_shptr_t

using so_5::disp_binder_shptr_t = typedef std::shared_ptr< disp_binder_t >

Typedef for the disp_binder smart pointer.

Examples:
so_5/hardwork_imit/main.cpp.

◆ environment_infrastructure_deleter_fnptr_t

A type for deleter for environment_infrastructure objects.

Since
v.5.5.19

◆ environment_infrastructure_factory_t

Type of factory for environment infrastructure.

A factory must be a function with the following format:

// Environment for which env_infrastructure will be created.
environment_t & env,
// Parameters for that environment.
environment_params_t & params,
// Message box for distribution of run-time statistics.
mbox_t stats_distribution_mbox );
Since
v.5.5.19

◆ environment_infrastructure_unique_ptr_t

A type of unique pointer for environment_infrastructure entity.

Note
A deleter should be specified for entity object. It makes possible to create unique pointers for objects which must not be delete via delete operator. For example:
// Object is created on stack. Need not to be deleted.
my_special_infrastructure_t my( ... );
p.environment_infrastructure(
} );
...
} );
Since
v.5.5.19

◆ error_logger_shptr_t

using so_5::error_logger_shptr_t = typedef std::shared_ptr< error_logger_t >

An alias for shared_ptr to error_logger.

Since
v.5.5.0

◆ event_exception_logger_unique_ptr_t

Typedef for the event_exception_logger autopointer.

◆ event_handler_method_t

using so_5::event_handler_method_t = typedef std::function< void(message_ref_t &) >

Type of event handler method.

Since
v.5.3.0

◆ event_queue_hook_deleter_fnptr_t

A type for deleter of event_queue_hook object.

Since
v.5.5.24

◆ event_queue_hook_unique_ptr_t

Alias for unique pointer to event_queue_hook.

Since
v.5.5.24

◆ generic_simple_init_t

using so_5::generic_simple_init_t = typedef std::function< void(so_5::environment_t &) >

Generic type for a simple SObjectizer-initialization function.

Since
v.5.3.0

◆ generic_simple_so_env_params_tuner_t

Generic type for a simple SO Environment paramenters tuning function.

Since
v.5.3.0

◆ layer_map_t

using so_5::layer_map_t = typedef std::map< std::type_index, layer_ref_t >

Typedef for the map from a layer typeid to the layer.

◆ layer_ref_t

using so_5::layer_ref_t = typedef std::shared_ptr< layer_t >

Typedef for the layer's smart pointer.

◆ layer_unique_ptr_t

using so_5::layer_unique_ptr_t = typedef std::unique_ptr< layer_t >

Typedef for the layer's autopointer.

◆ mbox_id_t

using so_5::mbox_id_t = typedef unsigned long long

A type for mbox indentifier.

◆ mbox_t

Smart reference for the abstract_message_box.

Note
Defined as typedef since v.5.2.0
Examples:
so_5/make_pipeline/main.cpp.

◆ mchain_t

Short name for smart pointer to message chain.

Since
v.5.5.13

◆ message_ref_t

A smart reference to the message.

Note
Defined as typedef since v.5.2.0

◆ mutable_mhood_t

template<typename M >
using so_5::mutable_mhood_t = typedef mhood_t< mutable_msg<M> >

A short name for message hood for mutable message.

Since
v.5.5.19

◆ queue_locks_defaults_manager_unique_ptr_t

An alias of unique_ptr for queue_locks_defaults_manager.

Since
v.5.5.18

◆ stop_guard_shptr_t

using so_5::stop_guard_shptr_t = typedef std::shared_ptr< stop_guard_t >

An alias of shared_ptr for stop_guard.

Since
v.5.5.19.2

◆ subscription_storage_factory_t

Type of subscription_storage factory.

Since
v.5.5.3

◆ timer_manager_factory_t

Type of factory for creating timer_manager objects.

Since
v.5.5.19

◆ timer_manager_unique_ptr_t

using so_5::timer_manager_unique_ptr_t = typedef std::unique_ptr< timer_manager_t >

Auxiliary typedef for timer_manager autopointer.

Since
v.5.5.19

◆ timer_thread_factory_t

Type of factory for creating timer_thread objects.

Since
v.5.5.0

◆ timer_thread_unique_ptr_t

using so_5::timer_thread_unique_ptr_t = typedef std::unique_ptr< timer_thread_t >

Auxiliary typedef for timer_thread autopointer.

Enumeration Type Documentation

◆ delivery_possibility_t

Result of checking delivery posibility.

Since
v.5.5.9
Enumerator
must_be_delivered 
no_subscription 
disabled_by_delivery_filter 
hidden_by_envelope 

The actual message is hidden by an envelope.

Since
v.5.5.23

◆ exception_reaction_t

A reaction of SObjectizer to an exception from agent event.

Since
v.5.2.3
Enumerator
abort_on_exception 

Execution of application must be aborted immediatelly.

shutdown_sobjectizer_on_exception 

Agent must be switched to special state and SObjectizer Environment will be stopped.

deregister_coop_on_exception 

Agent must be switched to special state and agent's cooperation must be deregistered.

ignore_exception 

Exception should be ignored and agent should continue its work.

inherit_exception_reaction 

Exception reaction should be inherited from SO Environment.

Since
v.5.3.0

◆ infinite_wait_indication

A type for special marker for infitite waiting on service request or on receive from mchain.

Since
v.5.5.13
Enumerator
infinite_wait 

◆ mbox_type_t

enum so_5::mbox_type_t
strong

Type of the message box.

Since
v.5.5.3
Note
This type is no more marked as deprecated.
Enumerator
multi_producer_multi_consumer 

Mbox is Multi-Producer and Multi-Consumer. Anyone can send messages to it, there can be many subscribers.

multi_producer_single_consumer 

Mbox is Multi-Producer and Single-Consumer. Anyone can send messages to it, there can be only one subscriber.

◆ message_kind_t

enum so_5::message_kind_t
strong

A enum with variants of message kinds.

Since
v.5.5.23
Enumerator
signal 

Message is a signal. It means there is no data associated with the message instance.

classical_message 

Message is a classical message. It means that message is an instance of class derived from message_t.

user_type_message 

Message is an user type message.

enveloped_msg 

Message is an envelope with some other message inside.

◆ message_mutability_t

A enum with variants of message mutability or immutability.

Since
v.5.5.19
Enumerator
immutable_message 
mutable_message 

◆ message_ownership_t

Type of ownership of a message instance inside message_holder.

This type is intended to be used as parameter for message_holder_t template.

Since
v.5.6.0
Enumerator
autodetected 

Type of ownership will be automatically detected in dependency of message mutability.

unique 

An instance of message_holder should be the unique holder of the message instance. In that case message_holder will be similar to unique_ptr.

shared 

Several instances of message_holder can own the message instance. In that case message_holder will be similar to shared_ptr.

◆ no_wait_indication

A type for special marker for no waiting on service request or on receive from mchain.

Since
v.5.5.13
Enumerator
no_wait 

◆ priority_t

enum so_5::priority_t : unsigned char
strong

Definition of supported priorities.

Since
v.5.5.8
Enumerator
p_min 
p0 
p1 
p2 
p3 
p4 
p5 
p6 
p7 
p_max 

◆ thread_safety_t

enum so_5::thread_safety_t : std::uint8_t
strong

Thread safety indicator.

Since
v.5.4.0
Enumerator
unsafe 

Not thread safe.

safe 

Thread safe.

◆ work_thread_activity_tracking_t

Values for dispatcher's work thread activity tracking.

Enumerator
unspecified 

Tracking mode is specified elsewhere.

off 

Tracking is disabled.

on 

Tracking is enabled.

Function Documentation

◆ adaptive_subscription_storage_factory() [1/2]

SO_5_FUNC subscription_storage_factory_t so_5::adaptive_subscription_storage_factory ( std::size_t  threshold)

Factory for adaptive subscription storage.

Since
v.5.5.3
Description
This storage will use vector-based storage for small amount of subscriptions. And map-based storage for large amount of subscriptions.
More about subscription storage tuning
See so-5.5.3: Subscription storage type selection for more details about selection of appropriate subscription storage type.
Parameters
thresholdThreshold for switching from small storage to the large one (and back from the large to the small in the case of subscription deletion).

◆ adaptive_subscription_storage_factory() [2/2]

SO_5_FUNC subscription_storage_factory_t so_5::adaptive_subscription_storage_factory ( std::size_t  threshold,
const subscription_storage_factory_t small_storage_factory,
const subscription_storage_factory_t large_storage_factory 
)

Factory for adaptive subscription storage.

Since
v.5.5.3
Description
This storage will use storage created by small_storage_factory for small amount of subscriptions. And storage created by large_storage_factory for large amount of subscriptions.
Cascading of storages
This function can be used for creating more complex cascades of several subscription storages. For example, the following code creates adaptive storage with three underlying objects. The first will be used for 0..10 subscriptions. The seconds will be used for 11..100 subscriptions. And the third for 100+ subscriptions:
// First threshold for switching from the first storage to the second.
10,
// First storage -- simple vector-based.
// There will be another adaptive storage.
// Second threshold for switching from the second storage to the third.
100,
// Second storage.
// Third storage.
More about subscription storage tuning
See so-5.5.3: Subscription storage type selection for more details about selection of appropriate subscription storage type.
Parameters
thresholdThreshold for switching from small storage to the large one (and back from the large to the small in the case of subscription deletion).
small_storage_factoryA factory for creating small storage.
large_storage_factoryA factory for creating large storage.

◆ add_select_cases()

template<typename... Cases>
void so_5::add_select_cases ( extensible_select_t extensible_select,
Cases &&...  cases 
)

Add a portion of cases to extensible-select instance.

Usage examples:

// Creation of extensible-select instance without initial set of cases.
so_5::from_all().handle_n(20));
// Cases should be added later.
so_5::add_select_cases(sel2, case_(ch1, ...));
case_(ch2, ...),
case_(ch3, ...));
Note
An attempt to call this function for extensible-select object that is used in some select() call will lead to an exception.
Attention
The extensible_select object must not be empty!
Since
v.5.6.1
Parameters
extensible_selectAn instance of extensible-select to be extended.
casesSelect cases.

◆ auto_close_drop_content()

template<typename... Tail>
mchain_auto_close_details::auto_closer_t< sizeof...(Tail) > so_5::auto_close_drop_content ( Tail &&...  tail)

Helper function for automatic closing of mchains with dropping their content.

Usage example:

so_5::environment_t & env = ...;
auto ch1 = create_mchain(env);
auto ch2 = create_mchain(env);
auto ch_closer = so_5::auto_close_drop_content(ch1, ch2);
...
Note
This is just a shorthand for:
Template Parameters
TailList of mchains.
Since
v.5.5.16
Examples:
so_5/mchain_select/main.cpp, and so_5/wrapped_env_demo_3/main.cpp.

◆ auto_close_mchains()

template<typename... Tail>
mchain_auto_close_details::auto_closer_t< sizeof...(Tail) > so_5::auto_close_mchains ( mchain_props::close_mode_t  close_mode,
Tail &&...  tail 
)

Helper function for creation of automatic closer of mchains.

Usage examples:

so_5::environment_t & env = ...;
auto command_ch = create_mchain( env );
auto reply_ch = create_mchain( env );
std::thread worker{ [command_ch, reply_ch] {
receive( from( command_ch ), handlers... );
} };
// Chains must be closed automatically on any exception...
// Content of chains must be dropped.
auto channels_closer = so_5::auto_close_mchains(
command_ch,
reply_ch );
... // Some complex code here.
// Close command chain for worker thread. Worker will finish its work.
close_retain_content( command_ch );
// Ensure that worker finished.
worker.join();
Since
v.5.5.16
Parameters
close_modeClose mode for all mchains. This value will be passed to all close() calls.
tailChains to be closed.

◆ auto_close_retain_content()

template<typename... Tail>
mchain_auto_close_details::auto_closer_t< sizeof...(Tail) > so_5::auto_close_retain_content ( Tail &&...  tail)

Helper function for automatic closing of mchains with retaining their content.

Usage example:

so_5::environment_t & env = ...;
auto ch1 = create_mchain(env);
auto ch2 = create_mchain(env);
auto ch_closer = so_5::auto_close_retain_content(ch1, ch2);
...
Note
This is just a shorthand for:
Template Parameters
TailList of mchains.
Since
v.5.5.16

◆ auto_join()

template<typename... Tail>
thread_auto_join_details::auto_joiner_t< 1 + sizeof...(Tail) > so_5::auto_join ( std::thread &  first_thread,
Tail &&...  tail 
)

Helper function for creation of automatic joiner of std::threads.

Usage examples:

std::thread first_worker;
std::thread second_worker;
auto worker_joiner = so_5::auto_join( first_worker, second_worker );
first_worker = thread{ ... };
second_worker = thread{ ... };
...
Since
v.5.5.16
Parameters
first_threadThe first thread to be closed.
tailOther threads to be closed.
Examples:
so_5/mchain_select/main.cpp, and so_5/wrapped_env_demo_3/main.cpp.

◆ case_()

template<typename... Handlers>
mchain_props::select_case_unique_ptr_t so_5::case_ ( mchain_t  chain,
Handlers &&...  handlers 
)

A helper for creation of select_case object for one multi chain select.

Attention
It is an error if there are more than one handler for the same message type in handlers.
See also
so_5::select()
Since
v.5.5.16
Parameters
chainMessage chain to be used in select.
handlersMessage handlers for messages extracted from that chain.
Examples:
so_5/mchain_select/main.cpp.

◆ close_drop_content()

void so_5::close_drop_content ( const mchain_t ch)
inline

Helper function for closing a message chain with dropping all its content.

Since
v.5.5.13
Note
Because of ADL it can be used without specifying namespaces.
Usage example.
so_5::mchain_t & ch = ...;
... // Some work with chain.
// Or:
Examples:
so_5/mchain_handler_formats/main.cpp, and so_5/mchain_select/main.cpp.

◆ close_retain_content()

void so_5::close_retain_content ( const mchain_t ch)
inline

Helper function for closing a message chain with retaining all its content.

Since
v.5.5.13
Note
Because of ADL it can be used without specifying namespaces.
Usage example.
so_5::mchain_t & ch = ...;
... // Some work with chain.
// Or:
Examples:
so_5/mchain_multi_consumers/main.cpp, and so_5/mchain_select/main.cpp.

◆ create_child_coop() [1/2]

template<typename... Args>
SO_5_NODISCARD coop_unique_holder_t so_5::create_child_coop ( agent_t owner,
Args &&...  args 
)

A simple way for creating child cooperation.

Since
v.5.5.3
Usage sample
class owner : public so_5::agent_t
{
public :
...
virtual void
so_evt_start() override
{
auto child = so_5::create_child_coop( *this );
child->make_agent< worker >();
...
so_environment().register_coop( std::move( child ) );
}
};
Parameters
ownerOwner of the cooperation.
argsArguments for the environment_t::make_coop() method.
Examples:
so_5/dispatcher_for_children/main.cpp, so_5/dispatcher_hello/main.cpp, so_5/dispatcher_restarts/main.cpp, so_5/make_pipeline/main.cpp, and so_5/ping_pong_with_owner/main.cpp.

◆ create_child_coop() [2/2]

template<typename... Args>
SO_5_NODISCARD coop_unique_holder_t so_5::create_child_coop ( coop_handle_t  parent,
Args &&...  args 
)

A simple way for creating child cooperation when there is a reference to the parent cooperation object.

Since
v.5.5.8
Usage sample
class parent final : public so_5::agent_t {
void on_some_event(mhood_t<some_message>) {
// We as the parent coop.
so_coop(),
// The default binder for the new coop.
so_environment().binder() ) );
...
so_environment().register_coop( std::move(child) );
}
...
};
Parameters
parentParent cooperation.
argsArguments for the environment_t::make_coop() method.

◆ create_mchain() [1/6]

mchain_t so_5::create_mchain ( environment_t env)
inline

◆ create_mchain() [2/6]

mchain_t so_5::create_mchain ( wrapped_env_t sobj)
inline

Create size-unlimited chain.

wrapped_env_t sobj;
auto ch = create_mchain( sobj );
// Or as more verbose alternative:
auto ch = sobj.environment().create_mchain( make_unlimited_mchain_params() );
Since
v.5.5.16

◆ create_mchain() [3/6]

mchain_t so_5::create_mchain ( environment_t env,
std::size_t  max_size,
mchain_props::memory_usage_t  memory_usage,
mchain_props::overflow_reaction_t  overflow_reaction 
)
inline

Create size-limited chain without waiting on overflow.

so_5::environment_t & env = ...;
auto ch = create_mchain( env,
// No more than 200 messages in the chain.
200,
// Memory will be allocated dynamically.
// New messages will be ignored on chain's overflow.
// Or as more verbose alternative:
// No more than 200 messages in the chain.
200,
// Memory will be allocated dynamically.
// New messages will be ignored on chain's overflow.
Since
v.5.5.16
Parameters
envEnvironment for mchain.
max_sizeMax capacity of mchain.
memory_usageType of chain storage.
overflow_reactionReaction on chain overflow.

◆ create_mchain() [4/6]

mchain_t so_5::create_mchain ( wrapped_env_t sobj,
std::size_t  max_size,
mchain_props::memory_usage_t  memory_usage,
mchain_props::overflow_reaction_t  overflow_reaction 
)
inline

Create size-limited chain without waiting on overflow.

auto ch = create_mchain( sobj,
// No more than 200 messages in the chain.
200,
// Memory will be allocated dynamically.
// New messages will be ignored on chain's overflow.
// Or as more verbose alternative:
auto ch = sobj.environment().create_mchain(
// No more than 200 messages in the chain.
200,
// Memory will be allocated dynamically.
// New messages will be ignored on chain's overflow.
Since
v.5.5.16
Parameters
sobjEnvironment for mchain.
max_sizeMax capacity of mchain.
memory_usageType of chain storage.
overflow_reactionReaction on chain overflow.

◆ create_mchain() [5/6]

mchain_t so_5::create_mchain ( environment_t env,
mchain_props::duration_t  waiting_time,
std::size_t  max_size,
mchain_props::memory_usage_t  memory_usage,
mchain_props::overflow_reaction_t  overflow_reaction 
)
inline

Create size-limited chain with waiting on overflow.

so_5::environment_t & env = ...;
auto ch = create_mchain( env,
// Wait for 150ms.
std::chrono::milliseconds{150},
// No more than 200 messages in the chain.
200,
// Memory will be allocated dynamically.
// New messages will be ignored on chain's overflow.
// Or as more verbose alternative:
// No more than 200 messages in the chain.
200,
// Memory will be allocated dynamically.
// New messages will be ignored on chain's overflow.
// Wait for 150ms.
std::chrono::milliseconds{150} ) );
Since
v.5.5.16
Parameters
envEnvironment for mchain.
waiting_timeMax waiting time in case of overflow.
max_sizeMax capacity of mchain.
memory_usageType of chain storage.
overflow_reactionReaction on chain overflow.

◆ create_mchain() [6/6]

mchain_t so_5::create_mchain ( wrapped_env_t sobj,
mchain_props::duration_t  waiting_time,
std::size_t  max_size,
mchain_props::memory_usage_t  memory_usage,
mchain_props::overflow_reaction_t  overflow_reaction 
)
inline

Create size-limited chain without waiting on overflow.

auto ch = create_mchain( sobj,
// Wait for 150ms.
std::chrono::milliseconds{150},
// No more than 200 messages in the chain.
200,
// Memory will be allocated dynamically.
// New messages will be ignored on chain's overflow.
// Or as more verbose alternative:
auto ch = sobj.environment().create_mchain(
// No more than 200 messages in the chain.
200,
// Memory will be allocated dynamically.
// New messages will be ignored on chain's overflow.
// Wait for 150ms.
std::chrono::milliseconds{150} ) );
Since
v.5.5.16
Parameters
sobjEnvironment for mchain.
waiting_timeMax waiting time in case of overflow.
max_sizeMax capacity of mchain.
memory_usageType of chain storage.
overflow_reactionReaction on chain overflow.

◆ create_std_event_exception_logger()

SO_5_FUNC event_exception_logger_unique_ptr_t so_5::create_std_event_exception_logger ( )

Create the default exception logger.

◆ create_stderr_logger()

SO_5_FUNC error_logger_shptr_t so_5::create_stderr_logger ( )

A factory for creating error_logger implemenation which uses std::stderr as log stream.

Since
v.5.5.0

◆ create_timer_heap_manager() [1/2]

Create timer manager based on timer_heap mechanism.

Since
v.5.5.0
Note
Default parameters will be used for timer manager.
Parameters
loggerA logger for handling error messages inside timer_manager.
collectorA collector for elapsed timers.

◆ create_timer_heap_manager() [2/2]

SO_5_FUNC timer_manager_unique_ptr_t so_5::create_timer_heap_manager ( error_logger_shptr_t  logger,
outliving_reference_t< timer_manager_t::elapsed_timers_collector_t collector,
std::size_t  initial_heap_capacity 
)

Create timer manager based on timer_heap mechanism.

Since
v.5.5.0
Note
Parameters must be specified explicitely.
Parameters
loggerA logger for handling error messages inside timer_manager.
collectorA collector for elapsed timers.
initial_heap_capacityInitical capacity of heap array.

◆ create_timer_heap_thread() [1/2]

SO_5_FUNC timer_thread_unique_ptr_t so_5::create_timer_heap_thread ( error_logger_shptr_t  logger)

Create timer thread based on timer_heap mechanism.

Since
v.5.5.0
Note
Default parameters will be used for timer thread.
Parameters
loggerA logger for handling error messages inside timer_thread.

◆ create_timer_heap_thread() [2/2]

SO_5_FUNC timer_thread_unique_ptr_t so_5::create_timer_heap_thread ( error_logger_shptr_t  logger,
std::size_t  initial_heap_capacity 
)

Create timer thread based on timer_heap mechanism.

Since
v.5.5.0
Note
Parameters must be specified explicitely.
Parameters
loggerA logger for handling error messages inside timer_thread.
initial_heap_capacityInitical capacity of heap array.

◆ create_timer_list_manager()

Create timer thread based on timer_list mechanism.

Since
v.5.5.0
Parameters
loggerA logger for handling error messages inside timer_manager.
collectorA collector for elapsed timers.

◆ create_timer_list_thread()

SO_5_FUNC timer_thread_unique_ptr_t so_5::create_timer_list_thread ( error_logger_shptr_t  logger)

Create timer thread based on timer_list mechanism.

Since
v.5.5.0
Parameters
loggerA logger for handling error messages inside timer_thread.

◆ create_timer_wheel_manager() [1/2]

Create timer manager based on timer_wheel mechanism.

Note
Default parameters will be used for timer manager.
Since
v.5.5.19
Parameters
loggerA logger for handling error messages inside timer_manager.
collectorA collector for elapsed timers.

◆ create_timer_wheel_manager() [2/2]

SO_5_FUNC timer_manager_unique_ptr_t so_5::create_timer_wheel_manager ( error_logger_shptr_t  logger,
outliving_reference_t< timer_manager_t::elapsed_timers_collector_t collector,
unsigned int  wheel_size,
std::chrono::steady_clock::duration  granuality 
)

Create timer manager based on timer_wheel mechanism.

Since
v.5.5.0
Note
Parameters must be specified explicitely.
Parameters
loggerA logger for handling error messages inside timer_manager.
collectorA collector for elapsed timers.
wheel_sizeSize of the wheel.
granualityA size of one time step for the wheel.

◆ create_timer_wheel_thread() [1/2]

SO_5_FUNC timer_thread_unique_ptr_t so_5::create_timer_wheel_thread ( error_logger_shptr_t  logger)

Create timer thread based on timer_wheel mechanism.

Since
v.5.5.0
Note
Default parameters will be used for timer thread.
Parameters
loggerA logger for handling error messages inside timer_thread.

◆ create_timer_wheel_thread() [2/2]

SO_5_FUNC timer_thread_unique_ptr_t so_5::create_timer_wheel_thread ( error_logger_shptr_t  logger,
unsigned int  wheel_size,
std::chrono::steady_clock::duration  granuality 
)

Create timer thread based on timer_wheel mechanism.

Since
v.5.5.0
Note
Parameters must be specified explicitely.
Parameters
loggerA logger for handling error messages inside timer_thread.
wheel_sizeSize of the wheel.
granualityA size of one time step for the wheel.

◆ default_subscription_storage_factory()

SO_5_FUNC subscription_storage_factory_t so_5::default_subscription_storage_factory ( )

Factory for default subscription storage object.

Since
v.5.5.3
Note
Creates adaptive storage with vector-based storage for small amount of subscriptions and map-based storage for large amount of subscriptions.
More about subscription storage tuning
See so-5.5.3: Subscription storage type selection for more details about selection of appropriate subscription storage type.

◆ ensure_classical_message()

template<typename Msg >
void so_5::ensure_classical_message ( )

A special compile-time checker to guarantee that Msg is derived from message_t.

Since
v.5.5.9
Template Parameters
Msgtype to be checked.

◆ ensure_message_with_actual_data()

template<class Msg >
void so_5::ensure_message_with_actual_data ( const Msg *  m)

A special checker to guarantee that the message is an instance of the message_t (not signal_t) and has a not-null pointer to the message data.

Since
v.5.2.0
Note
A check for the inheritance from the message_t is done at compile-time.
Template Parameters
Msgmessage type to be checked.

◆ ensure_not_mutable_signal()

template<class S >
void so_5::ensure_not_mutable_signal ( )

A special compile-time checker to guarantee that S is not a mutable signal.

This check is intended to prevent usage of mutable_msg<S> where S is a signal type.

Since
v.5.5.19

◆ ensure_not_signal()

template<class Msg >
void so_5::ensure_not_signal ( )

A special compile-time checker to guarantee that the message class is not a signal class.

Since
v.5.2.0

◆ ensure_signal()

template<class Msg >
void so_5::ensure_signal ( )

A special compile-time checker to guarantee that the Msg is derived from the signal_t.

Since
v.5.2.0
Template Parameters
Msgsignal type to be checked.

◆ from()

A helper function for simplification of creation of mchain_receive_params instance.

Since
v.5.5.13
Attention
Since v.5.6.0 at least handle_all(), handle_n() or extract_n() should be called before passing result of from() to receive() function.
Usage examples:
so_5::mchain_t chain = env.create_mchain(...);
// Receive and handle 3 messages.
// If there is no 3 messages in the mchain the receive will wait infinitely.
// A return from receive will be after handling of 3 messages or
// if the mchain is closed explicitely.
receive( from(chain).handle_n( 3 ),
handlers... );
// Receive and handle 3 messages.
// If there is no 3 messages in the mchain the receive will wait
// no more that 200ms.
// A return from receive will be after handling of 3 messages or
// if the mchain is closed explicitely, or if there is no messages
// for more than 200ms.
receive( from(chain).handle_n( 3 ).empty_timeout( milliseconds(200) ),
handlers... );
// Receive all messages from the chain.
// If there is no message in the chain then wait no more than 500ms.
// A return from receive will be after explicit close of the chain
// or if there is no messages for more than 500ms.
receive( from(chain).handle_all().empty_timeout( milliseconds(500) ),
handlers... );
// Receve any number of messages from the chain but do waiting and
// handling for no more than 2s.
receive( from(chain).handle_all().total_time( seconds(2) ),
handlers... );
// Receve 1000 messages from the chain but do waiting and
// handling for no more than 2s.
receive( from(chain).extract_n( 1000 ).total_time( seconds(2) ),
handlers... );
Examples:
so_5/mchain_handler_formats/main.cpp, so_5/mchain_multi_consumers/main.cpp, so_5/mchain_select/main.cpp, so_5/producer_consumer_mchain/main.cpp, so_5/wrapped_env_demo_2/main.cpp, and so_5/wrapped_env_demo_3/main.cpp.

◆ from_all()

Helper function for creation of mchain_select_params instance with default values.

Attention
Since v.5.6.0 at least handle_all(), handle_n() or extract_n() should be called before passing result of from_all() to select() or prepare_select() functions.

Usage example:

select( so_5::from_all().handle_n(3).empty_timeout(3s), ... );
Examples:
so_5/mchain_select/main.cpp.

◆ hash_table_based_subscription_storage_factory()

SO_5_FUNC subscription_storage_factory_t so_5::hash_table_based_subscription_storage_factory ( )

Factory for default subscription storage based on std::unordered_map.

Since
v.5.5.3
Note
This storage is efficient only in the cases of very large amount of subscriptions (from several hundreds to thousands). For smaller amounts map-based and vector-based storages are more appropriate.
More about subscription storage tuning
See so-5.5.3: Subscription storage type selection for more details about selection of appropriate subscription storage type.

◆ introduce_child_coop() [1/2]

template<typename... Args>
decltype(auto) so_5::introduce_child_coop ( agent_t owner,
Args &&...  args 
)

A simple way for creating and registering child cooperation.

Since
v.5.5.5
Usage sample
class owner : public so_5::agent_t
{
public :
...
virtual void
so_evt_start() override
{
coop.make_agent< worker >();
} );
}
};
Note
This function is just a tiny wrapper around so_5::environment_t::introduce_coop() helper method. For more examples with usage of introduce_coop() please see description of that method.
Parameters
ownerOwner of the cooperation.
argsArguments for the environment_t::introduce_coop() method.
Examples:
so_5/coop_notification/main.cpp, so_5/coop_user_resources/main.cpp, so_5/dispatcher_for_children/main.cpp, so_5/parent_coop/main.cpp, so_5/prio_work_stealing/main.cpp, so_5/selective_msg_tracing/main.cpp, and so_5/wrapped_env_demo_2/main.cpp.

◆ introduce_child_coop() [2/2]

template<typename... Args>
decltype(auto) so_5::introduce_child_coop ( coop_handle_t  parent,
Args &&...  args 
)

A simple way for creating and registering child cooperation when there is a reference to parent coop.

Since
v.5.5.8
Usage sample
class owner : public so_5::agent_t
{
public :
...
virtual void
so_evt_start() override
{
so_5::introduce_child_coop( so_coop(), []( so_5::coop_t & coop ) {
coop.make_agent< worker >();
} );
}
};
Note
This function is just a tiny wrapper around so_5::environment_t::introduce_coop() helper method. For more examples with usage of introduce_coop() please see description of that method.
Parameters
parentParent cooperation.
argsArguments for the environment_t::introduce_coop() method.

◆ intrusive_ptr_t()

template<typename T >
so_5::intrusive_ptr_t ( std::unique_ptr< T >  ) -> intrusive_ptr_t< T >

Deduction rule for C++17 compiler.

Since
v.5.6.0

◆ launch() [1/2]

template<typename Init_Routine >
void so_5::launch ( Init_Routine &&  init_routine)

Launch a SObjectizer Environment with default parameters.

Example with free function as initializer:

void init( so_5::environment_t & env )
{
env.register_agent_as_coop( "main_coop", new my_agent_t( env ) );
}
int main()
{
so_5::launch( &init );
return 0;
}

Example with lambda-function as initializer:

int main()
{
{
env.register_agent_as_coop( "main_coop", new my_agent_t( env ) );
} );
return 0;
}

Example with object method as initializer:

class application_t
{
public :
void
init( so_5::environment_t & env )
{
env.register_agent_as_coop( "main_coop", new my_agent_t( env ) );
}
...
};
int main()
{
using namespace std;
using namespace std::placeholders;
application_t app;
so_5::launch( bind( &application_t::init, &app, _1 ) );
return 0;
}
Template Parameters
Init_RoutineType of initialization routine. It can be a pointer to function or functional object that accepts a reference to so_5::environment_t.
Parameters
init_routineInitialization routine.
Examples:
so_5/adv_thread_pool_fifo/main.cpp, so_5/blinking_led/main.cpp, so_5/chameneos_prealloc_msgs/main.cpp, so_5/chameneos_simple/main.cpp, so_5/chstate/main.cpp, so_5/chstate_msg_tracing/main.cpp, so_5/coop_listener/main.cpp, so_5/coop_notification/main.cpp, so_5/coop_user_resources/main.cpp, so_5/custom_error_logger/main.cpp, so_5/deadletter_handler/main.cpp, so_5/delivery_filters/main.cpp, so_5/disp/main.cpp, so_5/dispatcher_for_children/main.cpp, so_5/dispatcher_hello/main.cpp, so_5/dispatcher_restarts/main.cpp, so_5/exception_logger/main.cpp, so_5/exception_reaction/main.cpp, so_5/hardwork_imit/main.cpp, so_5/hello_all/main.cpp, so_5/hello_delay/main.cpp, so_5/hello_evt_handler/main.cpp, so_5/hello_evt_lambda/main.cpp, so_5/hello_periodic/main.cpp, so_5/hello_world/main.cpp, so_5/hello_world_simple_not_mtsafe/main.cpp, so_5/machine_control/main.cpp, so_5/make_new_direct_mbox/main.cpp, so_5/make_pipeline/main.cpp, so_5/many_timers/main.cpp, so_5/modify_resend_as_immutable/main.cpp, so_5/mutable_msg_agents/main.cpp, so_5/news_board/main.cpp, so_5/nohandler_msg_tracing/main.cpp, so_5/parent_coop/main.cpp, so_5/ping_pong/main.cpp, so_5/ping_pong_minimal/main.cpp, so_5/ping_pong_with_owner/main.cpp, so_5/prio_work_stealing/main.cpp, so_5/producer_consumer_mchain/main.cpp, so_5/queue_size_stats/main.cpp, so_5/redirect_and_transform/main.cpp, so_5/selective_msg_tracing/main.cpp, so_5/simple_message_deadline/main.cpp, so_5/stop_guard/main.cpp, so_5/subscriptions/main.cpp, and so_5/two_handlers/main.cpp.

◆ launch() [2/2]

template<typename Init_Routine , typename Params_Tuner >
void so_5::launch ( Init_Routine &&  init_routine,
Params_Tuner &&  params_tuner 
)
inline

Launch a SObjectizer Environment with explicitely specified parameters.

Example with free functions as initializers:

void init( so_5::environment_t & env )
{
"main_coop",
new my_agent_t( env ),
so_5::disp::active_obj::create_disp_binder( "active_obj" ) );
}
void params_setter( so_5::environment_params_t & params )
{
params.add_named_dispatcher( "active_obj",
so_5::disp::active_obj::create_disp() );
}
int main()
{
so_5::launch( &init, &params_setter );
return 0;
}

Example with lambda-functions as initializers:

int main()
{
[]( so_5::environment_t & env )
{
"main_coop",
new my_agent_t( env ),
so_5::disp::active_obj::create_disp_binder( "active_obj" ) );
},
{
params.add_named_dispatcher( "active_obj",
so_5::disp::active_obj::create_disp() );
} );
return 0;
}
Template Parameters
Init_RoutineType of initialization routine. It can be a pointer to function or functional object that accepts a reference to so_5::environment_t.
Params_TunerType of routine for tuning environment's parameters. It can be a pointer to function or functional object that accepts a reference to so_5::environment_params_t.
Parameters
init_routineInitialization routine.
params_tunerParameters setting routine.

◆ make_coop_dereg_notificator()

auto so_5::make_coop_dereg_notificator ( mbox_t  target)
inlinenoexcept

Create notificator about cooperation deregistration completion.

Since
v.5.2.3
Attention
Since v.5.6.0 dereg_notificators should be noexcept functions/functors. But this notificator uses so_5::send() function inside. This function can throw (for example std::bad_alloc can be raised if there is no enough memory available). It means that if so_5::send() throws inside this notificator the whole application will be aborted via std::terminate().
Parameters
targetA mbox to which msg_coop_deregistered will be sent.
Examples:
so_5/coop_notification/main.cpp, and so_5/dispatcher_restarts/main.cpp.

◆ make_coop_reg_notificator()

auto so_5::make_coop_reg_notificator ( mbox_t  target)
inlinenoexcept

Create notificator about cooperation registration completion.

Since
v.5.2.3
Attention
Since v.5.6.0 reg_notificators should be noexcept functions/functors. But this notificator uses so_5::send() function inside. This function can throw (for example std::bad_alloc can be raised if there is no enough memory available). It means that if so_5::send() throws inside this notificator the whole application will be aborted via std::terminate().
Parameters
targetA mbox to which msg_coop_registered will be sent.
Examples:
so_5/coop_notification/main.cpp.

◆ make_default_disp_binder()

disp_binder_shptr_t so_5::make_default_disp_binder ( environment_t env)
inline

Create an instance of the default dispatcher binder.

Note
This function takes into account a possibility to have different types of environment infrastructures (introduced in v.5.5.19) and creates a default dispatcher binder with respect to the actual environment infrastructure type.

Usage example:

// Agents from that coop will be bound to the default dispatcher.
[](so_5::coop_t & coop) {
coop.make_agent<...>(...);
} );
} );
Since
v.5.5.19
Examples:
so_5/ping_pong/main.cpp, so_5/producer_consumer_mchain/main.cpp, and so_5/selective_msg_tracing/main.cpp.

◆ make_defaults_manager_for_combined_locks()

SO_5_FUNC queue_locks_defaults_manager_unique_ptr_t so_5::make_defaults_manager_for_combined_locks ( )

A factory for queue_locks_defaults_manager with generators for combined locks.

Since
v.5.5.18

◆ make_defaults_manager_for_simple_locks()

SO_5_FUNC queue_locks_defaults_manager_unique_ptr_t so_5::make_defaults_manager_for_simple_locks ( )

A factory for queue_locks_defaults_manager with generators for simple locks.

Since
v.5.5.18

◆ make_empty_event_queue_hook_unique_ptr()

SO_5_NODISCARD event_queue_hook_unique_ptr_t so_5::make_empty_event_queue_hook_unique_ptr ( )
inline

Helper function for creation of empty unique_ptr for event_queue_hook.

This function allows to write:

instead of

Since
v.5.5.24

◆ make_event_queue_hook()

template<typename Hook_Type , typename... Args>
event_queue_hook_unique_ptr_t so_5::make_event_queue_hook ( event_queue_hook_deleter_fnptr_t  deleter,
Args &&...  args 
)

Helper function for simplify creation of event_queue_hook object.

This helper function allows to write:

auto hook = so_5::make_event_queue_hook<my_hook>(
...); // Some arguments for my_hook's constructor.

instead of:

new my_hook{...}, // Some arguments for my_hook's constructor.
Since
v.5.5.24

◆ make_extensible_select()

template<mchain_props::msg_count_status_t Msg_Count_Status, typename... Cases>
extensible_select_t so_5::make_extensible_select ( mchain_select_params_t< Msg_Count_Status >  params,
Cases &&...  cases 
)

Creation of extensible-select instance.

This function creates an instance of extensible-select object that can be used for subsequent calls to add_select_cases() and select().

Usage examples:

// Creation of extensible-select instance with initial set of cases.
so_5::from_all().handle_n(10),
case_(ch1, ...),
case_(ch2, ...));
// Creation of extensible-select instance without initial set of cases.
so_5::from_all().handle_n(20));
// Cases should be added later.
so_5::add_select_cases(sel2, case_(ch1, ...));
case_(ch2, ...),
case_(ch3, ...));
Since
v.5.6.1
Parameters
paramsParameters for advanced select.
casesSelect cases.

◆ make_limited_with_waiting_mchain_params()

mchain_params_t so_5::make_limited_with_waiting_mchain_params ( std::size_t  max_size,
mchain_props::memory_usage_t  memory_usage,
mchain_props::overflow_reaction_t  overflow_reaction,
mchain_props::duration_t  wait_timeout 
)
inline

Create parameters for size-limited mchain with waiting on overflow.

Since
v.5.5.13
Usage example:
so_5::environment_t & env = ...;
// No more than 200 messages in the chain.
200,
// Memory will be preallocated.
// New messages will be ignored on chain's overflow.
// But before dropping a new message there will be 500ms timeout
std::chrono::milliseconds(500) ) );
Note
Since v.5.5.18 there is an important difference in mchain behavior. If an ordinary send is used for message pushing then there will be waiting for free space if the message chain is full. But if message push is performed from timer thread (it means that message is a delayed or a periodic message) then there will not be any waiting. It is because the context of timer thread is very special: there is no possibility to spend some time on waiting for some free space in message chain. All operations on the context of timer thread must be done as fast as possible.
Parameters
max_sizeMax size of the chain.
memory_usageType of chain storage.
overflow_reactionReaction on chain overflow.
wait_timeoutWaiting time on full message chain.
Examples:
so_5/producer_consumer_mchain/main.cpp.

◆ make_limited_without_waiting_mchain_params()

mchain_params_t so_5::make_limited_without_waiting_mchain_params ( std::size_t  max_size,
mchain_props::memory_usage_t  memory_usage,
mchain_props::overflow_reaction_t  overflow_reaction 
)
inline

Create parameters for size-limited mchain without waiting on overflow.

Since
v.5.5.13
Usage example:
so_5::environment_t & env = ...;
// No more than 200 messages in the chain.
200,
// Memory will be allocated dynamically.
// New messages will be ignored on chain's overflow.
Parameters
max_sizeMax capacity of mchain.
memory_usageType of chain storage.
overflow_reactionReaction on chain overflow.

◆ make_unlimited_mchain_params()

mchain_params_t so_5::make_unlimited_mchain_params ( )
inline

Create parameters for size-unlimited mchain.

Since
v.5.5.13
Usage example:

◆ map_based_subscription_storage_factory()

SO_5_FUNC subscription_storage_factory_t so_5::map_based_subscription_storage_factory ( )

Factory for subscription storage based on std::map.

Since
v.5.5.3
Note
Uses std::map as an underlying storage. And very efficient when count of subscription in measured in dozens. For very large amount of subscriptions the hash-table-based storage is more efficient.
More about subscription storage tuning
See so-5.5.3: Subscription storage type selection for more details about selection of appropriate subscription storage type.

◆ null_current_thread_id()

current_thread_id_t so_5::null_current_thread_id ( )
inline

Get NULL thread id.

◆ null_mbox_id()

mbox_id_t so_5::null_mbox_id ( )
inline

Default value for null mbox_id.

Since
v.5.5.4.1

◆ operator+() [1/8]

template<typename Option >
agent_context_t so_5::operator+ ( environment_t env,
Option  arg 
)

A plus operator for creating agent_context object from a reference to Environment and single agent tuning option.

Since
v.5.5.4

◆ operator+() [2/8]

agent_context_t so_5::operator+ ( agent_context_t  ctx,
subscription_storage_factory_t  factory 
)
inline

◆ operator+() [3/8]

template<class M >
agent_context_t so_5::operator+ ( agent_context_t  ctx,
message_limit::drop_indicator_t< M >  limit 
)

◆ operator+() [4/8]

template<class M >
agent_context_t so_5::operator+ ( agent_context_t  ctx,
message_limit::abort_app_indicator_t< M >  limit 
)

◆ operator+() [5/8]

template<class M , class L >
agent_context_t so_5::operator+ ( agent_context_t  ctx,
message_limit::log_then_abort_app_indicator_t< M, L >  limit 
)

◆ operator+() [6/8]

template<class M , class L >
agent_context_t so_5::operator+ ( agent_context_t  ctx,
message_limit::redirect_indicator_t< M, L >  limit 
)

◆ operator+() [7/8]

template<class M >
agent_context_t so_5::operator+ ( agent_context_t  ctx,
message_limit::transform_indicator_t< M >  limit 
)

◆ operator+() [8/8]

agent_context_t so_5::operator+ ( agent_context_t  ctx,
so_5::priority_t  agent_priority 
)
inline

◆ operator>>=()

void so_5::operator>>= ( agent_t agent,
const state_t new_state 
)
inline

A shortcat for switching the agent state.

Since
v.5.5.1
Usage example.
class my_agent : public so_5::agent_t
{
const so_5::state_t st_normal = so_make_state();
const so_5::state_t st_error = so_make_state();
...
public :
virtual void so_define_agent() override
{
this >>= st_normal;
st_normal.handle( [=]( const msg_failure & evt ) {
this >>= st_error;
...
});
...
};
...
};

◆ outliving_const() [1/2]

template<typename T >
outliving_reference_t< const T > so_5::outliving_const ( T const &  r)

Make outliving_reference wrapper for const reference.

See also
outliving_reference_t
Since
v.5.5.19

◆ outliving_const() [2/2]

template<typename T >
outliving_reference_t< const T > so_5::outliving_const ( outliving_reference_t< T >  r)

Make outliving_reference wrapper for const reference.

See also
outliving_reference_t
Since
v.5.5.22

◆ outliving_mutable()

template<typename T >
outliving_reference_t< T > so_5::outliving_mutable ( T &  r)

Make outliving_reference wrapper for mutable reference.

See also
outliving_reference_t
Since
v.5.5.19

◆ prepare_receive()

template<mchain_props::msg_count_status_t Msg_Count_Status, typename... Handlers>
prepared_receive_t< sizeof...(Handlers) > so_5::prepare_receive ( const mchain_receive_params_t< Msg_Count_Status > &  params,
Handlers &&...  handlers 
)

Create parameters for receive function to be used later.

Attention
Since v.5.6.0 at least handle_all(), handle_n() or extract_n() should be called before passing result of from() to prepare_receive() function.

Accepts all parameters as advanced receive() version. For example:

// Receive and handle 3 messages.
// If there is no 3 messages in the mchain the receive will wait
// no more that 200ms.
// A return from receive will be after handling of 3 messages or
// if the mchain is closed explicitely, or if there is no messages
// for more than 200ms.
auto prepared1 = prepare_receive(
from(chain).handle_n( 3 ).empty_timeout( milliseconds(200) ),
[]( const first_message_type & msg ) { ... },
[]( const second_message_type & msg ) { ... }, ... );
// Receive all messages from the chain.
// If there is no message in the chain then wait no more than 500ms.
// A return from receive will be after explicit close of the chain
// or if there is no messages for more than 500ms.
auto prepared2 = prepare_receive(
from(chain).handle_all().empty_timeout( milliseconds(500) ),
[]( const first_message_type & msg ) { ... },
[]( const second_message_type & msg ) { ... }, ... );
Since
v.5.5.17
Parameters
paramsParameters for advanced receive.
handlersHandlers

◆ prepare_select()

template<mchain_props::msg_count_status_t Msg_Count_Status, typename... Cases>
prepared_select_t< sizeof...(Cases) > so_5::prepare_select ( mchain_select_params_t< Msg_Count_Status >  params,
Cases &&...  cases 
)

Create prepared select statement to be used later.

Attention
Since v.5.6.0 at least handle_all(), handle_n() or extract_n() should be called before passing result of from_all() to prepare_select() function.

Accepts all parameters as advanced select() version. For example:

// Receive and handle 3 messages.
// If there is no 3 messages in chains the select will wait
// no more that 200ms.
// A return from select will be after handling of 3 messages or
// if all mchains are closed explicitely, or if there is no messages
// for more than 200ms.
auto prepared1 = prepare_select(
so_5::from_all().handle_n( 3 ).empty_timeout( milliseconds(200) ),
case_( ch1,
[]( const first_message_type & msg ) { ... },
[]( const second_message_type & msg ) { ... } ),
case_( ch2,
[]( const third_message_type & msg ) { ... },
handler< some_signal_type >( []{ ... ] ),
... ) );
// Receive all messages from mchains.
// If there is no message in any of mchains then wait no more than 500ms.
// A return from select will be after explicit close of all mchains
// or if there is no messages for more than 500ms.
auto prepared2 = prepare_select(
so_5::from_all().handle_all().empty_timeout( milliseconds(500) ),
case_( ch1,
[]( const first_message_type & msg ) { ... },
[]( const second_message_type & msg ) { ... } ),
case_( ch2,
[]( const third_message_type & msg ) { ... },
handler< some_signal_type >( []{ ... ] ),
... ) );
Since
v.5.5.17
Parameters
paramsParameters for advanced select.
casesSelect cases.

◆ preprocess_agent_event_handler() [1/2]

template<typename Method_Pointer >
std::enable_if< details::is_agent_method_pointer< details::method_arity::unary, Method_Pointer>::value, details::msg_type_and_handler_pair_t >::type so_5::preprocess_agent_event_handler ( const mbox_t mbox,
agent_t agent,
Method_Pointer  pfn 
)

Do preprocessing and some verification of event handler and return msg_type_and_handler_pair for it.

This overload is intended to be used for pointers to members.

Note
Throws is handler can't be used with this type of mbox (for example: handler is for mutable message but mbox is Multi-Consumer one).
Since
v.5.5.21

◆ preprocess_agent_event_handler() [2/2]

template<typename Lambda >
std::enable_if< details::lambda_traits::is_lambda<Lambda>::value, details::msg_type_and_handler_pair_t >::type so_5::preprocess_agent_event_handler ( const mbox_t mbox,
agent_t ,
Lambda &&  lambda 
)

Do preprocessing and some verification of event handler and return msg_type_and_handler_pair for it.

This overload is intended to be used for lambdas or functional objects.

Attention
Only lambda functions or functional objects in the following format are supported:
ret_type (message_type);
ret_type (const message_type &);
ret_type (mhood_t<message_type>);
Since
v.5.5.21

◆ query_current_thread_id()

current_thread_id_t so_5::query_current_thread_id ( )
inline

Get the ID of the current thread.

Examples:
so_5/selective_msg_tracing/main.cpp.

◆ raw_id_from_current_thread_id()

std::thread::id so_5::raw_id_from_current_thread_id ( const current_thread_id_t w)
inline

Get the raw thread id from current_thread_id.

Since
v.5.5.18

◆ receive() [1/2]

template<mchain_props::msg_count_status_t Msg_Count_Status, typename... Handlers>
mchain_receive_result_t so_5::receive ( const mchain_receive_params_t< Msg_Count_Status > &  params,
Handlers &&...  handlers 
)
inline

Advanced version of receive from mchain.

Since
v.5.5.13
Attention
It is an error if there are more than one handler for the same message type in handlers.
Since v.5.6.0 at least handle_all(), handle_n() or extract_n() should be called before passing result of from() to receive() function.
Usage examples:
so_5::mchain_t chain = env.create_mchain(...);
// Receive and handle 3 messages.
// If there is no 3 messages in the mchain the receive will wait infinitely.
// A return from receive will be after handling of 3 messages or
// if the mchain is closed explicitely.
receive( from(chain).handle_n( 3 ),
[]( const first_message_type & msg ) { ... },
[]( const second_message_type & msg ) { ... }, ... );
// Receive and handle 3 messages.
// If there is no 3 messages in the mchain the receive will wait
// no more that 200ms.
// A return from receive will be after handling of 3 messages or
// if the mchain is closed explicitely, or if there is no messages
// for more than 200ms.
receive( from(chain).handle_n( 3 ).empty_timeout( milliseconds(200) ),
[]( const first_message_type & msg ) { ... },
[]( const second_message_type & msg ) { ... }, ... );
// Receive all messages from the chain.
// If there is no message in the chain then wait no more than 500ms.
// A return from receive will be after explicit close of the chain
// or if there is no messages for more than 500ms.
receive( from(chain).handle_all().empty_timeout( milliseconds(500) ),
[]( const first_message_type & msg ) { ... },
[]( const second_message_type & msg ) { ... }, ... );
// Receve any number of messages from the chain but do waiting and
// handling for no more than 2s.
receive( from(chain).handle_all().total_time( seconds(2) ),
[]( const first_message_type & msg ) { ... },
[]( const second_message_type & msg ) { ... }, ... );
// Receve 1000 messages from the chain but do waiting and
// handling for no more than 2s.
receive( from(chain).extract_n( 1000 ).total_time( seconds(2) ),
[]( const first_message_type & msg ) { ... },
[]( const second_message_type & msg ) { ... }, ... );
Handlers format examples:
// Message instance by const reference.
[]( const std::string & v ) {...},
// Message instance by value (efficient for small types like int).
[]( int v ) {...},
// Message instance via mhood_t value.
// Message instance via const reference to mhood_t.
// Explicitly specified signal handler.
so_5::handler< some_signal >( []{...} ),
// Signal handler via mhood_t value.
// Signal handler via const reference to mhood_t.
[]( const so_5::mhood_t< yet_another_signal > & ) {...} );
Parameters
paramsParameters for receive.
handlersHandlers for message processing.
Examples:
so_5/mchain_handler_formats/main.cpp, so_5/mchain_multi_consumers/main.cpp, so_5/mchain_select/main.cpp, so_5/producer_consumer_mchain/main.cpp, so_5/wrapped_env_demo_2/main.cpp, and so_5/wrapped_env_demo_3/main.cpp.

◆ receive() [2/2]

template<std::size_t Handlers_Count>
mchain_receive_result_t so_5::receive ( const prepared_receive_t< Handlers_Count > &  prepared)

A receive operation to be done on previously prepared receive params.

Usage of ordinary forms of receive() functions inside loops could be inefficient because of wasting resources on constructions of internal objects with descriptions of handlers on each receive() call. More efficient way is preparation of all receive params and reusing them later. A combination of so_5::prepare_receive() and so_5::receive(prepared_receive_t) allows to do that.

Usage example:

auto prepared = so_5::prepare_receive(
so_5::from(ch).extract_n(10).empty_timeout(200ms),
some_handlers... );
...
while( !some_condition )
{
auto r = so_5::receive( prepared );
...
}
Since
v.5.5.17

◆ select() [1/3]

template<mchain_props::msg_count_status_t Msg_Count_Status, typename... Cases>
mchain_receive_result_t so_5::select ( const mchain_select_params_t< Msg_Count_Status > &  params,
Cases &&...  cases 
)

An advanced form of multi chain select.

Attention
The behaviour is not defined if a mchain is used in different select_cases.
Since v.5.6.0 at least handle_all(), handle_n() or extract_n() should be called before passing result of from_all() to select() function.
Usage examples:
using namespace so_5;
mchain_t ch1 = env.create_mchain(...);
mchain_t ch2 = env.create_mchain(...);
// Receive and handle 3 messages.
// It could be 3 messages from ch1. Or 2 messages from ch1 and 1 message
// from ch2. Or 1 message from ch1 and 2 messages from ch2. And so on...
//
// If there is no 3 messages in mchains the select will wait infinitely.
// A return from select will be after handling of 3 messages or
// if all mchains are closed explicitely.
select( from_all().handle_n( 3 ),
case_( ch1,
[]( const first_message_type & msg ) { ... },
[]( const second_message_type & msg ) { ... } ),
case_( ch2,
[]( const third_message_type & msg ) { ... },
handler< some_signal_type >( []{ ... ] ),
... ) );
// Receive and handle 3 messages.
// If there is no 3 messages in chains the select will wait
// no more that 200ms.
// A return from select will be after handling of 3 messages or
// if all mchains are closed explicitely, or if there is no messages
// for more than 200ms.
select( from_all().handle_n( 3 ).empty_timeout( milliseconds(200) ),
case_( ch1,
[]( const first_message_type & msg ) { ... },
[]( const second_message_type & msg ) { ... } ),
case_( ch2,
[]( const third_message_type & msg ) { ... },
handler< some_signal_type >( []{ ... ] ),
... ) );
// Receive all messages from mchains.
// If there is no message in any of mchains then wait no more than 500ms.
// A return from select will be after explicit close of all mchains
// or if there is no messages for more than 500ms.
select( from_all().handle_all().empty_timeout( milliseconds(500) ),
case_( ch1,
[]( const first_message_type & msg ) { ... },
[]( const second_message_type & msg ) { ... } ),
case_( ch2,
[]( const third_message_type & msg ) { ... },
handler< some_signal_type >( []{ ... ] ),
... ) );
// Receve any number of messages from mchains but do waiting and
// handling for no more than 2s.
select( from_all().handle_all().total_time( seconds(2) ),
case_( ch1,
[]( const first_message_type & msg ) { ... },
[]( const second_message_type & msg ) { ... } ),
case_( ch2,
[]( const third_message_type & msg ) { ... },
handler< some_signal_type >( []{ ... ] ),
... ) );
// Receve 1000 messages from chains but do waiting and
// handling for no more than 2s.
select( from_all().extract_n( 1000 ).total_time( seconds(2) ),
case_( ch1,
[]( const first_message_type & msg ) { ... },
[]( const second_message_type & msg ) { ... } ),
case_( ch2,
[]( const third_message_type & msg ) { ... },
handler< some_signal_type >( []{ ... ] ),
... ) );
Since
v.5.5.16
Parameters
paramsParameters for advanced select.
casesSelect cases.
Examples:
so_5/mchain_select/main.cpp.

◆ select() [2/3]

template<std::size_t Cases_Count>
mchain_receive_result_t so_5::select ( const prepared_select_t< Cases_Count > &  prepared)

A select operation to be done on previously prepared select params.

Usage of ordinary forms of select() functions inside loops could be inefficient because of wasting resources on constructions of internal objects with descriptions of select cases on each select() call. More efficient way is preparation of all select params and reusing them later. A combination of so_5::prepare_select() and so_5::select(prepared_select_t) allows to do that.

Usage example:

auto prepared = so_5::prepare_select(
so_5::from_all().extract_n(10).empty_timeout(200ms),
case_( ch1, some_handlers... ),
case_( ch2, more_handlers... ),
case_( ch3, yet_more_handlers... ) );
...
while( !some_condition )
{
auto r = so_5::select( prepared );
...
}
Attention
Since v.5.6.1 there is a check for usage of prepared-select object in parallel/nested calls to select(). If such call detected then an exception is thrown.
Since
v.5.5.17

◆ select() [3/3]

mchain_receive_result_t so_5::select ( const extensible_select_t extensible_select)
inline

A select operation to be done on previously prepared extensible-select object.

Usage example:

void handle_messages_from(const std::vector<so_5::mchain_t> & chains) {
auto sel = so_5::make_extensible_select(so_5::from_all().handle_all());
for(auto & ch : chains)
auto r = so_5::select(sel);
... // Handing of the select() result.
}
Note
An attempt to call this function for extensible-select object that is used in some select() call will lead to an exception.
Attention
The extensible_select object must not be empty!
Since
v.5.6.1

◆ send() [1/4]

template<typename Message , typename Target , typename... Args>
void so_5::send ( Target &&  to,
Args &&...  args 
)

A utility function for creating and delivering a message or a signal.

Since
v.5.5.1
Note
Since v.5.5.13 can send also a signal.
Template Parameters
Messagetype of message to be sent.
Targetidentification of request processor. Could be reference to so_5::mbox_t, to so_5::agent_t (the later case agent's direct mbox will be used).
Argsarguments for Message's constructor.
Usage samples:
struct hello_msg { std::string greeting; std::string who };
// Send to mbox.
so_5::send< hello_msg >( env.create_mbox( "hello" ), "Hello", "World!" );
// Send to agent.
class demo_agent : public so_5::agent_t
{
public :
...
virtual void so_evt_start() override
{
...
so_5::send< hello_msg >( *this, "Hello", "World!" );
}
};
struct turn_on : public so_5::signal_t {};
// Send to mbox.
so_5::send< turn_on >( env.create_mbox( "engine" ) );
// Send to agent.
class engine_agent : public so_5::agent_t
{
public :
...
virtual void so_evt_start() override
{
...
so_5::send< turn_on >( *this );
}
};
Examples:
so_5/chameneos_prealloc_msgs/main.cpp, so_5/make_pipeline/main.cpp, so_5/modify_resend_as_immutable/main.cpp, so_5/mutable_msg_agents/main.cpp, so_5/prio_work_stealing/main.cpp, and so_5/simple_message_deadline/main.cpp.

◆ send() [2/4]

template<typename Target , typename Message >
std::enable_if< !is_signal< Message >::value >::type so_5::send ( Target &&  to,
mhood_t< Message >  what 
)

A version of send function for redirection of a message from exising message hood.

Template Parameters
Messagea type of message to be redirected (it can be in form of Msg, so_5::immutable_msg<Msg> or so_5::mutable_msg<Msg>).

Usage example:

class redirector : public so_5::agent_t {
...
void on_some_immutable_message(mhood_t<first_msg> cmd) {
so_5::send(another_mbox, cmd);
...
}
void on_some_mutable_message(mhood_t<mutable_msg<second_msg>> cmd) {
so_5::send(another_mbox, std::move(cmd));
// Note: cmd is nullptr now, it can't be used anymore.
...
}
};
Since
v.5.5.19

◆ send() [3/4]

template<typename Target , typename Message >
std::enable_if< is_signal< Message >::value >::type so_5::send ( Target &&  to,
mhood_t< Message >   
)

A version of send function for redirection of a signal from exising message hood.

Template Parameters
Messagea type of signal to be redirected (it can be in form of Sig or so_5::immutable_msg<Sig>).

Usage example:

class redirector : public so_5::agent_t {
...
void on_some_immutable_signal(mhood_t<some_signal> cmd) {
so_5::send(another_mbox, cmd);
...
}
};
Since
v.5.5.19

◆ send() [4/4]

template<typename Target , typename Message , message_ownership_t Ownership>
void so_5::send ( Target &&  to,
message_holder_t< Message, Ownership >  what 
)

A version of send function for redirection of a message from exising message_holder instance.

Usage example:

class preallocated_messages_owner final : public so_5::agent_t {
...
void on_some_event(mhood_t<some_event>) {
// It is time to send preallocated messages.
// This message will be sent as immutable message.
so_5::send(dest, first_);
// This message will be sent as mutable message.
so_5::send(dest, std::move(second_));
}
};
Attention
An attempt to call this function for empty message_holder object is UB.
Since
v.5.6.0
Parameters
toDestination for the message.
whatMessage to be sent.

◆ send_delayed() [1/4]

template<typename Message , typename Target , typename... Args>
void so_5::send_delayed ( Target &&  target,
std::chrono::steady_clock::duration  pause,
Args &&...  args 
)

A utility function for creating and delivering a delayed message to the specified destination.

Agent or mchain can be used as target.

Attention
Value of pause should be non-negative.
Template Parameters
Messagetype of message or signal to be sent.
Targetcan be so_5::agent_t or so_5::mchain_t.
Argslist of arguments for Message's constructor.
Since
v.5.5.19
Parameters
targetA target for delayed message.
pausePause for message delaying.
argsMessage constructor parameters.

◆ send_delayed() [2/4]

template<typename Target , typename Message >
std::enable_if< !message_payload_type<Message>::is_signal >::type so_5::send_delayed ( Target &&  to,
std::chrono::steady_clock::duration  pause,
mhood_t< Message >  msg 
)

A utility function for delayed redirection of a message from existing message hood.

Template Parameters
Targeta type of destination of the message. It can be an agent, a mbox or mchain.
Messagea type of message to be redirected (it can be in form of Msg, so_5::immutable_msg<Msg> or so_5::mutable_msg<Msg>).

Usage example:

class redirector : public so_5::agent_t {
...
void on_some_immutable_message(mhood_t<first_msg> cmd) {
so_5::send_delayed(another_mbox, std::chrono::seconds(1), cmd);
...
}
void on_some_mutable_message(mhood_t<mutable_msg<second_msg>> cmd) {
so_5::send_delayed(another_mbox, std::chrono::seconds(1), std::move(cmd));
// Note: cmd is nullptr now, it can't be used anymore.
...
}
};

A redirection to the direct mbox of some agent can looks like:

void some_agent::on_some_message(mhood_t<some_message> cmd) {
// Redirect to itself but with a pause.
so_5::send_delayed(*this, std::chrono::seconds(2), cmd);
}
// For the case of mutable message.
void another_agent::on_another_msg(mutable_mhood_t<another_msg> cmd) {
// Redirect to itself but with a pause.
so_5::send_delayed(*this, std::chrono::seconds(2), std::move(cmd));
// Note: cmd is nullptr now, it can't be used anymore.
}

A redirection to a mchain can looks like:

so_5::mchain_t first = ...;
so_5::mchain_t second = ...;
so_5::receive(so_5::from(first).handle_n(1),
so_5::send_delayed(second, std::chrono::seconds(1), cmd);
},
so_5::send_delayed(second, std::chrono::seconds(1), std::move(cmd));
// Note: cmd is nullptr now, it can't be used anymore.
});
Attention
Value of pause should be non-negative.
Since
v.5.5.19
Parameters
toDestination for the message.
pausePause for message delaying.
msgMessage instance owner.

◆ send_delayed() [3/4]

template<typename Target , typename Message >
std::enable_if< message_payload_type<Message>::is_signal >::type so_5::send_delayed ( Target &&  to,
std::chrono::steady_clock::duration  pause,
mhood_t< Message >   
)

A utility function for delayed redirection of a signal from existing message hood.

Template Parameters
Targeta type of destination of the signal. It can be an agent, a mbox or mchain.
Messagea type of signal to be redirected (it can be in form of Sig or so_5::immutable_msg<Sig>).

Usage example:

class redirector : public so_5::agent_t {
...
void on_some_immutable_signal(mhood_t<some_signal> cmd) {
so_5::send_delayed(another_mbox, std::chrono::seconds(1), cmd);
...
}
};

A redirection to the direct mbox of some agent can looks like:

void some_agent::on_some_signal(mhood_t<some_signal> cmd) {
// Redirect to itself but with a pause.
so_5::send_delayed(*this, std::chrono::seconds(2), cmd);
}

A redirection to a mchain can looks like:

so_5::mchain_t first = ...;
so_5::mchain_t second = ...;
so_5::receive(so_5::from(first).handle_n(1),
so_5::send_delayed(second, std::chrono::seconds(1), cmd);
});
Attention
Value of pause should be non-negative.
Since
v.5.5.19
Parameters
toDestination for the message.
pausePause for message delaying.

◆ send_delayed() [4/4]

template<typename Target , typename Message , message_ownership_t Ownership>
void so_5::send_delayed ( Target &&  to,
std::chrono::steady_clock::duration  pause,
message_holder_t< Message, Ownership >  msg 
)

A version of send_delayed function for redirection of a message from exising message_holder instance.

Usage example:

class preallocated_messages_owner final : public so_5::agent_t {
...
void on_some_event(mhood_t<some_event>) {
// It is time to send preallocated messages.
// This message will be sent as immutable message.
so_5::send_delayed(dest, 15s, first_);
// This message will be sent as mutable message.
so_5::send_delayed(dest, 15s, std::move(second_));
}
};
Attention
An attempt to call this function for empty message_holder object is UB.
Since
v.5.6.0
Parameters
toDestination for the message.
pausePause for message delaying.
msgMessage to be sent

◆ send_periodic() [1/4]

template<typename Message , typename Target , typename... Args>
SO_5_NODISCARD timer_id_t so_5::send_periodic ( Target &&  target,
std::chrono::steady_clock::duration  pause,
std::chrono::steady_clock::duration  period,
Args &&...  args 
)

A utility function for creating and delivering a periodic message to the specified destination.

Agent or mchain can be used as target.

Note
Message chains with overload control must be used for periodic messages with additional care: so-5.5.18: Overloaded mchains and delayed/periodic messages delivery.
Attention
Values of pause and period should be non-negative.
Template Parameters
Messagetype of message or signal to be sent.
Targetcan be so_5::agent_t or so_5::mchain_t.
Argslist of arguments for Message's constructor.
Since
v.5.5.19
Parameters
targetA destination for the periodic message.
pausePause for message delaying.
periodPeriod of message repetitions.
argsMessage constructor parameters.

◆ send_periodic() [2/4]

template<typename Target , typename Message >
SO_5_NODISCARD std::enable_if< !is_signal< Message >::value, timer_id_t >::type so_5::send_periodic ( Target &&  target,
std::chrono::steady_clock::duration  pause,
std::chrono::steady_clock::duration  period,
mhood_t< Message >  mhood 
)

A utility function for delivering a periodic from an existing message hood.

Attention
Message must not be a mutable message if period is not 0. Otherwise an exception will be thrown.
Template Parameters
Targeta type of destination of the message. It can be an agent, a mbox or mchain.
Messagea type of message to be redirected (it can be in form of Msg, so_5::immutable_msg<Msg> or so_5::mutable_msg<Msg>).

Usage example:

class redirector : public so_5::agent_t {
...
void on_some_immutable_message(mhood_t<first_msg> cmd) {
timer_id = so_5::send_periodic(another_mbox,
std::chrono::seconds(1),
std::chrono::seconds(15),
cmd);
...
}
void on_some_mutable_message(mhood_t<mutable_msg<second_msg>> cmd) {
timer_id = so_5::send_periodic(another_mbox,
std::chrono::seconds(1),
std::chrono::seconds::zero(), // Note: period is 0!
std::move(cmd));
// Note: cmd is nullptr now, it can't be used anymore.
...
}
};

A redirection to the direct mbox of some agent can looks like:

void some_agent::on_some_message(mhood_t<some_message> cmd) {
// Redirect to itself but with a pause and a period.
timer_id = so_5::send_periodic(*this,
std::chrono::seconds(2),
std::chrono::seconds(5),
cmd);
}

A redirection to a mchain can looks like:

so_5::mchain_t first = ...;
so_5::mchain_t second = ...;
so_5::receive(so_5::from(first).handle_n(1),
timer_id = so_5::send_periodic(
second,
std::chrono::seconds(2),
std::chrono::seconds(5),
cmd);
});
Note
Message chains with overload control must be used for periodic messages with additional care: so-5.5.18: Overloaded mchains and delayed/periodic messages delivery.
Attention
Values of pause and period should be non-negative.
Since
v.5.5.19
Parameters
targetA destination for the periodic message.
pausePause for message delaying.
periodPeriod of message repetitions.
mhoodExisting message hood for message to be sent.

◆ send_periodic() [3/4]

template<typename Target , typename Message >
SO_5_NODISCARD std::enable_if< is_signal< Message >::value, timer_id_t >::type so_5::send_periodic ( Target &&  target,
std::chrono::steady_clock::duration  pause,
std::chrono::steady_clock::duration  period,
mhood_t< Message >   
)

A utility function for periodic redirection of a signal from existing message hood.

Template Parameters
Targeta type of destination of the signal. It can be an agent, a mbox or mchain.
Messagea type of signal to be redirected (it can be in form of Sig or so_5::immutable_msg<Sig>).

Usage example:

class redirector : public so_5::agent_t {
...
void on_some_immutable_signal(mhood_t<some_signal> cmd) {
timer_id = so_5::send_periodic(another_mbox,
std::chrono::seconds(1),
std::chrono::seconds(10),
cmd);
...
}
};

A redirection to the direct mbox of some agent can looks like:

void some_agent::on_some_message(mhood_t<some_signal> cmd) {
// Redirect to itself but with a pause and a period.
timer_id = so_5::send_periodic(*this,
std::chrono::seconds(2),
std::chrono::seconds(5),
cmd);
}

A redirection to a mchain can looks like:

so_5::mchain_t first = ...;
so_5::mchain_t second = ...;
so_5::receive(so_5::from(first).handle_n(1),
timer_id = so_5::send_periodic(
second,
std::chrono::seconds(2),
std::chrono::seconds(5),
cmd);
});
Note
Message chains with overload control must be used for periodic messages with additional care: so-5.5.18: Overloaded mchains and delayed/periodic messages delivery.
Attention
Values of pause and period should be non-negative.
Since
v.5.5.19
Parameters
targetA destination for the periodic message.
pausePause for message delaying.
periodPeriod of message repetitions.

◆ send_periodic() [4/4]

template<typename Target , typename Message , message_ownership_t Ownership>
SO_5_NODISCARD timer_id_t so_5::send_periodic ( Target &&  target,
std::chrono::steady_clock::duration  pause,
std::chrono::steady_clock::duration  period,
message_holder_t< Message, Ownership >  what 
)

A version of send_periodic function for redirection of a message from exising message_holder instance.

Note
Note that an attempt to call with function with non-zero period argument for a mutable messages will lead to an exception. It is because mutable message can't be sent as periodic message.

Usage example:

class preallocated_messages_owner final : public so_5::agent_t {
so_5::timer_id_t msg_timer_;
...
void on_some_event(mhood_t<some_event>) {
// It is time to send preallocated message.
// This message will be sent as immutable message.
msg_timer_ = so_5::send_periodic(dest, 15s, 20s, msg_);
}
};
Attention
An attempt to call this function for empty message_holder object is UB.
Since
v.5.6.0
Parameters
targetA destination for the periodic message.
pausePause for message delaying.
periodPeriod of message repetitions.
whatMessage to be sent.

◆ swap()

SO_5_FUNC void so_5::swap ( environment_params_t a,
environment_params_t b 
)
Since
v.5.2.3

◆ timer_heap_factory() [1/2]

timer_thread_factory_t so_5::timer_heap_factory ( )
inline

Factory for timer_heap thread with default parameters.

Since
v.5.5.0
Examples:
so_5/many_timers/main.cpp.

◆ timer_heap_factory() [2/2]

timer_thread_factory_t so_5::timer_heap_factory ( std::size_t  initial_heap_capacity)
inline

Factory for timer_heap thread with explicitely specified parameters.

Since
v.5.5.0
Parameters
initial_heap_capacityInitial capacity of heap array.

◆ timer_heap_manager_factory() [1/2]

timer_manager_factory_t so_5::timer_heap_manager_factory ( )
inline

Factory for timer_heap manager with default parameters.

Since
v.5.5.0

◆ timer_heap_manager_factory() [2/2]

timer_manager_factory_t so_5::timer_heap_manager_factory ( std::size_t  initial_heap_capacity)
inline

Factory for timer_heap manager with explicitely specified parameters.

Since
v.5.5.0
Parameters
initial_heap_capacityInitial capacity of heap array.

◆ timer_list_factory()

timer_thread_factory_t so_5::timer_list_factory ( )
inline

Factory for timer_list thread with default parameters.

Since
v.5.5.0
Examples:
so_5/many_timers/main.cpp.

◆ timer_list_manager_factory()

timer_manager_factory_t so_5::timer_list_manager_factory ( )
inline

Factory for timer_list manager with default parameters.

Since
v.5.5.0

◆ timer_wheel_factory() [1/2]

timer_thread_factory_t so_5::timer_wheel_factory ( )
inline

Factory for timer_wheel thread with default parameters.

Since
v.5.5.0
Examples:
so_5/many_timers/main.cpp.

◆ timer_wheel_factory() [2/2]

timer_thread_factory_t so_5::timer_wheel_factory ( unsigned int  wheel_size,
std::chrono::steady_clock::duration  granularity 
)
inline

Factory for timer_wheel thread with explicitely specified parameters.

Since
v.5.5.0
Parameters
wheel_sizeSize of the wheel.
granularityA size of one time step for the wheel.

◆ timer_wheel_manager_factory() [1/2]

timer_manager_factory_t so_5::timer_wheel_manager_factory ( )
inline

Factory for timer_wheel manager with default parameters.

Since
v.5.5.0

◆ timer_wheel_manager_factory() [2/2]

timer_manager_factory_t so_5::timer_wheel_manager_factory ( unsigned int  wheel_size,
std::chrono::steady_clock::duration  granularity 
)
inline

Factory for timer_wheel manager with explicitely specified parameters.

Since
v.5.5.0
Parameters
wheel_sizeSize of the wheel.
granularityA size of one time step for the wheel.

◆ to_immutable() [1/2]

template<typename M >
std::enable_if< !is_signal<M>::value, mhood_t< immutable_msg< M > > >::type so_5::to_immutable ( mhood_t< mutable_msg< M > >  msg)

Transform mutable message instance into immutable.

Attention
Moves all content from msg into new object and leaves msg object in nullptr state.

Usage example:

void on_hello_mut( mhood_t< so_5::mutable_msg< hello > > cmd )
{
cmd->m_content = "bye";
send( another_mbox, to_immutable( std::move(cmd) ) );
}
Since
v.5.5.19
Examples:
so_5/modify_resend_as_immutable/main.cpp.

◆ to_immutable() [2/2]

template<typename M >
std::enable_if< is_signal<M>::value, mhood_t< immutable_msg< M > > >::type so_5::to_immutable ( mhood_t< mutable_msg< M > >  )

◆ to_priority_t()

priority_t so_5::to_priority_t ( std::size_t  v)
inline

Helper function for conversion from size_t to priority.

Since
v.5.5.8
Exceptions
std::invalid_argumentif v is out of range.
Examples:
so_5/prio_work_stealing/main.cpp.

◆ to_size_t()

std::size_t so_5::to_size_t ( priority_t  priority)
inline

Helper function for conversion from priority to size_t.

Since
v.5.5.8
Examples:
so_5/prio_work_stealing/main.cpp.

◆ vector_based_subscription_storage_factory()

SO_5_FUNC subscription_storage_factory_t so_5::vector_based_subscription_storage_factory ( std::size_t  initial_capacity)

Factory for subscription storage based on std::vector.

Since
v.5.5.3
Note
Uses very simple working scheme: all subscriptions are stored in the linear vector and simpliest linear search is used for seaching and manipulating of subscriptions. Because of that vector-based storage must be used only with very small amount of subscriptions.
More about subscription storage tuning
See so-5.5.3: Subscription storage type selection for more details about selection of appropriate subscription storage type.
Parameters
initial_capacityInitial storage capacity.

Variable Documentation

◆ infinite_wait

const infinite_wait_indication so_5::infinite_wait
Initial value:
=
const infinite_wait_indication infinite_wait
A special indicator for infinite waiting on service request or on receive from mchain.
Definition: wait_indication.hpp:33

A special indicator for infinite waiting on service request or on receive from mchain.

Since
v.5.5.13

◆ no_wait

const no_wait_indication so_5::no_wait = no_wait_indication::no_wait

A special indicator for no waiting on service request or on receive from mchain.

Since
v.5.5.13

◆ not_thread_safe

const thread_safety_t so_5::not_thread_safe = thread_safety_t::unsafe

Shorthand for thread unsafety indicator.

Since
v.5.4.0

◆ rc_agent_has_no_cooperation

const int so_5::rc_agent_has_no_cooperation = 14

Agent is not bound to a cooperation.

◆ rc_agent_incompatible_type_conversion

const int so_5::rc_agent_incompatible_type_conversion = 15

It is impossible to make a cast to that type.

◆ rc_agent_is_already_bind_to_disp

const int so_5::rc_agent_is_already_bind_to_disp = 12

Agent is already bound to the dispatcher.

◆ rc_agent_is_already_bind_to_env

const int so_5::rc_agent_is_already_bind_to_env = 11

Agent is already bound to the SObjectizer Environment.

◆ rc_agent_is_not_the_state_owner

const int so_5::rc_agent_is_not_the_state_owner = 43

Agent doesn't own this state.

◆ rc_agent_to_disp_binding_failed

const int so_5::rc_agent_to_disp_binding_failed = 27

Binding of agent to dispatcher failed.

Since
v.5.4.0

◆ rc_agent_unknown_state

const int so_5::rc_agent_unknown_state = 10

Trying to switch to the unknown state.

◆ rc_another_state_switch_in_progress

const int so_5::rc_another_state_switch_in_progress = 170

An attempt to switch agent state when another switch operation is in progress.

Since
v.5.5.18

◆ rc_attempt_to_cast_to_envelope_on_nullptr

const int so_5::rc_attempt_to_cast_to_envelope_on_nullptr = 180

An attempt to cast message to message envelope when a pointer to message is NULL.

Envelopes were introduced in v.5.5.23. Envelopes are sent and delivered as ordinary messages (it means that pointer to envelope will be sent as pointer to message_t). For processing of an envelope it is necessary to cast a pointer from message_t to envelope_t. But it is impossible if a pointer to message_t is null.

Since
v.5.5.23

◆ rc_autoshutdown_must_be_enabled

const int so_5::rc_autoshutdown_must_be_enabled = 171

An attempt to launch environment with autoshutdown disabled in conditions where autoshutdown must be enabled.

For example so_5::env_infrastructures::simple_not_mtsafe requires autoshutdown feature.

Since
v.5.5.19

◆ rc_cannot_set_stop_guard_when_stop_is_started

const int so_5::rc_cannot_set_stop_guard_when_stop_is_started = 175

An attempt to set up a new stop_guard when the stop operation is already in progress.

Since
v.5.5.19.2

◆ rc_coop_already_destroyed

const int so_5::rc_coop_already_destroyed = 184

An attempt to get a pointer to already destroyed cooperation.

This error can be reported when a coop_handle instance for already destroyed coop is used.

Since
v.5.6.0

◆ rc_coop_define_agent_failed

const int so_5::rc_coop_define_agent_failed = 24

Cooperation couldn't be registered.

◆ rc_coop_has_not_found_among_registered_coop

const int so_5::rc_coop_has_not_found_among_registered_coop = 23

There is no registered cooperation with that name.

◆ rc_coop_has_references_to_null_agents_or_binders

const int so_5::rc_coop_has_references_to_null_agents_or_binders = 22

Cooperation has the null reference to an agent or dispatcher binding.

◆ rc_coop_is_not_in_registered_state

const int so_5::rc_coop_is_not_in_registered_state = 185

An attempt to do something with coop that is not in registered state.

For example if can be an attempt to add a new child coop when the parent coop is being deregistered.

Since
v.5.6.0

◆ rc_coop_with_specified_name_is_already_registered

const int so_5::rc_coop_with_specified_name_is_already_registered = 21

Cooperation name is not unique.

◆ rc_delivery_filter_cannot_be_used_on_mpsc_mbox

const int so_5::rc_delivery_filter_cannot_be_used_on_mpsc_mbox = 89

Delivery filter is not applicable to MPSC-mboxes.

Since
v.5.5.5

◆ rc_disp_cannot_be_added

const int so_5::rc_disp_cannot_be_added = 34

New dispatcher cannot be added because of illegal state of SObjectizer Environment.

Since
v.5.4.0

◆ rc_disp_create_failed

const int so_5::rc_disp_create_failed = 31

Unable to create a dispatcher.

◆ rc_disp_start_failed

const int so_5::rc_disp_start_failed = 30

Unable to start a dispatcher.

◆ rc_disp_type_mismatch

const int so_5::rc_disp_type_mismatch = 32

The expected type of dispatcher and the actual type of the agent dispatcher are not the same.

◆ rc_empty_name

const int so_5::rc_empty_name = 500

The empty name doesn't allowed.

◆ rc_environment_error

const int so_5::rc_environment_error = 1

so_environment launch is failed.

◆ rc_event_handler_match_error

const int so_5::rc_event_handler_match_error = 42

Unable to deregister that handler.

There is a handler for the event/mbox/state, but it is another handler. Not the one is specified for the deregistration.

◆ rc_evt_handler_already_provided

const int so_5::rc_evt_handler_already_provided = 40

A handler for that event/mbox/state is already registered.

◆ rc_extensible_select_is_active_now

const int so_5::rc_extensible_select_is_active_now = 187

An attempt to modify or activate extensible-select when an operation on that extensible-select object is already active.

Since
v.5.6.1

◆ rc_illegal_subscriber_for_mpsc_mbox

const int so_5::rc_illegal_subscriber_for_mpsc_mbox = 47

An attempt to create illegal subscription to mpsc_mbox.

Since
v.5.4.0

◆ rc_initial_substate_already_defined

const int so_5::rc_initial_substate_already_defined = 19

Initial substate for a composite state is already defined.

Since
v.5.5.15

◆ rc_intercept_handler_already_provided

const int so_5::rc_intercept_handler_already_provided = 44

An interceptor for the event/mbox/state is already registered.

◆ rc_interception_handler_match_error

const int so_5::rc_interception_handler_match_error = 46

Unable to deregister this interceptor.

There is an interceptor for the event/mbox/state, but it is another handler. Not the one is specified for the deregistration.

◆ rc_invalid_time_limit_for_state

const int so_5::rc_invalid_time_limit_for_state = 501

Invalid value of time limit for an agent's state.

Since
v.5.5.15

◆ rc_layer_does_not_exist

const int so_5::rc_layer_does_not_exist = 105

A layer with the specified type doesn't exist.

◆ rc_layer_not_binded_to_so_env

const int so_5::rc_layer_not_binded_to_so_env = 100

The layer is not bound to the SObjectizer Environment.

◆ rc_mbox_duplicating_name

const int so_5::rc_mbox_duplicating_name = 80

The mbox name is not unique.

◆ rc_mbox_unable_to_find_mbox

const int so_5::rc_mbox_unable_to_find_mbox = 81

The name of mbox is unknown.

◆ rc_message_has_no_limit_defined

const int so_5::rc_message_has_no_limit_defined = 48

An attempt to create subscription to message without predefined limit for that message type.

Since
v.5.5.4

◆ rc_more_than_one_svc_handler

const int so_5::rc_more_than_one_svc_handler = 84

There are more then one handler for service request.

Since
v.5.3.0

◆ rc_msg_chain_doesnt_support_delivery_filters

const int so_5::rc_msg_chain_doesnt_support_delivery_filters = 163

Attempt to set delivery_filter for message chain.

◆ rc_msg_chain_doesnt_support_subscriptions

const int so_5::rc_msg_chain_doesnt_support_subscriptions = 162

Attempt to make subscription for message chain.

◆ rc_msg_chain_is_empty

const int so_5::rc_msg_chain_is_empty = 160

Attempt to get message from empty message queue.

◆ rc_msg_chain_is_full

const int so_5::rc_msg_chain_is_full = 161

Attempt to push a message to full message queue.

◆ rc_msg_chain_overflow

const int so_5::rc_msg_chain_overflow = 164

Attempt to added a message to full message chain when throw_exception overflow reaction is used.

◆ rc_msg_service_request_bad_cast

const int so_5::rc_msg_service_request_bad_cast = 87

Unable to cast service call description object to the appropriate type.

Since
v.5.3.0

This error is possible when type of service request doesn't match actual type of request handler. For example:

// Actual service type.
int a_some_svc_t::evt_query_state( mhood_t< msg_query_state > )
{ ... }
// Service request call with wrong return type.
mbox.get_one< std::string >().wait_forever().sync_get<msg_query_state>();

◆ rc_msg_tracing_disabled

const int so_5::rc_msg_tracing_disabled = 140

Message delivery tracing is disabled and cannot be used.

◆ rc_mutable_msg_cannot_be_delivered_via_mpmc_mbox

const int so_5::rc_mutable_msg_cannot_be_delivered_via_mpmc_mbox = 172

An attempt to deliver mutable message via MPMC mbox.

Since
v.5.5.19

◆ rc_mutable_msg_cannot_be_periodic

const int so_5::rc_mutable_msg_cannot_be_periodic = 173

An attempt to send mutable message as a periodic message.

Since
v.5.5.19

◆ rc_named_disp_not_found

const int so_5::rc_named_disp_not_found = 13

Dispatcher with that name is not found.

◆ rc_negative_value_for_pause

const int so_5::rc_negative_value_for_pause = 176

An attempt to use negative value for pause argument for delayed or periodic message/signal.

A value of pause argument for so_5::send_delayed() and so_5::send_periodic() must be non-negative.

Since
v.5.5.21

◆ rc_negative_value_for_period

const int so_5::rc_negative_value_for_period = 177

An attempt to use negative value for period argument for periodic message/signal.

A value of pause argument for so_5::send_periodic() must be non-negative.

Since
v.5.5.21

◆ rc_no_event_handler_provided

const int so_5::rc_no_event_handler_provided = 41

A handler for that event/mbox/state is not registered and cannot be deregistered.

◆ rc_no_initial_substate

const int so_5::rc_no_initial_substate = 17

An attempt to change agent state to a new composite state which have no initial state defined.

Since
v.5.5.15

◆ rc_no_interception_handler_provided

const int so_5::rc_no_interception_handler_provided = 45

An interceptor for the event/mbox/state is not registered and cannot be deregistered.

◆ rc_no_svc_handlers

const int so_5::rc_no_svc_handlers = 83

No handlers for service request found.

Since
v.5.3.0

◆ rc_not_implemented

const int so_5::rc_not_implemented = 502

Feature or method has no implementation yet.

Since
v.5.5.16

◆ rc_null_message_data

const int so_5::rc_null_message_data = 82

Null message data.

Since
v.5.2.0

An attempt to deliver message_t by nullptr pointer to it is an error. A signal should be used for this.

◆ rc_operation_enabled_only_on_agent_working_thread

const int so_5::rc_operation_enabled_only_on_agent_working_thread = 16

An attempt to perform an operation which is enabled only on agent's working thread.

Since
v.5.4.0

◆ rc_prepared_select_is_active_now

const int so_5::rc_prepared_select_is_active_now = 188

An attempt to activate prepared-select when an operation on that prepared-select object is already active.

Since
v.5.6.1

◆ rc_priority_quote_illegal_value

const int so_5::rc_priority_quote_illegal_value = 120

Illegal value of quote for a priority.

◆ rc_scenario_must_be_completed

const int so_5::rc_scenario_must_be_completed = 182

Testing scenario must be completed before an attempt to do the current operation.

Since
v.5.5.24

◆ rc_several_handlers_for_one_message_type

const int so_5::rc_several_handlers_for_one_message_type = 165

Attempt to define several handlers for one msg_type.

◆ rc_several_limits_for_one_message_type

const int so_5::rc_several_limits_for_one_message_type = 49

An attempt to define several limits for one message type.

Since
v.5.5.4

◆ rc_state_nesting_is_too_deep

const int so_5::rc_state_nesting_is_too_deep = 18

Nesting of agent states is too deep.

Since
v.5.5.15

◆ rc_stored_state_name_not_found

const int so_5::rc_stored_state_name_not_found = 183

There is no stored state name in the testing scenario.

Since
v.5.5.24

◆ rc_subscription_to_mutable_msg_from_mpmc_mbox

const int so_5::rc_subscription_to_mutable_msg_from_mpmc_mbox = 174

An attempt to make subscription on mutable message from MPMC mbox.

Delivery of mutable messages via MPMC mboxes is prohibited.

Since
v.5.5.19

◆ rc_svc_not_handled

const int so_5::rc_svc_not_handled = 85

Service request has not been handled. Service handler is disabled in the current agent state.

Since
v.5.3.0

◆ rc_svc_request_cannot_be_transfomred_on_overlimit

const int so_5::rc_svc_request_cannot_be_transfomred_on_overlimit = 88

Unable to transform service request as part of overlimit reaction.

Since
v.5.5.4.

◆ rc_svc_result_not_received_yet

const int so_5::rc_svc_result_not_received_yet = 86

Service request result has not beed received yet.

Since
v.5.3.0

◆ rc_transfer_to_state_loop

const int so_5::rc_transfer_to_state_loop = 178

A loop in transfer_to_state detected.

There could be a case when usage of transfer_to_state leads to a loop. For a very simple example:

class a_two_state_loop_t final : public so_5::agent_t
{
state_t st_one{ this, "one" };
state_t st_two{ this, "two" };
struct message {};
public :
a_two_state_loop_t(context_t ctx) : so_5::agent_t{ctx} {
this >>= st_one;
st_one.transfer_to_state<message>(st_two);
st_two.transfer_to_state<message>(st_one);
}
virtual void so_evt_start() override {
so_5::send<message>(*this);
}
};

Since v.5.5.22.1 an attempt to handle message in the example above will lead to an exception with this error code.

Note that there could be more tricky examples when hierarchical states are used:

class a_hsm_case_t final : public so_5::agent_t
{
state_t st_base{ this, "base" };
state_t st_disconnected{ initial_substate_of{st_base}, "disconnected" };
state_t st_connected{ substate_of{st_base}, "connected" };
struct message {};
public :
a_hsm_case_t(context_t ctx) : so_5::agent_t{ctx} {
this >>= st_base;
st_base.transfer_to_state<message>(st_disconnected);
}
virtual void so_evt_start() override {
so_5::send<message>(*this);
}
};
Since
v.5.5.22.1

◆ rc_trying_to_add_extra_layer_that_already_exists_in_default_list

const int so_5::rc_trying_to_add_extra_layer_that_already_exists_in_default_list = 102

The layer is already bound to the SObjectizer Environment as a default layer.

◆ rc_trying_to_add_extra_layer_that_already_exists_in_extra_list

const int so_5::rc_trying_to_add_extra_layer_that_already_exists_in_extra_list = 103

The layer is already bound to the SObjectizer Environment as an extra layer.

◆ rc_trying_to_add_nullptr_extra_layer

const int so_5::rc_trying_to_add_nullptr_extra_layer = 101

Unable to bind a layer by the null pointer to it.

◆ rc_unable_to_define_new_step

const int so_5::rc_unable_to_define_new_step = 181

New step can't be defined if testing scenario is already started or finished.

Since
v.5.5.24

◆ rc_unable_to_join_thread_by_itself

const int so_5::rc_unable_to_join_thread_by_itself = 186

An attempt to call join() from the joinable thread itself.

Since
v.5.6.0

◆ rc_unable_to_register_coop_during_shutdown

const int so_5::rc_unable_to_register_coop_during_shutdown = 28

It is impossible to register cooperation during SObjectizer Environment shutdown.

Since
v.5.4.0.1

◆ rc_unable_to_schedule_timer_act

const int so_5::rc_unable_to_schedule_timer_act = 90

Unable to schedule a timer event.

◆ rc_unable_to_start_extra_layer

const int so_5::rc_unable_to_start_extra_layer = 104

Layer initialization is failed.

◆ rc_unexpected_error

const int so_5::rc_unexpected_error = 0xFFFFFF

Unclassified error.

◆ rc_unknown_exception_type

const int so_5::rc_unknown_exception_type = 503

An exception of unknown type is caught.

SObjectizer expects that all exceptions are derived from std::exception class.

Since
v.5.5.24.3

◆ rc_zero_ptr_to_coop

const int so_5::rc_zero_ptr_to_coop = 20

A zero pointer is detected.

◆ thread_safe

const thread_safety_t so_5::thread_safe = thread_safety_t::safe

Shorthand for thread safety indicator.

Since
v.5.4.0
Examples:
so_5/adv_thread_pool_fifo/main.cpp, and so_5/hardwork_imit/main.cpp.