SObjectizer 5.8
Loading...
Searching...
No Matches
so_5::impl Namespace Reference

Details of SObjectizer run-time implementations. More...

Namespaces

namespace  adaptive_subscr_storage
 An adaptive storage for agent's subscriptions information.
 
namespace  agent_core_details
 Implementation details related to cooperations and agents repository.
 
namespace  agent_impl
 Internal namespace with details of agent_t implementation.
 
namespace  anonymous_namespace{coop.cpp}
 
namespace  anonymous_namespace{coop_repository_basis.cpp}
 
namespace  anonymous_namespace{mbox_core.cpp}
 
namespace  anonymous_namespace{mpsc_mbox.hpp}
 
namespace  anonymous_namespace{process_unhandled_exception.cpp}
 
namespace  coop_dereg
 Details of cooperation deregistration implementation.
 
namespace  description_preparation_details
 
namespace  flat_set_based_subscr_storage
 A flat-set storage for agent's subscriptions information.
 
namespace  hash_table_subscr_storage
 A hash_table-based storage for agent's subscriptions information.
 
namespace  local_mbox_details
 Implementation details for MPMC mboxes.
 
namespace  map_based_subscr_storage
 A map-based storage for agent's subscriptions information.
 
namespace  msg_tracing_helpers
 Various helpers for message delivery tracing mechanism.
 
namespace  push_event_impl
 
namespace  subscription_storage_common
 Common stuff for various subscription storage implementations.
 
namespace  transformed_message_impl
 
namespace  vector_based_subscr_storage
 A vector-based storage for agent's subscriptions information.
 

Classes

class  coop_impl_t
 An internal class with real implementation of coop's logic. More...
 
class  coop_private_iface_t
 A special class for accessing private members of agent_coop. More...
 
class  coop_repository_basis_t
 A basic part for various implementations of coop_repository. More...
 
class  delivery_filter_storage_t
 Storage for message delivery filters. More...
 
struct  event_handler_data_t
 Information about event_handler and its properties. More...
 
class  final_dereg_chain_holder_t
 Helper class for holding the current chain of coops for the final deregistration. More...
 
class  fixed_sinks_storage_t
 A fixed-capacity storage for message sinks with message limits for one agent. More...
 
struct  full_named_mbox_id_t
 Full name for a named mbox. More...
 
class  growable_sinks_storage_t
 A storage of growable capacity for message limits for one agent. More...
 
struct  instantiator_and_sender
 
struct  instantiator_and_sender_base
 
struct  instantiator_and_sender_base< Message, true >
 
class  internal_agent_iface_t
 A special class for access to private/protected members of agent class. More...
 
class  internal_env_iface_t
 A helper class for accessing the functionality of environment-class which is specific for SObjectizer internals only. More...
 
class  layer_core_t
 An utility class for working with layers. More...
 
class  limitful_mpsc_mbox_mixin_t
 Mixin to be used in implementation of MPSC mbox with message limits. More...
 
class  limitless_mpsc_mbox_mixin_t
 Mixin to be used in implementation of MPSC mbox without message limits. More...
 
class  local_mbox_template
 A template with implementation of local mbox. More...
 
struct  mbox_core_stats_t
 Statistics from mbox_core for run-time monitoring. More...
 
class  mbox_core_t
 A utility class for the work with mboxes. More...
 
class  mbox_iface_for_timers_t
 Helper class for accessing protected members from mbox interface. More...
 
class  message_sink_for_agent_t
 A base class for message sinks to be used by agents. More...
 
class  message_sink_with_message_limit_t
 Implementation of message_sink that handles message limits. More...
 
class  message_sink_without_message_limit_t
 Implementation of message_sink that has no message limits. More...
 
class  message_sinks_with_limits_holder_t
 Type that holds message_sink_with_message_limit objects. More...
 
class  mpsc_mbox_template_t
 A multi-producer/single-consumer mbox definition. More...
 
struct  msink_less_comparator_t
 Helper class to be used as a comparator for msinks. More...
 
class  named_local_mbox_t
 A class for the named local mbox. More...
 
class  sinks_storage_t
 An interface for storage of message_sinks for one agent. More...
 
class  so_quick_environment_t
 Auxiliary class for the SObjectizer launching. More...
 
class  state_listener_controller_t
 
class  state_switch_guard_t
 
class  stop_guard_repository_t
 Repository of stop_guards. More...
 
class  storage_without_limits_t
 Implementation of message sink storage for a case when message limits are not used. More...
 
class  subscription_storage_t
 An interface of subscription storage. More...
 
struct  typed_layer_ref_t
 A special wrapper to store a layer with its type. More...
 

Typedefs

using subscription_storage_unique_ptr_t
 Typedef for unique pointer to subscription_storage object.
 
