Utilities
Utilities header only library
utils::Notifier< Args > Class Template Reference

A notifier is a mechanism to allow inter-object notifications. More...

Inheritance diagram for utils::Notifier< Args >:
[legend]

Public Types

using CallbackType = std::function< void(Args...)>
 The callback is a void function taking the variadic templated arguments of the Notifier class.
 

Public Member Functions

void AddCallback (CallbackType callback)
 Add a single callback function.
 
virtual void Notify (Args... args)
 Send all notifications at this moment.
 
bool HasCallback () const
 Returns whether it has any callback registered.
 

Protected Attributes

std::vector< CallbackType > callbacks_
 The callbacks.
 
std::mutex notifier_access_
 mutex to ensure thread safety.
 

Detailed Description

template<typename... Args>
class utils::Notifier< Args >

A notifier is a mechanism to allow inter-object notifications.