# Atlas updates: better unit ownership control; fixed bottom-bar display; fixed iterator problem in undo; renamed 'd' to 'msg' for consistency

This was SVN commit r3836.
This commit is contained in:
Ykkrosh
2006-05-04 02:44:03 +00:00
parent 37663d86fb
commit 9e74e3a077
25 changed files with 406 additions and 129 deletions
@@ -0,0 +1,28 @@
#ifndef OBSERVABLE_H__
#define OBSERVABLE_H__
#include <boost/signals.hpp>
#include <boost/bind.hpp>
typedef boost::signals::connection ObservableConnection;
template <typename T> class Observable : public T
{
public:
template<typename C> ObservableConnection RegisterObserver(int order, void (C::*callback) (const T&), C* obj)
{
return m_Signal.connect(order, boost::bind(std::mem_fun(callback), obj, _1));
}
void RemoveObserver(ObservableConnection handle)
{
handle.disconnect();
}
void NotifyObservers()
{
m_Signal(*this);
}
private:
boost::signal<void (const T&)> m_Signal;
};
#endif // OBSERVABLE_H__