using internal_state_listener_unique_ptr_t
 Name of unique-ptr to be used inside SObjectizer.
 
using mbox_core_ref_t = intrusive_ptr_t< mbox_core_t >
 Smart reference to the mbox_core_t.
 
using so_layer_list_t = std::vector< typed_layer_ref_t >
 Typedef for typed_layer_ret container.
 
using local_mbox_without_tracing
 Alias for local mbox without message delivery tracing.
 
using local_mbox_with_tracing
 Alias for local mbox with message delivery tracing.
 
using ordinary_mpsc_mbox_without_tracing_t
 Alias for mpsc_mbox without message delivery tracing.
 
using ordinary_mpsc_mbox_with_tracing_t
 Alias for mpsc_mbox with message delivery tracing.
 
using limitless_mpsc_mbox_without_tracing_t
 Alias for mpsc_mbox without message delivery tracing that ignores message limits.
 
using limitless_mpsc_mbox_with_tracing_t
 Alias for mpsc_mbox with message delivery tracing that ignores message limits.
 

Functions

so_5::disp::mpsc_queue_traits::lock_factory_t default_lock_factory (environment_t &env, const so_5::disp::mpsc_queue_traits::lock_factory_t &)
 Helper function to be used for extraction of lock_factory for MPSC queues.
 
so_5::disp::mpmc_queue_traits::lock_factory_t default_lock_factory (environment_t &env, const so_5::disp::mpmc_queue_traits::lock_factory_t &)
 Helper function to be used for extraction of lock_factory for MPSC queues.
 
template<typename Init_Fn >
void wrap_init_fn_call (Init_Fn init_fn)
 A special wrapper for calling init function.
 
void process_unhandled_exception (current_thread_id_t working_thread_id, const std::exception &ex, agent_t &a_exception_producer) noexcept
 Processor of unhandled exception from agent's event handler.
 
void process_unhandled_unknown_exception (current_thread_id_t working_thread_id, agent_t &a_exception_producer) noexcept
 Processor of unhandled exception of unknown type from agent's event handler.
 
static std::unique_ptr< sinks_storage_tcreate_sinks_storage_if_necessary (partially_constructed_agent_ptr_t owner_ptr, so_5::message_limit::description_container_t &&descriptions)
 Create info_storage object if there are some message limits.
 
bool special_agent_ptr_compare (const agent_t &a, const agent_t &b) noexcept
 A special comparison for agent pointers with respect to agent's priorities.
 
void ensure_join_from_different_thread (current_thread_id_t thread_to_be_joined)
 Ensures that join will be called from different thread.
 
bool operator< (const full_named_mbox_id_t &a, const full_named_mbox_id_t &b)
 
std::string default_global_mbox_namespace ()
 Helper function that returns name of the default global namespace for named mboxes.
 
template<typename Init_Fn , typename Deinit_Fn , typename Next_Stage >
void run_stage (const std::string &stage_name, Init_Fn &&init_fn, Deinit_Fn &&deinit_fn, Next_Stage &&next_stage)
 Helper template function for doing initialization phase with rollback on failure.
 
so_layer_list_t::const_iterator search_for_layer (const so_layer_list_t &layers, const std::type_index &type)
 Find layer in container.
 
void call_shutdown (typed_layer_ref_t &tl)
 
void call_wait (typed_layer_ref_t &tl)
 
template<typename Q , typename... A>
mchain_t make_mchain (outliving_reference_t< so_5::msg_tracing::holder_t > tracer, const mchain_params_t &params, A &&... args)
 Helper function for creation of a new mchain with respect to message tracing.
 
void process_final_dereg_chain (coop_shptr_t head) noexcept
 Helper function that does proceesing of final dereg chain.
 

Detailed Description

Details of SObjectizer run-time implementations.

Typedef Documentation

◆ internal_state_listener_unique_ptr_t

Initial value:
std::unique_ptr<
agent_state_listener_t,
void (*)(agent_state_listener_t *) >

Name of unique-ptr to be used inside SObjectizer.

Internal unique-ptr to agent_state_listener_t should have a custom deleter. It allows to use the same unique_ptr for destroyable and non-destroyable listeners.

Since
v.5.6.0

Definition at line 84 of file agent_state_listener.hpp.

◆ limitless_mpsc_mbox_with_tracing_t

Initial value:
mpsc_mbox_template_t<
msg_tracing_helpers::tracing_enabled_base,
limitless_mpsc_mbox_mixin_t
>

Alias for mpsc_mbox with message delivery tracing that ignores message limits.

Since
v.5.8.0

Definition at line 517 of file mpsc_mbox.hpp.

◆ limitless_mpsc_mbox_without_tracing_t

