qb
2.0.0.0
C++17 Actor Framework
|
Internal base class for services. More...
#include <Actor.h>
Public Member Functions | |
Service (ServiceId sid) | |
Public Member Functions inherited from qb::Actor | |
void | on (KillEvent const &event) noexcept |
Handler for KillEvent. | |
void | on (SignalEvent const &event) noexcept |
Handler for SignalEvent. | |
void | on (UnregisterCallbackEvent const &event) noexcept |
Handler for UnregisterCallbackEvent. | |
void | on (PingEvent const &event) noexcept |
Handler for PingEvent. | |
template<typename _Actor> | |
void | registerCallback (_Actor &actor) const noexcept |
Register a looped callback for this actor. | |
template<typename _Actor> | |
void | unregisterCallback (_Actor &actor) const noexcept |
Unregister a previously registered looped callback for this actor. | |
template<typename _Event, typename _Actor> | |
void | registerEvent (_Actor &actor) const noexcept |
Subscribe this actor to listen for a specific event type. | |
template<typename _Event, typename _Actor> | |
void | unregisterEvent (_Actor &actor) const noexcept |
Unsubscribe this actor from listening to a specific event type. | |
EventBuilder | to (ActorId dest) const noexcept |
Get an EventBuilder for sending chained events to a destination actor. | |
template<typename _Event, typename... _Args> | |
_Event & | push (ActorId const &dest, _Args &&...args) const noexcept |
Send a new event in an ordered fashion to a destination actor, returning a reference to it. | |
template<typename _Event, typename... _Args> | |
void | send (ActorId const &dest, _Args &&...args) const noexcept |
Send a new event in an unordered fashion to a destination actor. | |
template<typename _Event, typename... _Args> | |
_Event | build_event (qb::ActorId const source, _Args &&...args) const noexcept |
Construct an event locally, intended for immediate self-processing or direct calls. | |
template<typename _Type> | |
bool | is (uint32_t const id) const noexcept |
Check if a given ID matches the type ID of _Type. | |
template<typename _Type> | |
bool | is (RequireEvent const &event) const noexcept |
Check if a RequireEvent is for a specific actor type. | |
template<typename... _Actors> | |
bool | require () const noexcept |
Request discovery of other actors of specified types. | |
template<typename _Event, typename... _Args> | |
void | broadcast (_Args &&...args) const noexcept |
Broadcast an event to all actors on all cores. | |
void | reply (Event &event) const noexcept |
Reply to the source of a received event, reusing the event object. | |
void | forward (ActorId dest, Event &event) const noexcept |
Forward a received event to a new destination, reusing the event object. | |
Pipe | getPipe (ActorId dest) const noexcept |
Get direct access to the underlying communication pipe for a destination actor. | |
template<typename _Actor, typename... _Args> | |
_Actor * | addRefActor (_Args &&...args) const |
Create and initialize a new referenced actor on the same VirtualCore. | |
ActorId | id () const noexcept |
Get ActorId. | |
CoreId | getIndex () const noexcept |
Get core index. | |
std::string_view | getName () const noexcept |
Get derived class name. | |
const CoreIdSet & | getCoreSet () const noexcept |
Get the set of cores that this actor's VirtualCore can communicate with. | |
uint64_t | time () const noexcept |
Get current time from the VirtualCore's perspective (nanoseconds since epoch). | |
template<typename _ServiceActor> | |
_ServiceActor * | getService () const noexcept |
Get direct access to ServiceActor* in same core. | |
bool | is_alive () const noexcept |
Check if Actor is alive and processing events. | |
void | kill () const noexcept |
Terminate this actor and mark it for removal from the system. |
Additional Inherited Members | |
Actor () noexcept | |
Default constructor. | |
virtual | ~Actor () noexcept=default |
Virtual destructor. | |
virtual bool | onInit () |
Initialization callback, called once after construction and ID assignment. |
Internal base class for services.
Services are special actors, often used as singletons within a core.