Caffe2 - C++ API
A deep learning, cross platform ML framework
Public Types | Public Member Functions
Notifier< T > Class Template Reference

This class enables a listener pattern. More...

#include <Common.h>

Public Types

using Callback = std::function< void(T *)>
 

Public Member Functions

Callback * registerDestructorCallback (Callback fn)
 
Callback * registerNotificationCallback (Callback fn)
 
void deleteCallback (std::list< Callback > &callbackList, Callback *toDelete)
 
void deleteDestructorCallback (Callback *c)
 
void deleteNotificationCallback (Callback *c)
 
void notify ()
 Notifies all listeners (registerNotificationCallback users) of an update. More...
 

Detailed Description

template<typename T>
class Notifier< T >

This class enables a listener pattern.

It is to be used with a "curious recursive pattern" i.e. Derived : public Notifier<Derived> {}

Definition at line 68 of file Common.h.

Member Function Documentation

template<typename T>
void Notifier< T >::notify ( )
inline

Notifies all listeners (registerNotificationCallback users) of an update.

Assumes the information of the update is encoded in the state of the derived class, thus only passing a pointer of type T* to the callback.

Definition at line 104 of file Common.h.


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