X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FDispatcher.cc;h=369d4515ffe401aa75b8956cdecedb93638475ed;hp=9e652a37a8983614010cf974f92172c310caae88;hb=542e50a284c7f5b144a5c97c17f6d89b2af0175c;hpb=4701bf580b75a7d77a460c6f14f9fc31fb109bbb diff --git a/src/Moof/Dispatcher.cc b/src/Moof/Dispatcher.cc index 9e652a3..369d451 100644 --- a/src/Moof/Dispatcher.cc +++ b/src/Moof/Dispatcher.cc @@ -34,9 +34,6 @@ namespace Mf { -Notification::~Notification() {} - - struct Dispatcher::Impl { Impl() : @@ -76,7 +73,7 @@ struct Dispatcher::Impl for (CallbackIter jt = first; jt != last; ++jt) { - if (((*jt).second).first == id) + if ((*jt).second.first == id) { callbacks.erase(jt); break; @@ -97,6 +94,15 @@ struct Dispatcher::Impl Dispatcher::Dispatcher() : impl_(new Dispatcher::Impl) {} +Dispatcher::~Dispatcher() {} + + +Dispatcher& Dispatcher::getInstance() +{ + static Dispatcher dispatcher; + return dispatcher; +} + Dispatcher::Handler Dispatcher::addHandler(const std::string& message, const Function& callback) @@ -126,7 +132,7 @@ void Dispatcher::dispatch(const std::string& message, const Notification* param) for (Impl::CallbackIter it = callbacks.first; it != callbacks.second; ++it) { - Function callback = ((*it).second).second; + Function callback = (*it).second.second; callback(param); } }