-/*] Copyright (c) 2009-2010, Charles McGarvey [**************************
+/*] Copyright (c) 2009-2011, Charles McGarvey [*****************************
**] All rights reserved.
*
-* vi:ts=4 sw=4 tw=75
-*
* Distributable under the terms and conditions of the 2-clause BSD license;
* see the file COPYING for a complete text of the license.
*
-**************************************************************************/
+*****************************************************************************/
#ifndef _MOOF_DISPATCH_HH_
#define _MOOF_DISPATCH_HH_
-/**
- * \file dispatcher.hh
- * Classes that deal with message dispatching.
- */
-
#include <string>
#include <boost/bind.hpp>
#include <boost/weak_ptr.hpp>
+/**
+ * \file dispatcher.hh
+ * Classes that deal with message dispatching.
+ */
+
namespace moof {
/**
* Dispatcher of messages to interested parties.
*/
-
class dispatcher
{
class impl;
void remove_target(unsigned id);
-
public:
class handle
private:
boost::weak_ptr<impl> dispatcher_;
- mutable unsigned id_;
+ mutable unsigned id_;
};
typedef boost::function<void(void)> function;
-
dispatcher();
handle add_target(const std::string& event, const function& callback);
handle add_target(const std::string& event, const function& callback,
- handle handle);
+ handle handle);
void dispatch(const std::string& event);