Newer
Older
// ************************************************************************** //

Wuttke, Joachim
committed
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file Tools/inc/IObserver.h

Wuttke, Joachim
committed
//! @brief Defines classes IObserver and IObservable (Observer pattern).
//!
//! @homepage http://apps.jcns.fz-juelich.de/BornAgain

Wuttke, Joachim
committed
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2013
//! @authors Scientific Computing Group at MLZ Garching
//! @authors C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke
//
// ************************************************************************** //
#ifndef IOBSERVER_H
#define IOBSERVER_H
#include "Exceptions.h"
#include <list>
Pospelov, Gennady
committed
class IObservable;
//! @class IObserver
//! @ingroup tools_internal
//! @brief Observer interface from %Observer pattern, for 1:n object dependencies.
Pospelov, Gennady
committed
class BA_CORE_API_ IObserver {
Van Herck, Walter
committed
public:
pospelov
committed
//! method which is used by observable subject to notify change in status
virtual void update (IObservable* /*subject*/) {
throw NotImplementedException("IObserver::update() -> Not implemented");
}
//! @class IObservable
//! @ingroup tools_internal
//! @brief Observable interface from %Observer pattern, for 1:n object dependencies.
Pospelov, Gennady
committed
class BA_CORE_API_ IObservable {
Van Herck, Walter
committed
public:
typedef boost::shared_ptr<IObserver > observer_t;
typedef std::list<observer_t > observerlist_t;
virtual ~IObservable(){}
//! attach observer to the list of observers
//! notify observers about change in status
pospelov
committed
virtual void notifyObservers();
Van Herck, Walter
committed
private:
};
#endif // IOBSERVER_H