libcaf  0.15.5
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
caf::monitorable_actor Class Reference

Base class for all actor implementations. More...

#include <monitorable_actor.hpp>

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

Public Member Functions

virtual const char * name () const
 Returns an implementation-dependent name for logging purposes, which is only valid as long as the actor is running. More...
 
void attach (attachable_ptr ptr) override
 Attaches ptr to this actor. More...
 
size_t detach (const attachable::token &what) override
 Detaches the first attached object that matches what.
 
void link_to (const actor_addr &x)
 Links this actor to x.
 
template<class ActorHandle >
void link_to (const ActorHandle &x)
 Links this actor to x.
 
void unlink_from (const actor_addr &x)
 Unlinks this actor from x.
 
template<class ActorHandle >
void unlink_from (const ActorHandle &x)
 Links this actor to x.
 
- Public Member Functions inherited from caf::abstract_actor
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...
 
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 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

virtual void on_cleanup ()
 Allows subclasses to add additional cleanup code to the critical secion in cleanup. More...
 
void bounce (mailbox_element_ptr &what)
 Sends a response message if what is a request.
 
void bounce (mailbox_element_ptr &what, const error &err)
 Sends a response message if what is a request.
 
 monitorable_actor (actor_config &cfg)
 Creates a new actor instance.
 
void attach_impl (attachable_ptr &ptr)
 
size_t detach_impl (const attachable::token &what, bool stop_on_hit=false, bool dry_run=false)
 
bool handle_system_message (mailbox_element &x, execution_unit *ctx, bool trap_exit)
 
template<class F >
bool handle_system_message (mailbox_element &x, execution_unit *context, bool trap_exit, F &down_msg_handler)
 
- Protected Member Functions inherited from caf::abstract_actor
 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)
 

Protected Attributes

error fail_state_
 
std::condition_variable cv_
 
attachable_ptr attachables_head_
 
- Protected Attributes inherited from caf::abstract_actor
std::mutex mtx_
 

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
 
static constexpr int is_hidden_flag = 0x10000000
 

Detailed Description

Base class for all actor implementations.

Member Function Documentation

void caf::monitorable_actor::attach ( attachable_ptr  ptr)
overridevirtual

Attaches ptr to this actor.

The actor will call ptr->detach(...) on exit, or immediately if it already finished execution.

Implements caf::abstract_actor.

virtual const char* caf::monitorable_actor::name ( ) const
virtual

Returns an implementation-dependent name for logging purposes, which is only valid as long as the actor is running.

The default implementation simply returns "actor".

virtual void caf::monitorable_actor::on_cleanup ( )
protectedvirtual

Allows subclasses to add additional cleanup code to the critical secion in cleanup.

This member function is called inside of a critical section.

Reimplemented in caf::actor_pool.


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