ComponentActionListener.cpp
Go to the documentation of this file.
1 // -*- C++ -*-
20 
21 namespace RTC
22 {
23 
24  //============================================================
33 
42 
51 
60 
61 
62 
63 
64 
65  //============================================================
74  {
75  }
76 
77 
79  {
80  Guard guard(m_mutex);
81  for (int i(0), len(m_listeners.size()); i < len; ++i)
82  {
83  if (m_listeners[i].second)
84  {
85  delete m_listeners[i].first;
86  }
87  }
88  }
89 
90 
93  bool autoclean)
94  {
95  Guard guard(m_mutex);
96  m_listeners.push_back(Entry(listener, autoclean));
97  }
98 
99 
102  {
103  Guard guard(m_mutex);
104  std::vector<Entry>::iterator it(m_listeners.begin());
105 
106  for (; it != m_listeners.end(); ++it)
107  {
108  if ((*it).first == listener)
109  {
110  if ((*it).second)
111  {
112  delete (*it).first;
113  }
114  m_listeners.erase(it);
115  return;
116  }
117  }
118 
119  }
120 
121 
123  {
124  Guard guard(m_mutex);
125  for (int i(0), len(m_listeners.size()); i < len; ++i)
126  {
127  m_listeners[i].first->operator()(ec_id);
128  }
129  }
130 
131  //============================================================
140  {
141  }
142 
143 
145  {
146  Guard guard(m_mutex);
147  for (int i(0), len(m_listeners.size()); i < len; ++i)
148  {
149  if (m_listeners[i].second)
150  {
151  delete m_listeners[i].first;
152  }
153  }
154  }
155 
156 
158  addListener(PostComponentActionListener* listener, bool autoclean)
159  {
160  Guard guard(m_mutex);
161  m_listeners.push_back(Entry(listener, autoclean));
162  }
163 
164 
167  {
168  Guard guard(m_mutex);
169  std::vector<Entry>::iterator it(m_listeners.begin());
170  for (; it != m_listeners.end(); ++it)
171  {
172  if ((*it).first == listener)
173  {
174  if ((*it).second)
175  {
176  delete (*it).first;
177  }
178  m_listeners.erase(it);
179  return;
180  }
181  }
182 
183  }
184 
185 
188  {
189  Guard guard(m_mutex);
190  for (int i(0), len(m_listeners.size()); i < len; ++i)
191  {
192  m_listeners[i].first->operator()(ec_id, ret);
193  }
194  }
195 
196 
205  {
206  }
207 
208 
210  {
211  Guard guard(m_mutex);
212  for (int i(0), len(m_listeners.size()); i < len; ++i)
213  {
214  if (m_listeners[i].second)
215  {
216  delete m_listeners[i].first;
217  }
218  }
219  }
220 
221 
223  bool autoclean)
224  {
225  Guard guard(m_mutex);
226  m_listeners.push_back(Entry(listener, autoclean));
227  }
228 
229 
231  {
232  Guard guard(m_mutex);
233  std::vector<Entry>::iterator it(m_listeners.begin());
234 
235  for (; it != m_listeners.end(); ++it)
236  {
237  if ((*it).first == listener)
238  {
239  if ((*it).second)
240  {
241  delete (*it).first;
242  }
243  m_listeners.erase(it);
244  return;
245  }
246  }
247 
248  }
249 
250 
251  void PortActionListenerHolder::notify(const RTC::PortProfile& pprofile)
252  {
253  Guard guard(m_mutex);
254  for (int i(0), len(m_listeners.size()); i < len; ++i)
255  {
256  m_listeners[i].first->operator()(pprofile);
257  }
258  }
259 
260 
261 
270  {
271  }
272 
273 
275  {
276  Guard guard(m_mutex);
277  for (int i(0), len(m_listeners.size()); i < len; ++i)
278  {
279  if (m_listeners[i].second)
280  {
281  delete m_listeners[i].first;
282  }
283  }
284  }
285 
286 
289  bool autoclean)
290  {
291  Guard guard(m_mutex);
292  m_listeners.push_back(Entry(listener, autoclean));
293  }
294 
295 
298  {
299  Guard guard(m_mutex);
300  std::vector<Entry>::iterator it(m_listeners.begin());
301 
302  for (; it != m_listeners.end(); ++it)
303  {
304  if ((*it).first == listener)
305  {
306  if ((*it).second)
307  {
308  delete (*it).first;
309  }
310  m_listeners.erase(it);
311  return;
312  }
313  }
314 
315  }
316 
317 
319  {
320  Guard guard(m_mutex);
321  for (int i(0), len(m_listeners.size()); i < len; ++i)
322  {
323  m_listeners[i].first->operator()(ec_id);
324  }
325  }
326 
327 };
328 
329 
std::pair< PortActionListener *, bool > Entry
void addListener(PreComponentActionListener *listener, bool autoclean)
Add the listener.
RT-Component.
component action listener class
ReturnCode_t
Definition: doil.h:53
RTC::ReturnCode_t ret(RTC::Local::ReturnCode_t r)
std::pair< ExecutionContextActionListener *, bool > Entry
void removeListener(PreComponentActionListener *listener)
Remove the listener.
void notify(const RTC::PortProfile &pprofile)
Notify listeners.
PreComponentActionListener class.
void removeListener(PostComponentActionListener *listener)
Remove the listener.
virtual ~PortActionListenerHolder()
Destructor.
void notify(UniqueId ec_id, ReturnCode_t ret)
Notify listeners.
ExecutionContextHandle_t UniqueId
std::pair< PreComponentActionListener *, bool > Entry
virtual ~PortActionListener()
Destructor.
void addListener(PostComponentActionListener *listener, bool autoclean)
Add the listener.
void removeListener(PortActionListener *listener)
Remove the listener.
void notify(UniqueId ec_id)
Notify listeners.
void removeListener(ExecutionContextActionListener *listener)
Remove the listener.
virtual ~PreComponentActionListener()
Destructor.
void addListener(ExecutionContextActionListener *listener, bool autoclean)
Add the listener.
virtual ~PostComponentActionListener()
Destructor.
PortActionListener class.
void addListener(PortActionListener *listener, bool autoclean)
Add the listener.
PostComponentActionListener class.
std::pair< PostComponentActionListener *, bool > Entry
void notify(UniqueId ec_id)
Notify listeners.
ExecutionContextActionListener class.


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Mon Jun 10 2019 14:07:50