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

Some reusable and low-level classes/functions which can be used in public header files. More...

Namespaces

namespace  agent_method_pointer_details
 
namespace  anonymous_namespace{handler_makers.cpp}
 
namespace  event_subscription_helpers
 Various helpers for event subscription.
 
namespace  ios_helpers
 Helpers for manipulation with standard C++ I/O streams.
 
namespace  lambda_traits
 Helper templates for detection of lambda-type traits.
 
namespace  message_holder_details
 
namespace  rollback_on_exception_details
 Implementation details for implementation of rollback on exception helper.
 
namespace  scope_exit_details
 

Classes

class  actual_lock_holder_t
 A class to be used as mixin with actual std::mutex instance inside. More...
 
struct  always_false
 A simple metafunction that always "returns" false. More...
 
struct  handlers_bunch_basics_t
 Basic part of handlers_bunch implementation. More...
 
class  handlers_bunch_t
 Template class for storing bunch of message handlers. More...
 
class  handlers_bunch_t< 0 >
 A specialization of handlers_bunch_t for the case when there is no any handlers. More...
 
class  introduce_coop_helper_t
 Helper class for building and registering new cooperation. More...
 
struct  is_agent_method_pointer
 Check whether T is a non-static member function pointer. More...
 
struct  is_agent_method_pointer< method_arity::nullary, Result(Agent::*)() >
 
struct  is_agent_method_pointer< method_arity::nullary, Result(Agent::*)() const >
 
struct  is_agent_method_pointer< method_arity::nullary, Result(Agent::*)() const noexcept >
 
struct  is_agent_method_pointer< method_arity::nullary, Result(Agent::*)() noexcept >
 
struct  is_agent_method_pointer< method_arity::unary, Result(Agent::*)(Handler_Argument) const >
 
struct  is_agent_method_pointer< method_arity::unary, Result(Agent::*)(Handler_Argument) const noexcept >
 
struct  is_agent_method_pointer< method_arity::unary, Result(Agent::*)(Handler_Argument) noexcept >
 
struct  is_agent_method_pointer< method_arity::unary, Result(Agent::*)(Handler_Argument)>
 
struct  lock_holder_detector
 A selector of actual lock_holder type in dependency of lock type. More...
 
struct  lock_holder_detector< null_mutex_t >
 
struct  make_message_instance_impl
 
struct  make_message_instance_impl< true, Msg >
 
struct  message_handler_format_detector
 A helper template to detect type of message from the format of an event handler. More...
 
struct  message_handler_format_detector< const MESSAGE & >
 
struct  message_handler_format_detector< const mhood_t< MESSAGE > & >
 
struct  message_handler_format_detector< mhood_t< MESSAGE > >
 
struct  message_mutability_traits
 Detector of message type traits in dependency of message immutability or mutability. More...
 
struct  message_mutability_traits< immutable_msg< T > >
 
struct  message_mutability_traits< mutable_msg< T > >
 
class  mhood_base_t
 A type to be used as a base for mhood_t implementation. More...
 
class  mhood_base_t< M, mhood_type_t::classical_message, message_mutability_t::immutable_message >
 A special base for the case when message type is derived from message_t. More...
 
class  mhood_base_t< M, mhood_type_t::classical_message, message_mutability_t::mutable_message >
 A special base for the case when message type is derived from message_t. More...
 
class  mhood_base_t< M, mhood_type_t::classical_signal, message_mutability_t::immutable_message >
 A special base for the case when message type is derived from message_t. More...
 
class  mhood_base_t< M, mhood_type_t::classical_signal, message_mutability_t::mutable_message >
 A special base for the case when message type is derived from message_t. More...
 
class  mhood_base_t< M, mhood_type_t::user_type_message, message_mutability_t::immutable_message >
 A special base for the case when message type is not related to message_t. More...
 
class  mhood_base_t< M, mhood_type_t::user_type_message, message_mutability_t::mutable_message >
 A special base for the case when message type is not related to message_t. More...
 
struct  mhood_mutability_detector
 A special detector of message immutability/mutability. More...
 
