OpenRTM-aist  1.2.1
ConfigurationListener.h
Go to the documentation of this file.
1 // -*- C++ -*-
19 #ifndef RTC_CONFIGURATIONLISTENER_H
20 #define RTC_CONFIGURATIONLISTENER_H
21 
22 #include <vector>
23 #include <coil/Properties.h>
24 #include <coil/Mutex.h>
25 #include <coil/Guard.h>
26 
27 namespace RTC
28 {
29  //============================================================
44  {
47  };
48 
49 
73  {
74  public:
98  static const char* toString(ConfigurationParamListenerType type)
99  {
100  static const char* typeString[] =
101  {
102  "ON_UPDATE_CONFIG_PARAM",
103  "CONFIG_PARAM_LISTENER_NUM"
104  };
105  if (type < CONFIG_PARAM_LISTENER_NUM)
106  {
107  return typeString[type];
108  }
109  return "";
110  }
111 
119  virtual ~ConfigurationParamListener();
120 
136  virtual void operator()(const char* config_set_name,
137  const char* config_param_name) = 0;
138  };
139 
140 
141  //============================================================
159  {
163  };
164 
189  {
190  public:
215  static const char* toString(ConfigurationSetListenerType type)
216  {
217  static const char* typeString[] =
218  {
219  "ON_SET_CONFIG_SET",
220  "ON_ADD_CONFIG_SET",
221  "CONFIG_SET_LISTENER_NUM"
222  };
223  if (type < CONFIG_SET_LISTENER_NUM) { return typeString[type]; }
224  return "";
225  }
226 
234  virtual ~ConfigurationSetListener();
235 
251  virtual void operator()(const coil::Properties& config_set) = 0;
252  };
253 
254 
255  //============================================================
267  {
272  };
273 
299  {
300  public:
326  {
327  static const char* typeString[] =
328  {
329  "ON_UPDATE_CONFIG_SET",
330  "ON_REMOVE_CONFIG_SET",
331  "ON_ACTIVATE_CONFIG_SET",
332  "CONFIG_SET_NAME_LISTENER_NUM"
333  };
334  if (type < CONFIG_SET_NAME_LISTENER_NUM) { return typeString[type]; }
335  return "";
336  }
337 
345  virtual ~ConfigurationSetNameListener();
346 
362  virtual void operator()(const char* config_set_name) = 0;
363  };
364 
365 
383  {
384  typedef std::pair<ConfigurationParamListener*, bool> Entry;
386  public:
403 
425  void addListener(ConfigurationParamListener* listener, bool autoclean);
426 
444  void removeListener(ConfigurationParamListener* listener);
445 
465  void notify(const char* config_set_name, const char* config_param_name);
466 
467  private:
468  std::vector<Entry> m_listeners;
469  coil::Mutex m_mutex;
470  };
471 
472 
473  //============================================================
491  {
492  typedef std::pair<ConfigurationSetListener*, bool> Entry;
494  public:
511 
533  void addListener(ConfigurationSetListener* listener, bool autoclean);
534 
552  void removeListener(ConfigurationSetListener* listener);
553 
573  void notify(const coil::Properties& config_set);
574 
575  private:
576  std::vector<Entry> m_listeners;
577  coil::Mutex m_mutex;
578  };
579 
580 
581  //============================================================
599  {
600  typedef std::pair<ConfigurationSetNameListener*, bool> Entry;
602  public:
611 
620 
642  void addListener(ConfigurationSetNameListener* listener, bool autoclean);
643 
661  void removeListener(ConfigurationSetNameListener* listener);
662 
680  void notify(const char* config_set_name);
681 
682  private:
683  std::vector<Entry> m_listeners;
684  coil::Mutex m_mutex;
685  };
686 
687  //------------------------------------------------------------
702  {
703  public:
737  };
738 
739 
740 }; // namespace RTC
741 
742 #endif // RTC_CONFIGURATIONLISTENER_H
static const char * toString(ConfigurationParamListenerType type)
Convert ConfigurationParamListenerType into the string.
Definition: ConfigurationListener.h:98
ConfigurationSetNameListener holder class.
Definition: ConfigurationListener.h:598
RT-Component.
Definition: ConfigurationListener.h:270
Mutex class.
Definition: Mutex.h:40
static const char * toString(ConfigurationSetListenerType type)
Convert ConfigurationSetNameListenerType into the string.
Definition: ConfigurationListener.h:215
ConfigurationSetListener class.
Definition: ConfigurationListener.h:188
ConfigurationSetNameListener class.
Definition: ConfigurationListener.h:298
ConfigurationParamListener class.
Definition: ConfigurationListener.h:72
ConfigurationSetNameListenerType
The types of ConfigurationSetNameListener.
Definition: ConfigurationListener.h:266
Definition: ConfigurationListener.h:701
coil::Guard< coil::Mutex > Guard
Definition: LocalServiceAdmin.h:36
Definition: ConfigurationListener.h:46
Definition: ConfigurationListener.h:269
Definition: ConfigurationListener.h:161
ConfigurationParamListener holder class.
Definition: ConfigurationListener.h:382
Definition: ConfigurationListener.h:271
Definition: ConfigurationListener.h:162
Guard template class.
ConfigurationSetListener holder class.
Definition: ConfigurationListener.h:490
static const char * toString(ConfigurationSetNameListenerType type)
Convert ConfigurationSetNameListenerType into the string.
Definition: ConfigurationListener.h:325
virtual void operator()(const char *config_set_name, const char *config_param_name)=0
Virtual Callback function.
Definition: ConfigurationListener.h:160
Definition: ConfigurationListener.h:45
Definition: ConfigurationListener.h:268
Class represents a set of properties.
Definition: Properties.h:101
Property list class (derived from Java Properties)
ConfigurationSetListenerType
The types of ConfigurationSetListener.
Definition: ConfigurationListener.h:158
virtual ~ConfigurationParamListener()
Destructor.
ConfigurationParamListenerType
The types of ConnectorDataListener.
Definition: ConfigurationListener.h:43