C++ Actor Framework 0.19
|
Base class for all actor implementations. More...
#include <abstract_actor.hpp>
Public Member Functions | |
actor_control_block * | ctrl () const |
abstract_actor (const abstract_actor &)=delete | |
abstract_actor & | operator= (const abstract_actor &)=delete |
virtual void | on_destroy () |
Cleans up any remaining state before the destructor is called. | |
bool | enqueue (strong_actor_ptr sender, message_id mid, message msg, execution_unit *host) override |
Enqueues a new message without forwarding stack to the channel. | |
virtual bool | enqueue (mailbox_element_ptr what, execution_unit *host)=0 |
Enqueues a new message wrapped in a mailbox_element to the actor. | |
virtual void | attach (attachable_ptr ptr)=0 |
Attaches ptr to this actor. | |
template<class F > | |
void | attach_functor (F f) |
Convenience function that attaches the functor f to this actor. | |
actor_addr | address () const noexcept |
Returns the logical actor address. | |
virtual size_t | detach (const attachable::token &what)=0 |
Detaches the first attached object that matches what . | |
virtual std::set< std::string > | message_types () const |
Returns the set of accepted messages types as strings or an empty set if this actor is untyped. | |
actor_id | id () const noexcept |
Returns the ID of this actor. | |
node_id | node () const noexcept |
Returns the node this actor is living on. | |
actor_system & | home_system () const noexcept |
Returns the system that created this actor (or proxy). | |
![]() | |
virtual bool | enqueue (strong_actor_ptr sender, message_id mid, message content, execution_unit *host=nullptr)=0 |
Enqueues a new message without forwarding stack to the channel. | |
bool | is_abstract_actor () const |
bool | is_abstract_group () const |
bool | is_actor_decorator () const |
Protected Member Functions | |
abstract_actor (actor_config &cfg) | |
![]() | |
int | flags () const |
void | flags (int new_value) |
Protected Attributes | |
std::mutex | mtx_ |
Related Symbols | |
(Note that these are not member symbols.) | |
using | actor_id = uint64_t |
A unique actor ID. | |
Additional Inherited Members | |
![]() | |
static constexpr int | is_abstract_actor_flag = 0x01000000 |
static constexpr int | is_abstract_group_flag = 0x02000000 |
static constexpr int | is_actor_bind_decorator_flag = 0x04000000 |
static constexpr int | is_actor_dot_decorator_flag = 0x08000000 |
static constexpr int | is_actor_decorator_mask = 0x0C000000 |
static constexpr int | is_hidden_flag = 0x10000000 |
Base class for all actor implementations.
|
pure virtual |
Attaches ptr
to this actor.
The actor will call ptr->detach(...)
on exit, or immediately if it already finished execution.
Implemented in caf::monitorable_actor.
void caf::abstract_actor::attach_functor | ( | F | f | ) |
Convenience function that attaches the functor f
to this actor.
The actor executes f()
on exit or immediately if it is not running.
|
pure virtual |
Detaches the first attached object that matches what
.
Implemented in caf::monitorable_actor.
|
pure virtual |
Enqueues a new message wrapped in a mailbox_element
to the actor.
This enqueue
variant allows to define forwarding chains.
true
if the message has added to the mailbox, false
otherwise. In the latter case, the actor terminated and the message has been dropped. Once this function returns false
, it returns false
for all future invocations. true
. In particular when dealing with remote actors. Implemented in caf::actor_companion, caf::decorator::sequencer, caf::forwarding_actor_proxy, caf::actor_pool, and caf::blocking_actor.
|
overridevirtual |
Enqueues a new message without forwarding stack to the channel.
true
if the message has been dispatches successful, false
otherwise. In the latter case, the channel has been closed and the message has been dropped. Once this function returns false
, it returns false
for all future invocations. Implements caf::abstract_channel.
Reimplemented in caf::actor_companion.
|
virtual |
Returns the set of accepted messages types as strings or an empty set if this actor is untyped.
Reimplemented in caf::decorator::sequencer, and caf::typed_event_based_actor< Sigs >.
|
virtual |
Cleans up any remaining state before the destructor is called.
This function makes sure it is safe to call virtual functions in sub classes before destroying the object, because calling virtual function in the destructor itself is not safe. Any override implementation is required to call super::destroy()
at the end.
Reimplemented in caf::actor_pool, and caf::local_actor.