libcaf  0.15.3
Public Member Functions | Protected Member Functions | Related Functions | List of all members
caf::abstract_actor Class Referenceabstract

Base class for all actor implementations. More...

#include <abstract_actor.hpp>

Inheritance diagram for caf::abstract_actor:
caf::abstract_channel caf::monitorable_actor caf::actor_pool caf::actor_proxy caf::forwarding_actor_proxy

Public Member Functions

void * operator new (std::size_t, void *ptr)
 
actor_control_blockctrl () const
 
virtual void on_destroy ()
 Cleans up any remaining state before the destructor is called. More...
 
void 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 void enqueue (mailbox_element_ptr what, execution_unit *host)=0
 Enqueues a new message wrapped in a mailbox_element to the actor. More...
 
virtual void attach (attachable_ptr ptr)=0
 Attaches ptr to this actor. More...
 
template<class F >
void attach_functor (F f)
 Convenience function that attaches the functor f to this actor. More...
 
actor_addr address () const
 Returns the logical actor address.
 
virtual size_t detach (const attachable::token &what)=0
 Detaches the first attached object that matches what.
 
bool establish_backlink (abstract_actor *x)
 Establishes a link relation between this actor and x and returns whether the operation succeeded. More...
 
bool remove_backlink (abstract_actor *x)
 Removes the link relation between this actor and x and returns whether the operation succeeded. More...
 
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. More...
 
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_systemhome_system () const noexcept
 Returns the system that created this actor (or proxy).
 
- Public Member Functions inherited from caf::abstract_channel
bool is_abstract_actor () const
 
bool is_abstract_group () const
 
bool is_actor_decorator () const
 

Protected Member Functions

 abstract_actor (actor_config &cfg)
 Creates a new actor instance.
 
- Protected Member Functions inherited from caf::abstract_channel
int flags () const
 
void flags (int new_value)
 

Related Functions

(Note that these are not member functions.)

using actor_id = uint64_t
 A unique actor ID.
 

Additional Inherited Members

- Static Public Attributes inherited from caf::abstract_channel
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
 

Detailed Description

Base class for all actor implementations.

Member Function Documentation

virtual void caf::abstract_actor::attach ( attachable_ptr  ptr)
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.

template<class F >
void caf::abstract_actor::attach_functor ( f)

Convenience function that attaches the functor f to this actor.

The actor executes f() on exit or immediatley if it is not running.

virtual void caf::abstract_actor::enqueue ( mailbox_element_ptr  what,
execution_unit host 
)
pure virtual

Enqueues a new message wrapped in a mailbox_element to the actor.

This enqueue variant allows to define forwarding chains.

Implemented in caf::actor_pool, and caf::forwarding_actor_proxy.

bool caf::abstract_actor::establish_backlink ( abstract_actor x)

Establishes a link relation between this actor and x and returns whether the operation succeeded.

virtual std::set<std::string> caf::abstract_actor::message_types ( ) const
virtual

Returns the set of accepted messages types as strings or an empty set if this actor is untyped.

virtual void caf::abstract_actor::on_destroy ( )
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.

bool caf::abstract_actor::remove_backlink ( abstract_actor x)

Removes the link relation between this actor and x and returns whether the operation succeeded.


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