2
3
5#include <so_5/impl/mbox_core.hpp>
7#include <so_5/exception.hpp>
9#include <so_5/impl/local_mbox.hpp>
10#include <so_5/impl/named_local_mbox.hpp>
11#include <so_5/impl/mpsc_mbox.hpp>
12#include <so_5/impl/mchain_details.hpp>
13#include <so_5/impl/make_mchain.hpp>
40 return mbox_t
{ new local_mbox_without_tracing{ id, env }
};
60 named_mboxes_dictionary_t::iterator it =
68 new named_local_mbox_t
( key
, it->second
.m_mbox, *
this )
85 new named_local_mbox_t
( key
, mbox_ref
, *
this )
100template<
typename M1,
typename M2,
typename... A >
109 result.reset(
new M1{ std::forward<A>(args)... } );
112 new M2{ std::forward<A>(args)..., msg_tracing_stuff } );
128 ordinary_mpsc_mbox_without_tracing_t
,
129 ordinary_mpsc_mbox_with_tracing_t
>(
135 return mbox_t
{ actual_mbox.release()
};
147 limitless_mpsc_mbox_without_tracing_t
,
148 limitless_mpsc_mbox_with_tracing_t
>(
154 return mbox_t
{ actual_mbox.release()
};
163 named_mboxes_dictionary_t::iterator it =
192 const std::function< mbox_t() > & mbox_factory )
207 named_mboxes_dictionary_t::iterator it =
215 new named_local_mbox_t
( key
, it->second
.m_mbox, *
this )
228 auto fresh_mbox = mbox_factory();
232 "user-provided mbox_factory returns nullptr" );
241 named_mboxes_dictionary_t::iterator it =
252 new named_local_mbox_t
( key
, it->second
.m_mbox, *
this )
264 new named_local_mbox_t
( key
, fresh_mbox
, *
this )
Interface for creator of new mbox in OOP style.
virtual mbox_t create(const mbox_creation_data_t &data)=0
Creation of custom mbox.
mbox_t create_ordinary_mpsc_mbox(environment_t &env, agent_t &owner)
Create mpsc_mbox that handles message limits.
mbox_t create_limitless_mpsc_mbox(environment_t &env, agent_t &owner)
Create mpsc_mbox that ignores message limits.
named_mboxes_dictionary_t m_named_mboxes_dictionary
Named mboxes.
mbox_t introduce_named_mbox(mbox_namespace_name_t mbox_namespace, nonempty_name_t mbox_name, const std::function< mbox_t() > &mbox_factory)
Introduce named mbox with user-provided factory.
outliving_reference_t< so_5::msg_tracing::holder_t > m_msg_tracing_stuff
Data related to message delivery tracing.
mbox_core_t(outliving_reference_t< so_5::msg_tracing::holder_t > msg_tracing_stuff)
std::mutex m_dictionary_lock
Named mbox map's lock.
mbox_t create_custom_mbox(environment_t &env, ::so_5::custom_mbox_details::creator_iface_t &creator)
Create a custom mbox.
std::atomic< mbox_id_t > m_mbox_id_counter
A counter for mbox ID generation.
void destroy_mbox(const full_named_mbox_id_t &name) noexcept
Remove a reference to the named mbox.
mchain_t create_mchain(environment_t &env, const mchain_params_t ¶ms)
Create message chain.
mbox_t create_mbox(environment_t &env)
Create local anonymous mbox.
mbox_t create_mbox(environment_t &env, nonempty_name_t mbox_name)
Create local named mbox.
mbox_id_t allocate_mbox_id() noexcept
Allocate an ID for a new custom mbox or mchain.
mbox_core_stats_t query_stats()
Get statistics for run-time monitoring.
named_local_mbox_t(full_named_mbox_id_t full_name, const mbox_t &mbox, impl::mbox_core_t &mbox_core)
intrusive_ptr_t(T *obj) noexcept
Constructor for a raw pointer.
intrusive_ptr_t & operator=(intrusive_ptr_t &&o) noexcept
Move operator.
A class for the name of mbox_namespace.
std::string_view query_name() const noexcept(noexcept(std::string_view{m_name}))
Get the value.
Parameters for message chain.
const mchain_props::capacity_t & capacity() const
Get chain's capacity and related params.
memory_usage_t memory_usage() const
Memory allocation type for size-limited chain.
bool unlimited() const
Is message chain have no size limit?
Implementation of demands queue for size-limited message chain with dynamically allocated storage.
Implementation of demands queue for size-limited message chain with preallocated storage.
Implementation of demands queue for size-unlimited message chain.
Interface of holder of message tracer and message trace filter objects.
virtual bool is_msg_tracing_enabled() const noexcept=0
Is message tracing enabled?
A class for the name which cannot be empty.
std::string giveout_value() noexcept(noexcept(std::string{ std::move(m_nonempty_name) }))
Get the value away from the object.
Helper class for indication of long-lived reference via its type.
outliving_reference_t(outliving_reference_t const &o) noexcept
#define SO_5_THROW_EXCEPTION(error_code, desc)
std::unique_ptr< abstract_message_box_t > make_actual_mbox(outliving_reference_t< so_5::msg_tracing::holder_t > msg_tracing_stuff, A &&... args)
Details of SObjectizer run-time implementations.
mchain_t make_mchain(outliving_reference_t< so_5::msg_tracing::holder_t > tracer, const mchain_params_t ¶ms, A &&... args)
Helper function for creation of a new mchain with respect to message tracing.
std::string default_global_mbox_namespace()
Helper function that returns name of the default global namespace for named mboxes.
Various properties and parameters of message chains.
memory_usage_t
Memory allocation for storage for size-limited chains.
@ dynamic
Storage can be allocated and deallocated dynamically.
Public part of message delivery tracing mechanism.
Private part of message limit implementation.
const int rc_nullptr_as_result_of_user_mbox_factory
nullptr returned by user-provided mbox factory.
outliving_reference_t< T > outliving_mutable(T &r)
Make outliving_reference wrapper for mutable reference.
Full name for a named mbox.
full_named_mbox_id_t(std::string mbox_namespace, std::string mbox_name)
Initializing constructor.
Statistics from mbox_core for run-time monitoring.
named_mbox_info_t(mbox_t mbox)
mbox_t m_mbox
Real mbox for that name.
unsigned int m_external_ref_count
Reference count by external mbox_refs.
An information which is necessary for creation of a new mbox.
mbox_creation_data_t(outliving_reference_t< environment_t > env, mbox_id_t id, outliving_reference_t< msg_tracing::holder_t > tracer)
Initializing constructor.