X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2FMoof%2FDispatcher.hh;h=bbce87872e67e1afdcf0b0c21b19f9ff56a83fd3;hb=ca0f7bdfba63140dca0bd20586d31980f3938eb2;hp=da82f3824256b70bf50ee283f446133594a1c009;hpb=f72400af4fa3e7b54dab154b5a2b6503a6f9af18;p=chaz%2Fyoink diff --git a/src/Moof/Dispatcher.hh b/src/Moof/Dispatcher.hh index da82f38..bbce878 100644 --- a/src/Moof/Dispatcher.hh +++ b/src/Moof/Dispatcher.hh @@ -31,6 +31,7 @@ #include +#include #include #include @@ -45,7 +46,7 @@ namespace Mf { class Notification { public: - virtual ~Notification(); + virtual ~Notification() {}; }; @@ -60,6 +61,9 @@ class Dispatcher public: + // TODO - the Handler would be even better as an object which automagically + // removes itself from the dispatcher on destruction, so users don't have to + // worry about forgetting typedef void* Handler; typedef boost::function Function; @@ -84,13 +88,13 @@ namespace dispatcher { inline Dispatcher::Handler addHandler(const std::string& message, const Dispatcher::Function& callback) { - Dispatcher::getInstance().addHandler(message, callback); + return Dispatcher::getInstance().addHandler(message, callback); } inline Dispatcher::Handler addHandler(const std::string& message, const Dispatcher::Function& callback, Dispatcher::Handler id) { - Dispatcher::getInstance().addHandler(message, callback, id); + return Dispatcher::getInstance().addHandler(message, callback, id); } inline void removeHandler(Dispatcher::Handler id) @@ -105,6 +109,7 @@ inline void dispatch(const std::string& message, const Notification* param = 0) } // namespace dispatch + } // namespace Mf #endif // _MOOF_DISPATCHER_HH_