C++ Actor Framework  0.18
Public Types | Public Member Functions | List of all members
caf::typed_actor_view< Sigs > Class Template Reference

Decorates a pointer to a scheduled_actor with a statically typed actor interface. More...

#include <typed_actor_view.hpp>

Inheritance diagram for caf::typed_actor_view< Sigs >:
Inheritance graph
Collaboration diagram for caf::typed_actor_view< Sigs >:
Collaboration graph

Public Types

using signatures = detail::type_list< Sigs... >
 Stores the template parameter pack.
 
using pointer = scheduled_actor *
 

Public Member Functions

 typed_actor_view (scheduled_actor *ptr)
 
template<class T , spawn_options Os = no_spawn_options, class... Ts>
infer_handle_from_class< T >::type spawn (Ts &&... xs)
 
template<spawn_options Os = no_spawn_options, class F , class... Ts>
infer_handle_from_fun< F >::type spawn (F fun, Ts &&... xs)
 
void quit (error x=error{})
 Finishes execution of this actor after any currently running message handler is done. More...
 
auto address () const noexcept
 Returns the logical actor address. More...
 
auto id () const noexcept
 Returns the ID of this actor. More...
 
auto node () const noexcept
 Returns the node this actor is living on. More...
 
auto & home_system () const noexcept
 Returns the system that created this actor (or proxy). More...
 
auto context () const noexcept
 Returns the execution unit currently used by this actor. More...
 
auto & system () const noexcept
 Returns the hosting actor system. More...
 
const auto & config () const noexcept
 Returns the config of the hosting actor system. More...
 
auto & clock () const noexcept
 Returns the clock of the actor system. More...
 
auto & current_sender () noexcept
 Returns a pointer to the sender of the current message. More...
 
auto current_message_id () noexcept
 Returns the ID of the current message. More...
 
auto * current_mailbox_element ()
 Returns a pointer to the currently processed mailbox element. More...
 
const auto & fail_state () const
 Returns the currently defined fail state. More...
 
auto & mailbox () noexcept
 Returns the queue for storing incoming messages. More...
 
auto & stream_managers () noexcept
 Returns map for all active streams. More...
 
auto & pending_stream_managers () noexcept
 Returns map for all pending streams. More...
 
template<class Fun >
void set_default_handler (Fun &&fun)
 Sets a custom handler for unexpected messages. More...
 
template<class Fun >
void set_error_handler (Fun &&fun)
 Sets a custom handler for error messages. More...
 
template<class Fun >
void set_down_handler (Fun &&fun)
 Sets a custom handler for down messages. More...
 
template<class Fun >
void set_node_down_handler (Fun &&fun)
 Sets a custom handler for node down messages. More...
 
template<class Fun >
void set_exit_handler (Fun &&fun)
 Sets a custom handler for error messages. More...
 
template<class ActorHandle >
void link_to (const ActorHandle &x)
 Links this actor to x. More...
 
template<class ActorHandle >
void unlink_from (const ActorHandle &x)
 Unlinks this actor from x. More...
 
void monitor (const node_id &node)
 Adds a unidirectional monitor to node. More...
 
template<message_priority P = message_priority::normal, class Handle >
void monitor (const Handle &whom)
 Adds a unidirectional monitor to node. More...
 
void demonitor (const node_id &node)
 Removes a monitor from whom. More...
 
template<class Handle >
void demonitor (const Handle &whom)
 Removes a monitor from whom. More...
 
template<class ActorHandle >
void send_exit (const ActorHandle &whom, error reason)
 Sends an exit message to whom. More...
 
void quit (exit_reason reason=exit_reason::normal)
 
template<class... Ts>
detail::make_response_promise_helper< Ts... >::type make_response_promise ()
 
message_id new_request_id (message_priority mp)
 
void request_response_timeout (timespan d, message_id mid)
 
response_promise make_response_promise ()
 
template<class... Ts, class R = typename detail::make_response_promise_helper< typename std::decay<Ts>::type...>::type>
response (Ts &&... xs)
 
template<class... Ts>
void eq_impl (Ts &&... xs)
 
void add_awaited_response_handler (message_id response_id, behavior bhvr)
 
void add_multiplexed_response_handler (message_id response_id, behavior bhvr)
 
template<class Handle , class... Ts>
auto delegate (const Handle &dest, Ts &&... xs)
 
 operator scheduled_actor * () const noexcept
 

Detailed Description

template<class... Sigs>
class caf::typed_actor_view< Sigs >

Decorates a pointer to a scheduled_actor with a statically typed actor interface.

Member Function Documentation

◆ address()

template<class... Sigs>
auto caf::typed_actor_view< Sigs >::address ( ) const
noexcept

Returns the logical actor address.

◆ clock()

template<class... Sigs>
auto& caf::typed_actor_view< Sigs >::clock ( ) const
noexcept

Returns the clock of the actor system.

◆ config()

template<class... Sigs>
const auto& caf::typed_actor_view< Sigs >::config ( ) const
noexcept

Returns the config of the hosting actor system.

◆ context()

template<class... Sigs>
auto caf::typed_actor_view< Sigs >::context ( ) const
noexcept

Returns the execution unit currently used by this actor.

◆ current_mailbox_element()

template<class... Sigs>
auto* caf::typed_actor_view< Sigs >::current_mailbox_element ( )

