]>
Dogcows Code - chaz/yoink/blob - src/Moof/Dispatch.hh
e357f0263e65d33aac5ec81972f9437e22abf0a5
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>
20 #include <boost/weak_ptr.hpp>
27 * Dispatcher of messages to interested parties.
33 boost::shared_ptr
<Impl
> mImpl
;
35 void removeTarget(unsigned id
);
47 Handle(boost::weak_ptr
<Impl
> dispatch
, unsigned id
) :
51 Handle(const Handle
& handle
) :
52 mDispatch(handle
.mDispatch
),
63 Handle
& operator = (const Handle
& handle
)
66 mDispatch
= handle
.mDispatch
;
72 unsigned getId() const
81 boost::weak_ptr
<Impl
> mDispatch
;
85 typedef boost::function
<void(void)> Function
;
90 Handle
addTarget(const std::string
& event
, const Function
& callback
);
91 Handle
addTarget(const std::string
& event
, const Function
& callback
,
94 void dispatch(const std::string
& event
);
96 static Dispatch
& global();
102 #endif // _MOOF_DISPATCH_HH_
This page took 0.037388 seconds and 4 git commands to generate.