]>
Dogcows Code - chaz/yoink/blob - src/Moof/Dispatch.hh
2 /*] Copyright (c) 2009-2010, Charles McGarvey [**************************
3 **] All rights reserved.
7 * Distributable under the terms and conditions of the 2-clause BSD license;
8 * see the file COPYING for a complete text of the license.
10 **************************************************************************/
12 #ifndef _MOOF_DISPATCH_HH_
13 #define _MOOF_DISPATCH_HH_
17 #include <boost/bind.hpp>
18 #include <boost/function.hpp>
19 #include <boost/shared_ptr.hpp>
26 * Dispatcher of messages to interested parties.
32 boost::shared_ptr
<Impl
> mImpl
;
34 void removeHandler(unsigned id
);
39 * Interface for a notification class.
45 virtual ~Message() {};
57 Handler(Impl
* dispatch
, unsigned id
) :
61 Handler(const Handler
& handler
) :
62 mDispatch(handler
.mDispatch
),
70 Handler
& operator = (const Handler
& handler
)
72 mDispatch
= handler
.mDispatch
;
78 unsigned getId() const
90 typedef boost::function
<void(const Message
*)> Function
;
95 Handler
addHandler(const std::string
& event
, const Function
& callback
);
96 Handler
addHandler(const std::string
& event
, const Function
& callback
,
99 void dispatch(const std::string
& event
, const Message
* message
= 0);
105 #endif // _MOOF_DISPATCH_HH_
This page took 0.040486 seconds and 4 git commands to generate.