/* * ObserverLog.hpp * * Created on: Dec 1, 2011 * Author: heber */ #ifndef OBSERVERLOG_HPP_ #define OBSERVERLOG_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include "Observable.hpp" #include "Observer.hpp" /** * This class is used to log the working of the observer mechanism * * TODO: make this conditional dependent on compiler Flag. */ class ObserverLog{ friend class Observable; friend class Observer; template friend class Cacheable; public: ObserverLog(); ~ObserverLog(); std::string getLog(); // get everything that has been logged std::string getName(void*); // get the name of an actor bool isObservable(void*); private: int count; // number to reference each actor in this framework std::map names; // List of names assigned to actors std::set observables; // List of pointers to Observables. Needed to distinguish Observers and Observables void addName(void*, std::string); // Assign a name to an Actor void addObservable(void*); void deleteName(void*); // delete the name of an Actor void deleteObservable(void*); std::stringstream &addMessage(int depth=0); // Add a Message to the logging std::stringstream log; // The internal log object }; ObserverLog &observerLog(); #endif /* OBSERVERLOG_HPP_ */