#include <string>
-#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>
-
-#include <Moof/Singleton.hh>
+#include <boost/shared_ptr.hpp>
namespace Mf {
* Dispatcher of notifications to interested parties.
*/
-class Dispatcher : public Singleton<Dispatcher>
+class Dispatcher
{
public:
typedef void* Handler;
- typedef boost::function<void(const Notification&)> Function;
+ typedef boost::function<void(const Notification*)> Function;
Dispatcher();
+ ~Dispatcher();
+
+ // get global instance
+ static Dispatcher& getInstance();
Handler addHandler(const std::string& message, const Function& callback);
Handler addHandler(const std::string& message, const Function& callback,
void removeHandler(Handler id);
- void dispatch(const std::string& message);
- void dispatch(const std::string& message, const Notification& param);
+ void dispatch(const std::string& message, const Notification* param = 0);
private:
- class DispatcherImpl;
- boost::shared_ptr<DispatcherImpl> impl_;
+ class Impl;
+ boost::shared_ptr<Impl> impl_;
};