COROIO: NNet::NActors::IActor Class Reference
COROIO
Loading...
Searching...
No Matches
NNet::NActors::IActor Class Referenceabstract

Base interface for all actors in the system. More...

#include <actor.hpp>

Inheritance diagram for NNet::NActors::IActor:
NNet::NActors::IBehaviorActor NNet::NActors::ICoroActor NNet::NActors::TAsk< T >

Public Types

using TPtr = std::unique_ptr<IActor>

Public Member Functions

virtual void Receive (TMessageId messageId, TBlob blob, TActorContext::TPtr ctx)=0
 Process an incoming message.
virtual void AfterRegister (TActorContext::TPtr)
 Called once right after the actor is registered in the system.
virtual void BeforeUnregister (TActorContext::TPtr)
 Called once on PoisonPill, right before the actor is destroyed.

Friends

class TActorSystem

Detailed Description

Base interface for all actors in the system.

IActor defines the basic contract that all actors must implement. Actors receive messages through the Receive method and can respond by sending messages back through the provided context.

This is the synchronous version of actor interface - the Receive method should complete quickly and not block on I/O operations.

Member Function Documentation

◆ AfterRegister()

virtual void NNet::NActors::IActor::AfterRegister ( TActorContext::TPtr )
inlinevirtual

Called once right after the actor is registered in the system.

Parameters
ctxContext whose recipient is the actor itself; safe to Send/Schedule from here

Default implementation does nothing.

◆ BeforeUnregister()

virtual void NNet::NActors::IActor::BeforeUnregister ( TActorContext::TPtr )
inlinevirtual

Called once on PoisonPill, right before the actor is destroyed.

Parameters
ctxContext whose recipient is the actor itself

Not called when the whole TActorSystem is destroyed. Default does nothing.

◆ Receive()

virtual void NNet::NActors::IActor::Receive ( TMessageId messageId,
TBlob blob,
TActorContext::TPtr ctx )
pure virtual

Process an incoming message.

Parameters
messageIdType identifier of the message
blobSerialized message data
ctxActor context for sending responses and accessing actor system

This method should process the message quickly and not perform blocking operations. For async operations, use ICoroActor instead.

Implemented in NNet::NActors::IBehaviorActor, NNet::NActors::ICoroActor, and NNet::NActors::TAsk< T >.


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