]>
Dogcows Code - chaz/yoink/blob - src/moof/dispatcher.hh
f2613e8fdeb2d11aba27b51c7758ef3e6fbdd989
2 /*] Copyright (c) 2009-2011, Charles McGarvey [*****************************
3 **] All rights reserved.
5 * Distributable under the terms and conditions of the 2-clause BSD license;
6 * see the file COPYING for a complete text of the license.
8 *****************************************************************************/
10 #ifndef _MOOF_DISPATCH_HH_
11 #define _MOOF_DISPATCH_HH_
15 * Classes that deal with message dispatching.
20 #include <boost/bind.hpp>
21 #include <boost/function.hpp>
22 #include <boost/shared_ptr.hpp>
23 #include <boost/weak_ptr.hpp>
30 * Dispatcher of messages to interested parties.
35 boost::shared_ptr
<impl
> impl_
;
37 void remove_target(unsigned id
);
48 handle(boost::weak_ptr
<impl
> dispatcher
, unsigned id
) :
49 dispatcher_(dispatcher
),
52 handle(const handle
& handle
) :
53 dispatcher_(handle
.dispatcher_
),
64 handle
& operator = (const handle
& handle
)
67 dispatcher_
= handle
.dispatcher_
;
82 boost::weak_ptr
<impl
> dispatcher_
;
86 typedef boost::function
<void(void)> function
;
90 handle
add_target(const std::string
& event
, const function
& callback
);
91 handle
add_target(const std::string
& event
, const function
& callback
,
94 void dispatch(const std::string
& event
);
96 static dispatcher
& global();
102 #endif // _MOOF_DISPATCH_HH_
This page took 0.039198 seconds and 3 git commands to generate.