struct  mhood_type_detector
 A special selector of message hood type. More...
 
struct  msg_state_timeout
 A signal to be used for switching to another state by timeout. More...
 
struct  msg_type_and_handler_pair_t
 Description of an event handler. More...
 
class  no_lock_holder_t
 A class to be used as mixin without any real mutex instance inside. More...
 
class  remaining_time_counter_t
 Helper class for calculating remaining time. More...
 
struct  should_terminate_if_throws_t
 Metafunction that tells is exceptions enabled or not. More...
 
struct  should_terminate_if_throws_t< exceptions_enabled_t >
 
struct  should_terminate_if_throws_t< terminate_if_throws_t >
 

Typedefs

template<typename Msg >
using actual_mhood_base_type
 Just a useful typename for base type of mhood implementation.
 

Enumerations

enum class  mhood_type_t { classical_message , classical_signal , user_type_message }
 A special selector for mhood_t implementations. More...
 
enum class  method_arity { nullary , unary }
 A special enumeration to specify arity of lambda-function or method. More...
 

Functions

template<typename L >
void abort_on_fatal_error (L logging_lambda) noexcept
 
template<typename Msg , typename... Args>
auto make_message_instance (Args &&... args) -> std::unique_ptr< typename message_payload_type< Msg >::envelope_type >
 A helper for allocate instance of a message.
 
template<typename Main_Action , typename Rollback_Action >
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.
 
template<typename Lambda >
void suppress_exceptions (Lambda &&lambda) noexcept
 Helper function for execution a block of code with suppression of any exceptions raised inside that block.
 
template<typename L >
scope_exit_details::at_exit_t< L > at_scope_exit (L &&l)
 Helper function for creation action to be performed at scope exit.
 
template<typename Bunch >
void fill_handlers_bunch (Bunch &bunch, std::size_t)
 
template<typename Bunch , typename... Others>
void fill_handlers_bunch (Bunch &bunch, std::size_t index, msg_type_and_handler_pair_t &&handler, Others &&... other_handlers)
 
template<typename Bunch , typename Lambda , typename... Others>
void fill_handlers_bunch (Bunch &bunch, std::size_t index, Lambda &&lambda, Others &&... other_handlers)
 
template<typename L >
auto invoke_noexcept_code (L lambda) noexcept -> decltype(lambda())
 
template<typename Predicate >
bool wait_for_big_interval (std::unique_lock< std::mutex > &lock, std::condition_variable &cv, std::chrono::steady_clock::duration timeout, Predicate pred)
 Helper function for safe call of condition_variable::wait_for with possible big timeouts.
 

Detailed Description

Some reusable and low-level classes/functions which can be used in public header files.

Some low-level implemetation details which can be used in public header files.

Since
v.5.5.4

Typedef Documentation

◆ actual_mhood_base_type

template<typename Msg >
using so_5::details::actual_mhood_base_type
Initial value:
mhood_base_t<
Msg,
mhood_type_detector<Msg>::mhood_type,
mhood_mutability_detector<Msg>::mutability >

Just a useful typename for base type of mhood implementation.

Since
v.5.5.19

Definition at line 454 of file mhood.hpp.

Enumeration Type Documentation

◆ method_arity

enum class so_5::details::method_arity
strong

A special enumeration to specify arity of lambda-function or method.

This enumeration is intended to be used in utility tools like is_agent_method_pointer class.

Since
v.5.6.0
Enumerator
nullary 

Method or function has no arguments.

unary 

Method or function has just one argument.

Definition at line 78 of file message_handler_format_detector.hpp.

◆ mhood_type_t

enum class so_5::details::mhood_type_t
strong

A special selector for mhood_t implementations.

Since
v.5.5.14
Enumerator
classical_message 

Message type is a classical message derived from so_5::message_t.

classical_signal 

Message type is a classical signal derived from so_5::signal_t.

user_type_message 

Message type is not related to so_5::message_t.

Definition at line 34 of file mhood.hpp.

Function Documentation

