]>
Dogcows Code - chaz/yoink/blob - src/moof/dispatcher.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 * Classes that deal with message dispatching.
22 #include <boost/bind.hpp>
23 #include <boost/function.hpp>
24 #include <boost/shared_ptr.hpp>
25 #include <boost/weak_ptr.hpp>
32 * Dispatcher of messages to interested parties.
38 boost::shared_ptr
<impl
> impl_
;
40 void remove_target(unsigned id
);
52 handle(boost::weak_ptr
<impl
> dispatcher
, unsigned id
) :
53 dispatcher_(dispatcher
),
56 handle(const handle
& handle
) :
57 dispatcher_(handle
.dispatcher_
),
68 handle
& operator = (const handle
& handle
)
71 dispatcher_
= handle
.dispatcher_
;
86 boost::weak_ptr
<impl
> dispatcher_
;
90 typedef boost::function
<void(void)> function
;
95 handle
add_target(const std::string
& event
, const function
& callback
);
96 handle
add_target(const std::string
& event
, const function
& callback
,
99 void dispatch(const std::string
& event
);
101 static dispatcher
& global();
107 #endif // _MOOF_DISPATCH_HH_
This page took 0.098198 seconds and 4 git commands to generate.