BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
IObserver.cpp
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Core/Fitting/IObserver.cpp
6 //! @brief Implements class IObserver, mostly by including IObserver.h.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************** //
14 
15 #include "Core/Fitting/IObserver.h"
16 
18 {
19  m_observers.push_back(obj);
20 }
21 
23 {
24  for (auto it : m_observers)
25  it->notify(this);
26 }
27 
28 IObserver::~IObserver() = default;
29 
30 IObservable::~IObservable() = default;
Defines classes IObserver and IObservable (Observer pattern).
std::shared_ptr< IObserver > observer_t
Shared pointer is used when passing these objects from Python to C++.
Definition: IObserver.h:42
virtual void attachObserver(observer_t obj)
attach observer to the list of observers
Definition: IObserver.cpp:17
virtual ~IObservable()
virtual void notifyObservers()
notify observers about change in status
Definition: IObserver.cpp:22
std::list< observer_t > m_observers
Definition: IObserver.h:53
virtual ~IObserver()