ConfigurationListener.cpp
Go to the documentation of this file.
1 // -*- C++ -*-
20 
21 namespace RTC
22 {
23 
24  //============================================================
33 
42 
51 
52 
53  //============================================================
62  {
63  }
64 
65 
67  {
68  Guard guard(m_mutex);
69  for (int i(0), len(m_listeners.size()); i < len; ++i)
70  {
71  if (m_listeners[i].second)
72  {
73  delete m_listeners[i].first;
74  }
75  }
76  }
77 
78 
81  bool autoclean)
82  {
83  Guard guard(m_mutex);
84  m_listeners.push_back(Entry(listener, autoclean));
85  }
86 
87 
90  {
91  Guard guard(m_mutex);
92  std::vector<Entry>::iterator it(m_listeners.begin());
93 
94  for (; it != m_listeners.end(); ++it)
95  {
96  if ((*it).first == listener)
97  {
98  if ((*it).second)
99  {
100  delete (*it).first;
101  }
102  m_listeners.erase(it);
103  return;
104  }
105  }
106 
107  }
108 
109 
110  void ConfigurationParamListenerHolder::notify(const char* config_set_name,
111  const char* config_param_name)
112  {
113  Guard guard(m_mutex);
114  for (int i(0), len(m_listeners.size()); i < len; ++i)
115  {
116  m_listeners[i].first->operator()(config_set_name, config_param_name);
117  }
118  }
119 
120 
121  //============================================================
130  {
131  }
132 
133 
135  {
136  Guard guard(m_mutex);
137  for (int i(0), len(m_listeners.size()); i < len; ++i)
138  {
139  if (m_listeners[i].second)
140  {
141  delete m_listeners[i].first;
142  }
143  }
144  }
145 
146 
149  bool autoclean)
150  {
151  Guard guard(m_mutex);
152  m_listeners.push_back(Entry(listener, autoclean));
153  }
154 
155 
158  {
159  Guard guard(m_mutex);
160  std::vector<Entry>::iterator it(m_listeners.begin());
161 
162  for (; it != m_listeners.end(); ++it)
163  {
164  if ((*it).first == listener)
165  {
166  if ((*it).second)
167  {
168  delete (*it).first;
169  }
170  m_listeners.erase(it);
171  return;
172  }
173  }
174 
175  }
176 
177 
179  notify(const coil::Properties& config_set)
180  {
181  Guard guard(m_mutex);
182  for (int i(0), len(m_listeners.size()); i < len; ++i)
183  {
184  m_listeners[i].first->operator()(config_set);
185  }
186  }
187 
188  //============================================================
197  {
198  }
199 
200 
202  {
203  Guard guard(m_mutex);
204  for (int i(0), len(m_listeners.size()); i < len; ++i)
205  {
206  if (m_listeners[i].second)
207  {
208  delete m_listeners[i].first;
209  }
210  }
211  }
212 
213 
215  addListener(ConfigurationSetNameListener* listener, bool autoclean)
216  {
217  Guard guard(m_mutex);
218  m_listeners.push_back(Entry(listener, autoclean));
219  }
220 
221 
224  {
225  Guard guard(m_mutex);
226  std::vector<Entry>::iterator it(m_listeners.begin());
227  for (; it != m_listeners.end(); ++it)
228  {
229  if ((*it).first == listener)
230  {
231  if ((*it).second)
232  {
233  delete (*it).first;
234  }
235  m_listeners.erase(it);
236  return;
237  }
238  }
239 
240  }
241 
242 
243  void ConfigurationSetNameListenerHolder::notify(const char* config_set_name)
244  {
245  Guard guard(m_mutex);
246  for (int i(0), len(m_listeners.size()); i < len; ++i)
247  {
248  m_listeners[i].first->operator()(config_set_name);
249  }
250  }
251 
252 };
253 
254 
virtual ~ConfigurationSetListener()
Destructor.
RT-Component.
std::pair< ConfigurationSetListener *, bool > Entry
void notify(const char *config_set_name, const char *config_param_name)
Notify listeners.
ConfigurationSetListener class.
ConfigurationSetNameListener class.
ConfigurationParamListener class.
std::pair< ConfigurationParamListener *, bool > Entry
void addListener(ConfigurationParamListener *listener, bool autoclean)
Add the listener.
virtual ~ConfigurationParamListenerHolder()
Destructor.
void removeListener(ConfigurationSetNameListener *listener)
Remove the listener.
virtual ~ConfigurationSetListenerHolder()
Destructor.
void addListener(ConfigurationSetListener *listener, bool autoclean)
Add the listener.
void removeListener(ConfigurationParamListener *listener)
Remove the listener.
virtual ~ConfigurationParamListener()
Destructor.
std::pair< ConfigurationSetNameListener *, bool > Entry
void removeListener(ConfigurationSetListener *listener)
Remove the listener.
void notify(const coil::Properties &config_set)
Notify listeners.
virtual ~ConfigurationSetNameListener()
Destructor.
Class represents a set of properties.
Definition: Properties.h:101
void notify(const char *config_set_name)
Notify listeners.
void addListener(ConfigurationSetNameListener *listener, bool autoclean)
Add the listener.
Configuration related event listener classes.


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