SAT Solver Template
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | Static Protected Attributes | Friends | List of all members
sat::SubscriberHandle Class Reference

Identifies a function handler subscribed to a SubscribableEvent. Can be used to unsubscribe the function handler. More...

#include <SubscribableEvent.hpp>

Collaboration diagram for sat::SubscriberHandle:
Collaboration graph
[legend]

Public Member Functions

 SubscriberHandle (const SubscriberHandle &)=default
 
SubscriberHandleoperator= (const SubscriberHandle &)=default
 
 SubscriberHandle (SubscriberHandle &&other) noexcept=default
 
SubscriberHandleoperator= (SubscriberHandle &&other)=default
 
void unregister () noexcept
 
 ~SubscriberHandle ()
 
constexpr SubscriberHandle () noexcept=default
 
bool isSubscribed () const noexcept
 

Protected Member Functions

 SubscriberHandle (Token)
 

Static Protected Attributes

static constexpr Token Subscribe {}
 

Friends

template<typename ... Args>
class SubscribableEvent
 

Detailed Description

Identifies a function handler subscribed to a SubscribableEvent. Can be used to unsubscribe the function handler.

This handle automatically unsubscribes the associated event handler at destruction. It avoids undefined behaviour if the event is already destroyed. However, this mechanism is not thread-safe!

Constructor & Destructor Documentation

◆ ~SubscriberHandle()

sat::SubscriberHandle::~SubscriberHandle ( )

DTor. Automatically unregisters the associated event handler if not already disposed.

◆ SubscriberHandle() [1/2]

constexpr sat::SubscriberHandle::SubscriberHandle ( )
constexprdefaultnoexcept

Ctor. Creates an empty handle

◆ SubscriberHandle() [2/2]

sat::SubscriberHandle::SubscriberHandle ( Token  )
protected

Ctor creates a handle with specified id

Parameters
idid value of the handle

Member Function Documentation

◆ isSubscribed()

bool sat::SubscriberHandle::isSubscribed ( ) const
noexcept

Whether the handle refers to a valid event

Returns
true if handle refers to an active event, false otherwise

◆ unregister()

void sat::SubscriberHandle::unregister ( )
noexcept

Manually unregister the associated event handler


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