26 typedef list<SlotBase*, SmallAllocator<SlotBase*>>
SlotList;
35 void remove(
const Listener& listener);
37 void remove(
const void* obj);
39 void remove(
const void* obj,
const Id& id);
44 const ObjMap&
list()
const {
return _objMap; }
47 template<
class Signal>
51 template<
class Signal,
class... Args>
57 for (
auto& e : *slots)
58 (
static_cast<priv::SlotSignal<Signal>&
>(*e))(args...);
71 typedef stdutil::unordered_map<Id, SlotIndex, SmallAllocator> SignalMap;
73 const SlotList*
slotList(
const Id& signalId)
const;
virtual void onRemove(const Listener &listener)
Definition: ListenerList.h:23
stdutil::unordered_multimap< const void *, Listener::ConstPtr, SmallAllocator > ObjMap
Definition: ListenerList.h:27
void setCallback(Callback *cb)
Set callback to handle events from this class.
Definition: ListenerList.h:62
virtual void onAdd(const Listener &listener)
Definition: ListenerList.h:22
static auto _
Definition: Module.cpp:8
Holds a slot that can receive signals.
Definition: Listener.h:11
void dispatch(Args &&...args) const
Send a signal to all listeners.
Definition: ListenerList.h:52
const ObjMap & list() const
Get all listeners, ordered by object instance.
Definition: ListenerList.h:44
Multicast sender.
Definition: Signal.h:26
Callback to handle events from this class.
Definition: ListenerList.h:20
void add(const Listener &listener)
Add a listener shared reference.
Definition: ListenerList.cpp:8
virtual ~ListenerList()
Definition: ListenerList.h:30
std::unordered_multimap< Key, Value, std::hash< Key >, std::equal_to< Key >, Alloc< pair< const Key, Value >>> unordered_multimap
std::unordered_multimap with custom allocator
Definition: StdUtil.h:86
ListenerList()
Definition: ListenerList.h:29
Holds a name string and its hashed value for fast comparison ops. See String Identifier.
Definition: Id.h:25
const SlotList * slotList() const
Get slots that receive signal. Returns null if none found.
Definition: ListenerList.h:48
void clear()
Remove all listeners.
Definition: ListenerList.cpp:69
Collection of listeners.
Definition: ListenerList.h:16
Global Honeycomb namespace.
list< SlotBase *, SmallAllocator< SlotBase * > > SlotList
Definition: ListenerList.h:26
OutSeq && map(Range &&, Seqs &&..., OutSeq &&, Func &&)
Transform a series of sequences into an output.