2
3
6
7
8
9
10
11
15#include <so_5/agent.hpp>
17#include <so_5/ret_code.hpp>
27
28
29
30
31
32
33class internal_agent_iface_t
final
61
62
63
64
65
66
67
68
75 "m_agent.m_disp_binder is not nullptr when "
76 "set_disp_binder is called" );
82
83
84
85
86
87
88
89
97 "m_agent.m_disp_binder is nullptr when "
98 "query_disp_binder is called" );
104
105
106
107
108
109
110
111
112
113
114
115
void so_initiate_agent_definition()
A correct initiation of so_define_agent method call.
void shutdown_agent() noexcept
Agent shutdown deriver.
disp_binder_shptr_t m_disp_binder
Binder for this agent.
void bind_to_coop(coop_t &coop)
Bind agent to the cooperation.
Container for cooperation deregistration notificators.
std::vector< coop_dereg_notificator_t > m_notificators
void call_all(environment_t &env, const coop_handle_t &coop, const coop_dereg_reason_t &reason) const noexcept
Call all notificators.
It's a kind of strong typedef for coop's deregistration reason.
Type of smart handle for a cooperation.
Container for cooperation registration notificators.
void call_all(environment_t &env, const coop_handle_t &coop) const noexcept
Call all notificators.
std::vector< coop_reg_notificator_t > m_notificators
coop_shptr_t m_first_child
The head of list of children coops.
environment_t & environment() const noexcept
Access to SO Environment for which cooperation is bound.
registration_status_t m_registration_status
The registration status of cooperation.
void decrement_usage_count() noexcept
Decrement usage count for the coop.
exception_reaction_t exception_reaction() const noexcept
Get the current exception rection flag for that cooperation.
resource_deleter_vector_t m_resource_deleters
Container of user resource deleters.
disp_binder_shptr_t m_coop_disp_binder
Default agent to the dispatcher binder.
void deregister(int reason) noexcept
Deregister the cooperation with the specified reason.
void for_each_child(Lambda &&lambda) const
A helper method for doing some actions with children coops.
exception_reaction_t m_exception_reaction
A reaction to non-handled exception.
std::mutex m_lock
A lock for synchonization of some operations on coop.
coop_handle_t m_parent
Parent coop.
registration_status_t
Registration status.
@ deregistration_in_final_stage
Deregistration of the coop is in the final stage.
@ coop_registered
Cooperation is registered.
@ coop_deregistering
Cooperation is in deregistration process.
atomic_counter_t m_reference_count
Count for entities.
void remove_child(coop_t &child) noexcept
Remove a child from the parent coop.
coop_dereg_reason_t m_dereg_reason
Deregistration reason.
void increment_usage_count() noexcept
Increment usage count for the coop.
coop_reg_notificators_container_ref_t m_reg_notificators
Notificators for registration event.
coop_shptr_t m_prev_sibling
The previous coop in sibling's chain.
void add_child(coop_shptr_t child)
Add a new child to the parent coop.
agent_array_t m_agent_array
Cooperation agents.
outliving_reference_t< environment_t > m_env
SObjectizer Environment for which cooperation is created.
coop_dereg_notificators_container_ref_t m_dereg_notificators
Notificators for deregistration event.
coop_shptr_t m_next_sibling
The next coop in sibling's chain.
Interface for dispatcher binders.
virtual void bind(agent_t &agent) noexcept=0
Bind agent to dispatcher.
virtual void unbind(agent_t &agent) noexcept=0
Unbind agent from dispatcher.
virtual void preallocate_resources(agent_t &agent)=0
Allocate resources in dispatcher for new agent.
virtual void undo_preallocation(agent_t &agent) noexcept=0
Undo resources allocation.
exception_reaction_t exception_reaction() const noexcept
An exception reaction for the whole SO Environment.
The base class for all SObjectizer exceptions.
An internal class with real implementation of coop's logic.
static void destroy_content(coop_t &coop) noexcept
Perform all necessary cleanup actions for coop.
static void do_add_agent(coop_t &coop, agent_ref_t agent_ref, disp_binder_shptr_t disp_binder)
Add agent to the cooperation with the dispatcher binding.
static void do_final_deregistration_actions(coop_t &coop)
Perform final deregistration actions for an coop.
static void do_add_child(coop_t &parent, coop_shptr_t child)
Perform addition of a new child coop.
static void add_dereg_notificator(coop_t &coop, coop_dereg_notificator_t notificator)
Add notificator about cooperation deregistration event.
static exception_reaction_t exception_reaction(const coop_t &coop) noexcept
Get exception reaction for coop.
static void do_remove_child(coop_t &parent, coop_t &child) noexcept
Perform removement of a child coop.
static void add_reg_notificator(coop_t &coop, coop_reg_notificator_t notificator)
Add notificator about cooperation registration event.
static void do_decrement_reference_count(coop_t &coop) noexcept
Do decrement reference count for a coop.
static void do_deregistration_specific_actions(coop_t &coop, coop_dereg_reason_t reason) noexcept
Perform actions related to the deregistration of coop.
static void do_registration_specific_actions(coop_t &coop)
Perform actions related to the registration of coop.
static void do_add_agent(coop_t &coop, agent_ref_t agent_ref)
Add agent to cooperation.
internal_agent_iface_t(agent_t &agent) noexcept
void shutdown_agent() noexcept
disp_binder_t & query_disp_binder() const
Getter for disp_binder.
void bind_to_coop(coop_t &coop)
void drop_disp_binder() noexcept
Helper method that drops pointer to disp_binder.
void initiate_agent_definition()
void set_disp_binder(disp_binder_shptr_t binder)
Setter for disp_binder.
A helper class for accessing the functionality of environment-class which is specific for SObjectizer...
internal_env_iface_t(environment_t &env)
Initializing constructor.
void ready_to_deregister_notify(coop_shptr_t coop) noexcept
Notification about readiness to the deregistration.
Template class for smart reference wrapper on the atomic_refcounted_t.
T & operator*() const noexcept
#define SO_5_THROW_EXCEPTION(error_code, desc)
Enumeration of cooperation deregistration reasons.
const int parent_deregistration
Deregistration because parent cooperation deregistration.
Some reusable and low-level classes/functions which can be used in public header files.
auto do_with_rollback_on_exception(Main_Action main_action, Rollback_Action rollback_action) -> decltype(main_action())
Helper function for do some action with rollback in the case of an exception.
auto invoke_noexcept_code(L lambda) noexcept -> decltype(lambda())
void do_add_notificator_to(intrusive_ptr_t< C > &to, N notificator)
Helper function for notificator addition.
Details of SObjectizer run-time implementations.
coop_shptr_t to_shptr_noexcept(const coop_handle_t &) noexcept
A helper function for unsafe extraction of shared_ptr to coop from coop_handle instance.
coop_shptr_t to_shptr(const coop_handle_t &)
A helper function for safe extraction of shared_ptr to coop from coop_handle instance.
Private part of message limit implementation.
const int rc_coop_define_agent_failed
Cooperation couldn't be registered.
const int rc_coop_is_not_in_registered_state
An attempt to do something with coop that is not in registered state.
exception_reaction_t
A reaction of SObjectizer to an exception from agent event.
@ inherit_exception_reaction
Exception reaction should be inherited from SO Environment.
const int rc_agent_to_disp_binding_failed
Binding of agent to dispatcher failed.
const int rc_disp_binder_already_set_for_agent
The dispatcher binder is already set for the agent.
const int rc_no_disp_binder_for_agent
The dispatcher binder is not set for the agent yet.
void operator()() noexcept