◆ abort_on_fatal_error()

template<typename L >
void so_5::details::abort_on_fatal_error ( L logging_lambda)
noexcept

Definition at line 53 of file abort_on_fatal_error.hpp.

◆ at_scope_exit()

template<typename L >
scope_exit_details::at_exit_t< L > so_5::details::at_scope_exit ( L && l)

Helper function for creation action to be performed at scope exit.

Usage example:

if( needs_wait )
{
m_threads_to_wakeup += 1;
auto decrement_threads = at_scope_exit( [&m_threads_to_wakeup] {
--m_threads_to_wakeup;
} );
m_sleep_cond.wait_for( some_time, some_predicate );
}
scope_exit_details::at_exit_t< L > at_scope_exit(L &&l)
Helper function for creation action to be performed at scope exit.
Since
v.5.5.16

Definition at line 60 of file at_scope_exit.hpp.

◆ do_with_rollback_on_exception()

template<typename Main_Action , typename Rollback_Action >
auto so_5::details::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.

Since
v.5.5.4
Template Parameters
Main_Actiontype of lambda with main action.
Rollback_Actiontype of lambda with rollback action.

Definition at line 85 of file rollback_on_exception.hpp.

◆ fill_handlers_bunch() [1/3]

template<typename Bunch , typename Lambda , typename... Others>
void so_5::details::fill_handlers_bunch ( Bunch & bunch,
std::size_t index,
Lambda && lambda,
Others &&... other_handlers )
Parameters
bunchWhat to fill.
indexAn index for next handler.
lambdaNext handler to be inserted.
other_handlersAll other handlers.

Definition at line 583 of file handler_makers.hpp.

◆ fill_handlers_bunch() [2/3]

template<typename Bunch , typename... Others>
void so_5::details::fill_handlers_bunch ( Bunch & bunch,
std::size_t index,
msg_type_and_handler_pair_t && handler,
Others &&... other_handlers )
Parameters
bunchWhat to fill.
indexAn index for next handler.
handlerNext handler to be inserted.
other_handlersAll other handlers.

Definition at line 566 of file handler_makers.hpp.

◆ fill_handlers_bunch() [3/3]

template<typename Bunch >
void so_5::details::fill_handlers_bunch ( Bunch & bunch,
std::size_t  )

Definition at line 559 of file handler_makers.hpp.

◆ invoke_noexcept_code()

template<typename L >
auto so_5::details::invoke_noexcept_code ( L lambda) -> decltype(lambda())
noexcept

Definition at line 30 of file invoke_noexcept_code.hpp.

◆ make_message_instance()

template<typename Msg , typename... Args>
auto so_5::details::make_message_instance ( Args &&... args) -> std::unique_ptr< typename message_payload_type< Msg >::envelope_type >
nodiscard

A helper for allocate instance of a message.

Since
v.5.5.4

Definition at line 841 of file message.hpp.

◆ suppress_exceptions()

template<typename Lambda >
void so_5::details::suppress_exceptions ( Lambda && lambda)
noexcept

Helper function for execution a block of code with suppression of any exceptions raised inside that block.

All exceptions are simply intercepted. Nothing is logged in the case of an exception thrown.

Since
v.5.6.2

Definition at line 29 of file suppress_exceptions.hpp.

◆ wait_for_big_interval()

template<typename Predicate >
bool so_5::details::wait_for_big_interval ( std::unique_lock< std::mutex > & lock,
std::condition_variable & cv,
std::chrono::steady_clock::duration timeout,
Predicate pred )

Helper function for safe call of condition_variable::wait_for with possible big timeouts.

In some places of SObjectizer's code big values of wait-time can be used for std::condition_variable::wait_for. For example, that values can be produced by so_5::infinite_wait_special_timevalue() function.

If such big value will be passed to std::condition_variable::wait_for the wait_for can return immediately without any waiting.

To avoid that behavior this helper function should be used instead of the direct call to condition_variable::wait_for.

Since
v.5.7.2

Definition at line 44 of file safe_cv_wait_for.hpp.