*******************************************************************************/
-#ifndef _DISPATCHER_HH_
-#define _DISPATCHER_HH_
+#ifndef _MOOF_DISPATCHER_HH_
+#define _MOOF_DISPATCHER_HH_
#include <string>
#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>
-#include "singleton.hh"
+#include <Moof/Singleton.hh>
-namespace dc {
+namespace Mf {
/**
* Interface for a notification class.
*/
-class notification
+class Notification
{
public:
- virtual ~notification();
+ virtual ~Notification();
};
* Dispatcher of notifications to interested parties.
*/
-class dispatcher : public singleton<dispatcher>
+class Dispatcher : public Singleton<Dispatcher>
{
public:
- typedef void* handler;
+ typedef void* Handler;
+ typedef boost::function<void(const Notification&)> Function;
- dispatcher();
+ Dispatcher();
- typedef boost::function<void(const notification&)> function;
+ Handler addHandler(const std::string& message, const Function& callback);
+ Handler addHandler(const std::string& message, const Function& callback,
+ Handler id);
- handler addHandler(const std::string& message, const function& callback);
- handler addHandler(const std::string& message, const function& callback,
- handler id);
-
- void removeHandler(handler id);
+ 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);
private:
- class dispatcher_impl;
- boost::shared_ptr<dispatcher_impl> impl;
+ class DispatcherImpl;
+ boost::shared_ptr<DispatcherImpl> impl_;
};
-} // namespace dc
+} // namespace Mf
-#endif // _DISPATCHER_HH_
+#endif // _MOOF_DISPATCHER_HH_
/** vim: set ts=4 sw=4 tw=80: *************************************************/