BornAgain
1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
|
Contains collection of observers and call them at specified intervals. Each observer will be called at first iteration and every-nth iterations.
Definition at line 31 of file FitObserver.h.
Classes | |
class | ObserverData |
Public Types | |
using | observer_t = std::function< void(const T &)> |
Public Member Functions | |
FitObserver () | |
void | addObserver (int every_nth, observer_t &&observer) |
Adds observer to the list. More... | |
void | notify (const T &data) |
Notifies all observers at their personally specified intervals. More... | |
void | notify_all (const T &data) |
Private Member Functions | |
bool | need_notify (int every_nth) |
Private Attributes | |
int | m_notify_count |
std::vector< ObserverData > | m_observers |
using FitObserver< T >::observer_t = std::function<void(const T&)> |
Definition at line 33 of file FitObserver.h.
FitObserver< T >::FitObserver |
Definition at line 70 of file FitObserver.h.
void FitObserver< T >::addObserver | ( | int | every_nth, |
observer_t && | observer | ||
) |
Adds observer to the list.
every_nth | An observer function will be called every_nth iterations. |
observer | Observer function to be called. |
Definition at line 76 of file FitObserver.h.
Referenced by FitStatus::addObserver().
|
private |
Definition at line 102 of file FitObserver.h.
void FitObserver< T >::notify | ( | const T & | data | ) |
Notifies all observers at their personally specified intervals.
data | The data which will be passed to the observer. |
Definition at line 82 of file FitObserver.h.
Referenced by FitStatus::update().
void FitObserver< T >::notify_all | ( | const T & | data | ) |
|
private |
Definition at line 66 of file FitObserver.h.
|
private |
Definition at line 65 of file FitObserver.h.