RADLib
RADical C++ application framework
RADCore::RADObject Class Reference

Base class for event receivers, senders, and thread-affinity aware objects. More...

#include <RADCore.h>

+ Inheritance diagram for RADCore::RADObject:

Public Member Functions

 RADObject ()
 Creates a RADObject bound to the current thread. More...
 
virtual ~RADObject ()
 Disconnects tracked event links and releases lifetime token. More...
 
void registerLink (const ConnectionRecord &record)
 Registers a connection for cleanup when this object is destroyed. More...
 
std::thread::id threadId () const
 Returns the thread id this object is currently associated with. More...
 
EventLoopassociatedEventLoop () const
 Returns the associated event loop, if any. More...
 
ThreadAffinity threadAffinity () const
 Returns both thread id and associated loop atomically. More...
 
std::weak_ptr< void > lifetimeToken () const
 Returns a weak token used to drop queued callbacks after destruction. More...
 
void moveToThread (std::thread::id tId, EventLoop *loop=nullptr)
 Moves the object's affinity to tId and optional loop. More...
 

Detailed Description

Base class for event receivers, senders, and thread-affinity aware objects.

Constructor & Destructor Documentation

◆ RADObject()

RADCore::RADObject::RADObject ( )

Creates a RADObject bound to the current thread.

◆ ~RADObject()

virtual RADCore::RADObject::~RADObject ( )
virtual

Disconnects tracked event links and releases lifetime token.

Member Function Documentation

◆ associatedEventLoop()

EventLoop* RADCore::RADObject::associatedEventLoop ( ) const

Returns the associated event loop, if any.

◆ lifetimeToken()

std::weak_ptr<void> RADCore::RADObject::lifetimeToken ( ) const

Returns a weak token used to drop queued callbacks after destruction.

◆ moveToThread()

void RADCore::RADObject::moveToThread ( std::thread::id  tId,
EventLoop loop = nullptr 
)

Moves the object's affinity to tId and optional loop.

◆ registerLink()

void RADCore::RADObject::registerLink ( const ConnectionRecord record)

Registers a connection for cleanup when this object is destroyed.

◆ threadAffinity()

ThreadAffinity RADCore::RADObject::threadAffinity ( ) const

Returns both thread id and associated loop atomically.

◆ threadId()

std::thread::id RADCore::RADObject::threadId ( ) const

Returns the thread id this object is currently associated with.


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