Dobby 3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
AICommon::Notifier< T > Class Template Reference

A template of observable objects that send notifications defined in interface T. More...

#include <Notifier.h>

Inheritance diagram for AICommon::Notifier< T >:
Inheritance graph
[legend]
Collaboration diagram for AICommon::Notifier< T >:
Collaboration graph
[legend]

Public Member Functions

void addObserver (const std::shared_ptr< T > &observer)
 Register interest in receiving updates.
 
void removeObserver (const std::shared_ptr< T > &observer)
 Unregister from updates.
 
void setDispatcher (const std::shared_ptr< IDispatcher > &dispatcher_)
 

Protected Member Functions

template<typename F , typename... Args>
void notify (F f, Args &&... args)
 
template<typename F >
void notify (F f)
 

Protected Attributes

std::shared_ptr< IDispatcherdispatcher
 

Private Member Functions

void notify_impl (std::function< void(const std::shared_ptr< T > &)> fun)
 

Private Attributes

std::mutex m
 
std::deque< std::weak_ptr< T > > observers
 
std::condition_variable cv
 
bool notifyingObservers
 
unsigned int waiteeCount
 

Detailed Description

template<typename T>
class AICommon::Notifier< T >

A template of observable objects that send notifications defined in interface T.

Note
Inherit to use, call notify() to send an update.

Member Function Documentation

◆ setDispatcher()

template<typename T >
void AICommon::Notifier< T >::setDispatcher ( const std::shared_ptr< IDispatcher > &  dispatcher_)
inline

Set dispatcher which will be used for notification callbacks.


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