22 # include <unordered_map> 24 # include <qb/utility/nocopy.h> 25 # include "ICallback.h" 26 # include "ProxyPipe.h" 47 mutable bool _alive =
true;
49 void __set_id(
ActorId const &
id);
54 void __set_id(uint16_t
const sid, uint16_t
const cid);
58 template <
typename Tag>
59 static uint16_t registerIndex();
72 virtual ~Actor() =
default;
165 template<
typename _Event,
typename ..._Args>
189 template <
typename T>
206 uint64_t
time()
const;
249 template <
typename _Actor>
261 template <
typename _Actor>
262 void unregisterCallback(_Actor &actor)
const;
267 void unregisterCallback()
const;
290 template<
typename _Event,
typename _Actor>
303 template<
typename _Event,
typename _Actor>
304 void unregisterEvent(_Actor &actor);
310 template<
typename _Event>
311 void unregisterEvent();
334 EventBuilder
to(
ActorId const dest)
const;
358 template<
typename _Event,
typename ..._Args>
359 _Event &
push(
ActorId const &dest, _Args &&...args)
const;
382 template<
typename _Event,
typename ..._Args>
383 void send(
ActorId const &dest, _Args &&...args)
const;
456 template<
typename _Actor,
typename ..._Args>
481 template <
typename Tag>
483 static const uint16_t ServiceIndex;
486 __set_id(ServiceIndex, 0);
492 qb::io::stream &operator<<(qb::io::stream &os,
qb::Actor const &actor);
_Actor * addRefActor(_Args &&...args) const
Create new referenced _Actor.
Event base class.
Definition: Event.h:40
EventBuilder & push(_Args &&...args)
Send a new ordered event.
EventBuilder to(ActorId const dest) const
Get EventBuilder for ActorId destination.
ProxyPipe getPipe(ActorId const dest) const
Get access to unidirectional out events pipe.
void reply(Event &event) const
Reply an event.
Actor base class.
Definition: Actor.h:41
Helper to build Events.
Definition: Actor.h:138
Definition: VirtualCore.h:50
Object returned by Actor::getPipe()
Definition: ProxyPipe.h:33
void send(ActorId const &dest, _Args &&...args) const
Send a new unordered event.
void registerEvent(_Actor &actor)
Actor will listen on new _Event.
Actor unique identifier.
Definition: ActorId.h:35
void forward(ActorId const dest, Event &event) const
Forward an event.
ActorId id() const
Definition: Actor.h:178
internal
Definition: Actor.h:469
_Event & push(ActorId const &dest, _Args &&...args) const
Send a new ordered event.
SingletonActor base class.
Definition: Actor.h:482
void registerCallback(_Actor &actor) const
Register a looped callback.
uint16_t getIndex() const
bool isAlive() const
Check if Actor is alive.
uint64_t time() const
Get current time.
virtual bool onInit()=0
DerivedActor should implement this method.
void on(KillEvent const &event)
Receiving this event will kill the Actor.