Initial value:
mpsc_mbox_template_t<
msg_tracing_helpers::tracing_disabled_base,
limitless_mpsc_mbox_mixin_t
>

Alias for mpsc_mbox without message delivery tracing that ignores message limits.

Since
v.5.8.0

Definition at line 505 of file mpsc_mbox.hpp.

◆ local_mbox_with_tracing

Initial value:
local_mbox_template< msg_tracing_helpers::tracing_enabled_base >

Alias for local mbox with message delivery tracing.

Since
v.5.5.9

Definition at line 941 of file local_mbox.hpp.

◆ local_mbox_without_tracing

Initial value:
local_mbox_template< msg_tracing_helpers::tracing_disabled_base >

Alias for local mbox without message delivery tracing.

Since
v.5.5.9

Definition at line 932 of file local_mbox.hpp.

◆ mbox_core_ref_t

Smart reference to the mbox_core_t.

Note
It was a separate class until v.5.8.0. Since v.5.8.0 it's just a typedef for intrusive_ptr_t.

Definition at line 315 of file mbox_core.hpp.

◆ ordinary_mpsc_mbox_with_tracing_t

Initial value:
mpsc_mbox_template_t<
msg_tracing_helpers::tracing_enabled_base,
limitful_mpsc_mbox_mixin_t
>

Alias for mpsc_mbox with message delivery tracing.

Since
v.5.5.9, v.5.7.4, v.5.8.0

Definition at line 493 of file mpsc_mbox.hpp.

◆ ordinary_mpsc_mbox_without_tracing_t

Initial value:
mpsc_mbox_template_t<
msg_tracing_helpers::tracing_disabled_base,
limitful_mpsc_mbox_mixin_t
>

Alias for mpsc_mbox without message delivery tracing.

Since
v.5.5.9, v.5.7.4, v.5.8.0

Definition at line 482 of file mpsc_mbox.hpp.

◆ so_layer_list_t

Typedef for typed_layer_ret container.

Definition at line 54 of file layer_core.hpp.

◆ subscription_storage_unique_ptr_t

Initial value:
std::unique_ptr< subscription_storage_t >

Typedef for unique pointer to subscription_storage object.

Since
v.5.5.3

Definition at line 36 of file subscription_storage_fwd.hpp.

Function Documentation

◆ call_shutdown()

void so_5::impl::call_shutdown ( typed_layer_ref_t & tl)

Definition at line 218 of file layer_core.cpp.

◆ call_wait()

void so_5::impl::call_wait ( typed_layer_ref_t & tl)

Definition at line 223 of file layer_core.cpp.

◆ create_sinks_storage_if_necessary()

static std::unique_ptr< sinks_storage_t > so_5::impl::create_sinks_storage_if_necessary ( partially_constructed_agent_ptr_t owner_ptr,
so_5::message_limit::description_container_t && descriptions )
inlinestaticnodiscard

Create info_storage object if there are some message limits.

Definition at line 362 of file std_message_sinks.hpp.

◆ default_global_mbox_namespace()

std::string so_5::impl::default_global_mbox_namespace ( )
inlinenodiscard

Helper function that returns name of the default global namespace for named mboxes.

Note
This default global namespace has empty name in the current version of SObjectizer.
Since
v.5.8.0

Definition at line 119 of file mbox_core.hpp.

◆ default_lock_factory() [1/2]

so_5::disp::mpmc_queue_traits::lock_factory_t so_5::impl::default_lock_factory ( environment_t & env,
const so_5::disp::mpmc_queue_traits::lock_factory_t &  )
inline

Helper function to be used for extraction of lock_factory for MPSC queues.

Note
Intended to be used in template code:
template< typename Disp_Params >
auto
safe_get_lock_factory( so_5::environment_t & env, Disp_Params & params )
{
auto lf = params.queue_params().lock_factory();
if( !lf )
return lf;
}
SObjectizer Environment.
so_5::disp::mpsc_queue_traits::lock_factory_t default_lock_factory(environment_t &env, const so_5::disp::mpsc_queue_traits::lock_factory_t &)
Helper function to be used for extraction of lock_factory for MPSC queues.
A call to default_lock_factory() will return appropriate lock_factory for MPSC or MPMC queues.
Since
v.5.5.18

Definition at line 229 of file internal_env_iface.hpp.

◆ default_lock_factory() [2/2]

Helper function to be used for extraction of lock_factory for MPSC queues.

Note
Intended to be used in template code:
template< typename Disp_Params >
auto
safe_get_lock_factory( so_5::environment_t & env, Disp_Params & params )
{
auto lf = params.queue_params().lock_factory();
if( !lf )
return lf;
}
A call to default_lock_factory() will return appropriate lock_factory for MPSC or MPMC queues.
Since
v.5.5.18

