Go to the documentation of this file. 1 #ifndef H_CAN_DISPATCHER
2 #define H_CAN_DISPATCHER
7 #include <unordered_map>
10 #include <boost/thread/mutex.hpp>
27 std::weak_ptr<DispatcherBase>
guard_;
43 for(
typename std::list<const Listener* >::const_iterator it=
listeners_.begin(); it !=
listeners_.end(); ++it){
48 boost::mutex::scoped_lock lock(
mutex_);
52 boost::mutex::scoped_lock lock(
mutex_);
58 dispatcher->listeners_.push_back(l.get());
67 boost::mutex::scoped_lock lock(
mutex_);
71 boost::mutex::scoped_lock lock(
mutex_);
82 std::unordered_map<K, typename BaseClass::DispatcherBaseSharedPtr, Hash>
filtered_;
93 [[deprecated(
"provide key explicitly")]]
101 if(ptr) ptr->dispatch_nolock(obj);
105 [[deprecated(
"provide key explicitly")]]
107 return dispatch(
static_cast<K
>(obj), obj);
void dispatch(const typename BaseClass::Type &obj)
std::list< const Listener * > listeners_
typename CommInterface::FrameListener ::ListenerConstSharedPtr ListenerConstSharedPtr
std::shared_ptr< DispatcherBase > DispatcherBaseSharedPtr
DispatcherBase(const DispatcherBase &)=delete
virtual ~GuardedListener()
GuardedListener(DispatcherBaseSharedPtr g, const Callable &callable)
static ListenerConstSharedPtr createListener(DispatcherBaseSharedPtr dispatcher, const Callable &callable)
DispatcherBase(boost::mutex &mutex)
BaseClass::ListenerConstSharedPtr createListener(const K &key, const typename BaseClass::Callable &callable)
std::shared_ptr< const Listener > ListenerConstSharedPtr
std::weak_ptr< DispatcherBase > guard_
DispatcherBase & operator=(const DispatcherBase &)=delete
BaseClass::ListenerConstSharedPtr createListener(const T &key, const typename BaseClass::Callable &callable)
typename CommInterface::FrameListener ::Type Type
typename CommInterface::FrameListener ::Callable Callable
void dispatch(const Type &obj)
std::unordered_map< K, typename BaseClass::DispatcherBaseSharedPtr, Hash > filtered_
ListenerConstSharedPtr createListener(const Callable &callable)
DispatcherBaseSharedPtr dispatcher_
void dispatch_nolock(const Type &obj) const
void dispatch(const K &key, const typename BaseClass::Type &obj)