SObjectizer  5.5
Public Member Functions | Static Public Member Functions | Private Member Functions | List of all members
so_5::event_queue_hook_t Class Referenceabstract

Interface of event_queue_hook object. More...

#include <event_queue_hook.hpp>

Inheritance diagram for so_5::event_queue_hook_t:
so_5::anonymous_namespace{environment.cpp}::default_event_queue_hook_t so_5::experimental::testing::v1::impl::special_event_queue_hook_t

Public Member Functions

 event_queue_hook_t ()=default
 
virtual ~event_queue_hook_t ()=default
 
virtual SO_5_NODISCARD event_queue_ton_bind (agent_t *agent, event_queue_t *original_queue) noexcept=0
 A reaction to binding of an agent to some event_queue. More...
 
virtual void on_unbind (agent_t *agent, event_queue_t *queue) noexcept=0
 A reaction to unbinding of an agent from some event_queue. More...
 

Static Public Member Functions

static void default_deleter (event_queue_hook_t *what) noexcept
 An implementation of deleter that use operator delete for destroying object of type event_queue_hook. More...
 
static void noop_deleter (event_queue_hook_t *) noexcept
 An implementation of no-op deleter. More...
 

Private Member Functions

 event_queue_hook_t (const event_queue_hook_t &)=delete
 
 event_queue_hook_t (event_queue_hook_t &&)=delete
 
event_queue_hook_toperator= (const event_queue_hook_t &)=delete
 
event_queue_hook_toperator= (event_queue_hook_t &&)=delete
 

Detailed Description

Interface of event_queue_hook object.

Since v.5.5.24 there is a new mechanism for customization of SObjectizer: hook for event_queue. Such hooks allows to replace an original event_queue provided by a dispatcher to some custom version of event_queue. That custom version can do some additional stuff, for example, collect some stats about demands.

This class describes an interface of event_queue_hook. The interface contains the following methods:

Since
v.5.5.24

Constructor & Destructor Documentation

◆ event_queue_hook_t() [1/3]

so_5::event_queue_hook_t::event_queue_hook_t ( const event_queue_hook_t )
privatedelete

◆ event_queue_hook_t() [2/3]

so_5::event_queue_hook_t::event_queue_hook_t ( event_queue_hook_t &&  )
privatedelete

◆ event_queue_hook_t() [3/3]

so_5::event_queue_hook_t::event_queue_hook_t ( )
default

◆ ~event_queue_hook_t()

virtual so_5::event_queue_hook_t::~event_queue_hook_t ( )
virtualdefault

Member Function Documentation

◆ default_deleter()

void so_5::event_queue_hook_t::default_deleter ( event_queue_hook_t what)
staticnoexcept

An implementation of deleter that use operator delete for destroying object of type event_queue_hook.

Pointer to this method is intended to be used with event_queue_hook_unique_ptr_t. For example:

class my_hook final : public so_5::event_queue_hook_t {
...
};
...
so_5::event_queue_hook_unique_ptr_t hook_ptr{
new my_hook(...),
...
so_5::launch(
[](so_5::environment_t & env) {...},
params.event_queue_hook(std::move(hook_ptr));
});

◆ noop_deleter()

void so_5::event_queue_hook_t::noop_deleter ( event_queue_hook_t )
staticnoexcept

An implementation of no-op deleter.

This method do nothing. It is intended to be used with objects those not to be deleted by operator delete. For example:

class my_hook final : public so_5::event_queue_hook_t {
...
};
...
// Note! This object is created on stack.
my_hook hook{...};
...
so_5::launch(
[](so_5::environment_t & env) {...},
params.event_queue_hook(
&hook,
});

◆ on_bind()

virtual SO_5_NODISCARD event_queue_t* so_5::event_queue_hook_t::on_bind ( agent_t agent,
event_queue_t original_queue 
)
pure virtualnoexcept

A reaction to binding of an agent to some event_queue.

This method can return original_queue or a pointer to a different queue. The agent must use the value returned.

Parameters
agentAn agent that is being bound to some event_queue.
original_queueAn event_queue created for that agent by a dispatcher.

Implemented in so_5::experimental::testing::v1::impl::special_event_queue_hook_t, and so_5::anonymous_namespace{environment.cpp}::default_event_queue_hook_t.

◆ on_unbind()

virtual void so_5::event_queue_hook_t::on_unbind ( agent_t agent,
event_queue_t queue 
)
pure virtualnoexcept

A reaction to unbinding of an agent from some event_queue.

This method must be called by an agent even if the previous call to on_bind() returned pointer to the original queue.

Parameters
agentAn agent that is being bound to some event_queue.
queueThe pointer returned by previous call to on_bind.

Implemented in so_5::experimental::testing::v1::impl::special_event_queue_hook_t, and so_5::anonymous_namespace{environment.cpp}::default_event_queue_hook_t.

◆ operator=() [1/2]

event_queue_hook_t& so_5::event_queue_hook_t::operator= ( const event_queue_hook_t )
privatedelete

◆ operator=() [2/2]

event_queue_hook_t& so_5::event_queue_hook_t::operator= ( event_queue_hook_t &&  )
privatedelete

The documentation for this class was generated from the following files: