/* * AtomObserver.hpp * * Created on: Nov 30, 2011 * Author: heber */ #ifndef ATOMOBSERVER_HPP_ #define ATOMOBSERVER_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include "CodePatterns/Observer/Relay.hpp" #include "CodePatterns/Singleton.hpp" class atom; /** The AtomObserver is a central instance to all changes occuring within atoms. * * The intent is that if a class wants to know about changes in just _any_ atom, * he may register singly to this class and not to each and every atom. This also * keeps him updated in case of removed or added atoms. * * \warning AtomObserver must get purged \b after World as we do not keep an * an internal list of all atoms. Hence, each atom must get destroyed while * the AtomObserver instance is still intact or segfault will occur. * */ class AtomObserver : public Singleton, public Relay { //!> grant Singleton access to cstor and dstor. friend class Singleton; //!> grant atom access friend class atom; public: private: void AtomInserted(atom *res); void AtomRemoved(atom *res); // private constructor and destructor due to singleton AtomObserver(); virtual ~AtomObserver(); }; #endif /* ATOMOBSERVER_HPP_ */