MapLibre Native Core
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mbgl::ActorRef< Object > Class Template Reference

#include <actor_ref.hpp>

Public Member Functions

 ActorRef (Object &object_, std::weak_ptr< Mailbox > weakMailbox_)
 
template<typename Fn , class... Args>
void invoke (Fn fn, Args &&... args) const
 
template<typename Fn , class... Args>
auto ask (Fn fn, Args &&... args) const
 

Detailed Description

template<class Object>
class mbgl::ActorRef< Object >

An ActorRef<O> is a non-owning, weak reference to an actor of type O. You can send it messages just like an Actor<O>. It's a value object: safe to copy and pass between actors via messages.

An ActorRef<O> does not extend the lifetime of the corresponding Actor<O>. That's determined entirely by whichever object owns the Actor<O> – the actor's "supervisor".

It's safe for a Ref to outlive its Actor – the reference is "weak", and does not extend the lifetime of the owning Actor, and sending a message to a Ref whose Actor has died is a no-op. (In the future, a dead-letters queue or log may be implemented.)

Definition at line 23 of file actor_ref.hpp.

Constructor & Destructor Documentation

◆ ActorRef()

template<class Object >
mbgl::ActorRef< Object >::ActorRef ( Object &  object_,
std::weak_ptr< Mailbox weakMailbox_ 
)
inline

Definition at line 25 of file actor_ref.hpp.

Member Function Documentation

◆ ask()

template<class Object >
template<typename Fn , class... Args>
auto mbgl::ActorRef< Object >::ask ( Fn  fn,
Args &&...  args 
) const
inline

Definition at line 38 of file actor_ref.hpp.

◆ invoke()

template<class Object >
template<typename Fn , class... Args>
void mbgl::ActorRef< Object >::invoke ( Fn  fn,
Args &&...  args 
) const
inline

Definition at line 31 of file actor_ref.hpp.


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