SObjectizer-5 Extra
|
An interface for definition of async operation. More...
#include <time_unlimited.hpp>
Public Member Functions | |
definition_point_t (::so_5::outliving_reference_t< ::so_5::agent_t > owner) | |
Initializing constructor. More... | |
~definition_point_t () | |
definition_point_t (const definition_point_t &)=delete | |
definition_point_t & | operator= (const definition_point_t &)=delete |
definition_point_t (definition_point_t &&)=default | |
definition_point_t & | operator= (definition_point_t &&)=default |
definition_point_t & | reserve_completion_handlers_capacity (std::size_t capacity) & |
Reserve a space for storage of completion handlers. More... | |
template<typename... Args> | |
auto | reserve_completion_handlers_capacity (Args &&...args) && |
Just a proxy for actual version of reserve_completion_handlers_capacity. More... | |
bool | is_activable () const noexcept |
Checks if the async operation can be activated. More... | |
template<typename Msg_Target , typename Event_Handler > | |
definition_point_t & | completed_on (Msg_Target &&msg_target, const ::so_5::state_t &state, Event_Handler &&evt_handler) & |
Add a completion handler for the async operation. More... | |
template<typename... Args> | |
definition_point_t && | completed_on (Args &&...args) && |
Just a proxy for the main version of completed_on. More... | |
template<typename Activation_Action > | |
cancellation_point_t< Operation_Data > | activate (Activation_Action &&action) & |
Activate async operation with addition starting action. More... | |
cancellation_point_t< Operation_Data > | activate () & |
Activate async operation. More... | |
template<typename... Args> | |
auto | activate (Args &&...args) && |
Just a proxy for actual activate() methods. More... | |
Private Member Functions | |
void | ensure_not_empty () const |
Checks that the definition_point owns async operation data. More... | |
Private Attributes | |
details::op_shptr_t< Operation_Data > | m_op |
Actual operation data. More... | |
An interface for definition of async operation.
Object of this type is usually created by make() function and is used for definition of async operation. Completion and timeout handlers are set for async operation by using definition_point object.
Then an user calls activate() method and the definition_point transfers the async operation data into cancellation_point object. It means that after a call to activate() method the definition_point object should not be used. Because it doesn't hold any async operation anymore.
A simple usage without storing the cancellation_point:
A more complex example using cancellation_point for cancelling the operation.
Definition at line 53 of file time_unlimited.hpp.
|
inline |
Initializing constructor.
owner | The owner of the async operation. |
Definition at line 685 of file time_unlimited.hpp.
|
inline |
Definition at line 691 of file time_unlimited.hpp.
|
delete |
|
default |
|
inline |
Activate async operation with addition starting action.
This method performs two steps:
It an exception is thrown from action then the activated async operation will be cancelled automatically.
Usage example:
!is_activable()
.Activation_Action | A type of lambda-function or functional object to be excecuted on activation of operation. |
action | A lambda-function or functional object which will be called after creation of all necessary subscriptions and switching to activated status. |
Definition at line 875 of file time_unlimited.hpp.
|
inline |
Activate async operation.
Usage example:
!is_activable()
.Definition at line 928 of file time_unlimited.hpp.
|
inline |
Just a proxy for actual activate() methods.
Definition at line 936 of file time_unlimited.hpp.
|
inline |
Add a completion handler for the async operation.
Usage example:
Msg_Target | It can be a mbox, or a reference to an agent. In the case if Msg_Target if a reference to an agent the agent's direct mbox will be used as message source. |
Event_Handler | Type of actual handler for message/signal. It can be a pointer to agent's method or lambda (or another type of functional object). |
msg_target | A source from which a completion message is expected. It msg_target is a reference to an agent then the agent's direct mbox will be used. |
state | A state for which that completion handler will be subscribed. |
evt_handler | The completion handler itself. |
Definition at line 801 of file time_unlimited.hpp.
|
inline |
Just a proxy for the main version of completed_on.
Definition at line 825 of file time_unlimited.hpp.
|
inlineprivate |
Checks that the definition_point owns async operation data.
Definition at line 675 of file time_unlimited.hpp.
|
inlinenoexcept |
Checks if the async operation can be activated.
The operation can be activated if the definition_point still holds the operation data (e.g. operation is not activated yet) and there is at least one completion handler for the operation.
Definition at line 754 of file time_unlimited.hpp.
|
delete |
|
default |
|
inline |
Reserve a space for storage of completion handlers.
Usage example:
capacity | A required capacity. |
Definition at line 726 of file time_unlimited.hpp.
|
inline |
Just a proxy for actual version of reserve_completion_handlers_capacity.
Definition at line 740 of file time_unlimited.hpp.
|
private |
Actual operation data.
Definition at line 671 of file time_unlimited.hpp.