19#ifndef RTM_UTIL_LISTENERHOLDER_H
20#define RTM_UTIL_LISTENERHOLDER_H
142 template <
typename ListenerClass>
146 using Entry = std::pair<ListenerClass*, bool>;
170 std::lock_guard<std::mutex> guard(
m_mutex);
176 delete listener.first;
192 std::lock_guard<std::mutex> guard(
m_mutex);
205 std::lock_guard<std::mutex> guard(
m_mutex);
210 if ((*it).first == listener)
244#define LISTENERHOLDER_CALLBACK(func, args) \
246 std::lock_guard<std::mutex> guard(m_mutex); \
247 for (auto&& listener : m_listeners) \
249 listener.first->func args; \
Definition ListenerHolder.h:144
std::vector< Entry > EntryList
Definition ListenerHolder.h:147
virtual void removeListener(ListenerClass *listener)
リスナを削除する
Definition ListenerHolder.h:203
virtual void addListener(ListenerClass *listener, bool autoclean)
リスナを追加する
Definition ListenerHolder.h:189
ListenerHolder(ListenerHolder const &)=delete
EntryList m_listeners
リスナのリスト
Definition ListenerHolder.h:239
virtual ~ListenerHolder()
ListenerHolderデストラクタ
Definition ListenerHolder.h:168
ListenerHolder & operator=(ListenerHolder const &)=delete
ListenerHolder()=default
ListenerHolderクラスコンストラクタ
typename EntryList::iterator EntryIterator
Definition ListenerHolder.h:148
std::pair< ListenerClass *, bool > Entry
Definition ListenerHolder.h:146
std::mutex m_mutex
Mutex
Definition ListenerHolder.h:230
RT-Middleware
Definition FactoryInit.h:22