SObjectizer-5 Extra
Namespaces | Classes | Enumerations | Functions
so_5::extra::async_op::time_limited Namespace Reference

Namespaces

 details
 

Classes

class  cancellation_point_t
 An object that allows to cancel async operation. More...
 
class  definition_point_t
 An interface for definition of async operation. More...
 

Enumerations

enum  status_t {
  status_t::unknown_moved_away, status_t::not_activated, status_t::activated, status_t::completed,
  status_t::cancelled, status_t::timedout
}
 Enumeration for status of operation. More...
 

Functions

template<typename Message >
SO_5_NODISCARD definition_point_t< Message > make (::so_5::agent_t &owner)
 A factory for creation definition points of async operations. More...
 

Enumeration Type Documentation

◆ status_t

Enumeration for status of operation.

Enumerator
unknown_moved_away 

Status of operation is unknown because the operation data has been moved to another proxy-object.

not_activated 

Operation is not activated yet.

activated 

Operation is activated.

completed 

Operation is completed.

cancelled 

Operation is cancelled.

timedout 

Operation is timed-out.

Examples:
env_infrastructures/asio/resolve_n/main.cpp.

Definition at line 45 of file time_limited.hpp.

Function Documentation

◆ make()

template<typename Message >
SO_5_NODISCARD definition_point_t< Message > so_5::extra::async_op::time_limited::make ( ::so_5::agent_t &  owner)

A factory for creation definition points of async operations.

Instead of creation of definition_point_t object by hand this helper function should be used.

Usage examples:

class demo : public so_5::agent_t {
struct timeout final : public so_5::signal_t {};
...
void initiate_async_op() {
// Create a definition_point for a new async operation...
asyncop::make<timeout>(*this)
// ...then set up completion handler(s)...
.completed_on(
*this,
so_default_state(),
&demo::on_first_completion_msg )
.completed_on(
some_external_mbox_,
some_user_defined_state_,
[this](mhood_t<another_completion_msg> cmd) {...})
// ...then set up timeout handler(s)...
.timeout_handler(
so_default_state(),
&demo::on_timeout )
.timeout_handler(
some_user_defined_state_,
[this](mhood_t<timeout> cmd) {...})
// ...and now we can activate the operation.
.activate(std::chrono::milliseconds(300));
...
}
};
Since
v.1.0.4
Parameters
ownerAgent for that this async operation will be created.
Examples:
async_op/time_unlimited/simple/main.cpp, mboxes/collecting_mbox/advanced/main.cpp, and mboxes/collecting_mbox/simple/main.cpp.

Definition at line 1528 of file time_limited.hpp.