Definition at line 200 of file internal_env_iface.hpp.

◆ ensure_join_from_different_thread()

void so_5::impl::ensure_join_from_different_thread ( current_thread_id_t thread_to_be_joined)
inline

Ensures that join will be called from different thread.

It's a mistake if thread::join() is called from the context of thread to be joined. Unfortunately, different implementations of stdlib work differently. There can be an exception. Or there can be deadlock, or there can be memory damage.

It is better to check for that error manually and throw an exception if the error is detected.

Since
v.5.6.0

Definition at line 41 of file thread_join_stuff.hpp.

◆ make_mchain()

template<typename Q , typename... A>
mchain_t so_5::impl::make_mchain ( outliving_reference_t< so_5::msg_tracing::holder_t > tracer,
const mchain_params_t & params,
A &&... args )
nodiscard

Helper function for creation of a new mchain with respect to message tracing.

This function was in mbox_core.cpp file until v.5.7.0 and is placed in a separate header file in v.5.7.0.

Template Parameters
Qtype of demand queue to be used for new mchain.
Atype of arguments for mchain_template constructor.

Definition at line 36 of file make_mchain.hpp.

◆ operator<()

bool so_5::impl::operator< ( const full_named_mbox_id_t & a,
const full_named_mbox_id_t & b )
inlinenodiscard

Definition at line 95 of file mbox_core.hpp.

◆ process_final_dereg_chain()

void so_5::impl::process_final_dereg_chain ( coop_shptr_t head)
inlinenoexcept

Helper function that does proceesing of final dereg chain.

Usage example:

...
holder.append(coop);
...
holder.append(coop);
...
process_final_dereg_chain(holder.giveout_current_chain());
Helper class for holding the current chain of coops for the final deregistration.
Since
v.5.8.0

Definition at line 173 of file final_dereg_chain_helpers.hpp.

◆ process_unhandled_exception()

void so_5::impl::process_unhandled_exception ( current_thread_id_t working_thread_id,
const std::exception & ex,
agent_t & a_exception_producer )
noexcept

Processor of unhandled exception from agent's event handler.

Since
v.5.4.0
Note
This function is noexcept since v.5.6.2.
Parameters
working_thread_idID of working thread for the problematic agent. NULL thread id means that agent is multithreadded. For such cases only subset of exception_reaction is allowed (ignore_exception, abort_on_exception).
exRaised and caught exception.
a_exception_producerAgent who is the producer of the exception.

Definition at line 131 of file process_unhandled_exception.cpp.

◆ process_unhandled_unknown_exception()

void so_5::impl::process_unhandled_unknown_exception ( current_thread_id_t working_thread_id,
agent_t & a_exception_producer )
noexcept

Processor of unhandled exception of unknown type from agent's event handler.

Since
v.5.5.24.3
Note
This function will be called from catch(...) and because of that there is no actual exception object.
Parameters
working_thread_idID of working thread for the problematic agent. NULL thread id means that agent is multithreadded. For such cases only subset of exception_reaction is allowed (ignore_exception, abort_on_exception).
a_exception_producerAgent who is the producer of the exception.

Definition at line 231 of file process_unhandled_exception.cpp.

◆ run_stage()

template<typename Init_Fn , typename Deinit_Fn , typename Next_Stage >
void so_5::impl::run_stage ( const std::string & stage_name,
Init_Fn && init_fn,
Deinit_Fn && deinit_fn,
Next_Stage && next_stage )

Helper template function for doing initialization phase with rollback on failure.

Since
v.5.5.19

Definition at line 31 of file run_stage.hpp.

◆ search_for_layer()

so_layer_list_t::const_iterator so_5::impl::search_for_layer ( const so_layer_list_t & layers,
const std::type_index & type )
inline

Find layer in container.

Definition at line 74 of file layer_core.cpp.

◆ special_agent_ptr_compare()

bool so_5::impl::special_agent_ptr_compare ( const agent_t & a,
const agent_t & b )
inlinenodiscardnoexcept

A special comparison for agent pointers with respect to agent's priorities.

Return values
trueif a is less than b.
Since
v.5.5.8

Definition at line 32 of file agent_ptr_compare.hpp.

◆ wrap_init_fn_call()

template<typename Init_Fn >
void so_5::impl::wrap_init_fn_call ( Init_Fn init_fn)

A special wrapper for calling init function.

This wrapper calls init function and catch exception. If an exception is derived from std::exception it will be rethrown. If an exception is caught by catch(...) statement then an instance of so_5::exception_t will be thrown instead of caught exception.

Since
v.5.5.24.3

Definition at line 252 of file internal_env_iface.hpp.