Returns a pointer to the currently processed mailbox element.

◆ current_message_id()

template<class... Sigs>
auto caf::typed_actor_view< Sigs >::current_message_id ( )
noexcept

Returns the ID of the current message.

◆ current_sender()

template<class... Sigs>
auto& caf::typed_actor_view< Sigs >::current_sender ( )
noexcept

Returns a pointer to the sender of the current message.

Precondition
current_mailbox_element() != nullptr

◆ demonitor() [1/2]

template<class... Sigs>
void caf::typed_actor_view< Sigs >::demonitor ( const node_id node)

Removes a monitor from whom.

◆ demonitor() [2/2]

template<class... Sigs>
template<class Handle >
void caf::typed_actor_view< Sigs >::demonitor ( const Handle &  whom)

Removes a monitor from whom.

◆ fail_state()

template<class... Sigs>
const auto& caf::typed_actor_view< Sigs >::fail_state ( ) const

Returns the currently defined fail state.

If this reason is not none then the actor will terminate with this error after executing the current message handler.

◆ home_system()

template<class... Sigs>
auto& caf::typed_actor_view< Sigs >::home_system ( ) const
noexcept

Returns the system that created this actor (or proxy).

◆ id()

template<class... Sigs>
auto caf::typed_actor_view< Sigs >::id ( ) const
noexcept

Returns the ID of this actor.

◆ link_to()

template<class... Sigs>
template<class ActorHandle >
void caf::typed_actor_view< Sigs >::link_to ( const ActorHandle &  x)

Links this actor to x.

◆ mailbox()

template<class... Sigs>
auto& caf::typed_actor_view< Sigs >::mailbox ( )
noexcept

Returns the queue for storing incoming messages.

◆ monitor() [1/2]

template<class... Sigs>
void caf::typed_actor_view< Sigs >::monitor ( const node_id node)

Adds a unidirectional monitor to node.

Note
Each call to monitor creates a new, independent monitor.

◆ monitor() [2/2]

template<class... Sigs>
template<message_priority P = message_priority::normal, class Handle >
void caf::typed_actor_view< Sigs >::monitor ( const Handle &  whom)

Adds a unidirectional monitor to node.

Note
Each call to monitor creates a new, independent monitor.

◆ node()

template<class... Sigs>
auto caf::typed_actor_view< Sigs >::node ( ) const
noexcept

Returns the node this actor is living on.

◆ pending_stream_managers()

template<class... Sigs>
auto& caf::typed_actor_view< Sigs >::pending_stream_managers ( )
noexcept

Returns map for all pending streams.

◆ quit()

template<class... Sigs>
void caf::typed_actor_view< Sigs >::quit ( error  x = error{})

Finishes execution of this actor after any currently running message handler is done.

This member function clears the behavior stack of the running actor and invokes on_exit(). The actors does not finish execution if the implementation of on_exit() sets a new behavior. When setting a new behavior in on_exit(), one has to make sure to not produce an infinite recursion.

If on_exit() did not set a new behavior, the actor sends an exit message to all of its linked actors, sets its state to exited and finishes execution.

◆ send_exit()

template<class... Sigs>
template<class ActorHandle >
void caf::typed_actor_view< Sigs >::send_exit ( const ActorHandle &  whom,
error  reason 
)

Sends an exit message to whom.

◆ set_default_handler()

template<class... Sigs>
template<class Fun >
void caf::typed_actor_view< Sigs >::set_default_handler ( Fun &&  fun)

Sets a custom handler for unexpected messages.

◆ set_down_handler()

template<class... Sigs>
template<class Fun >
void caf::typed_actor_view< Sigs >::set_down_handler ( Fun &&  fun)

Sets a custom handler for down messages.

◆ set_error_handler()

template<class... Sigs>
template<class Fun >
void caf::typed_actor_view< Sigs >::set_error_handler ( Fun &&  fun)

Sets a custom handler for error messages.

◆ set_exit_handler()

template<class... Sigs>
template<class Fun >
void caf::typed_actor_view< Sigs >::set_exit_handler ( Fun &&  fun)

Sets a custom handler for error messages.

◆ set_node_down_handler()

template<class... Sigs>
template<class Fun >
void caf::typed_actor_view< Sigs >::set_node_down_handler ( Fun &&  fun)

Sets a custom handler for node down messages.

◆ spawn() [1/2]

template<class... Sigs>
template<class T , spawn_options Os = no_spawn_options, class... Ts>
infer_handle_from_class<T>::type caf::typed_actor_view< Sigs >::spawn ( Ts &&...  xs)

◆ spawn() [2/2]

template<class... Sigs>
template<spawn_options Os = no_spawn_options, class F , class... Ts>
infer_handle_from_fun<F>::type caf::typed_actor_view< Sigs >::spawn ( fun,
Ts &&...  xs 
)

◆ stream_managers()

template<class... Sigs>
auto& caf::typed_actor_view< Sigs >::stream_managers ( )
noexcept

Returns map for all active streams.

◆ system()

template<class... Sigs>
auto& caf::typed_actor_view< Sigs >::system ( ) const
noexcept

Returns the hosting actor system.

◆ unlink_from()

template<class... Sigs>
template<class ActorHandle >
void caf::typed_actor_view< Sigs >::unlink_from ( const ActorHandle &  x)

Unlinks this actor from x.


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