OpenRTM-aist  1.2.2
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 
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 
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 
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 
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
RTC::ConfigurationSetListenerType
ConfigurationSetListenerType
The types of ConfigurationSetListener.
Definition: ConfigurationListener.h:158
RTC::ConfigurationParamListener::toString
static const char * toString(ConfigurationParamListenerType type)
Convert ConfigurationParamListenerType into the string.
Definition: ConfigurationListener.h:98
RTC::ON_ACTIVATE_CONFIG_SET
@ ON_ACTIVATE_CONFIG_SET
Definition: ConfigurationListener.h:270
RTC::ConfigurationSetNameListenerHolder
ConfigurationSetNameListener holder class.
Definition: ConfigurationListener.h:598
RTC::ON_REMOVE_CONFIG_SET
@ ON_REMOVE_CONFIG_SET
Definition: ConfigurationListener.h:269
coil::Mutex
Mutex class.
Definition: Mutex.h:40
RTC::ConfigurationListeners::configsetname_
ConfigurationSetNameListenerHolder configsetname_[CONFIG_SET_NAME_LISTENER_NUM]
ConfigurationSetNameListenerType listener array The ConfigurationSetNameListenerType listener is stor...
Definition: ConfigurationListener.h:736
RTC::ConfigurationListeners::configset_
ConfigurationSetListenerHolder configset_[CONFIG_SET_LISTENER_NUM]
ConfigurationSetType listener array The ConfigurationSetType listener is stored.
Definition: ConfigurationListener.h:725
RTC::ConfigurationParamListenerHolder::ConfigurationParamListenerHolder
ConfigurationParamListenerHolder()
Constructor.
Properties.h
Property list class (derived from Java Properties)
RTC::ConfigurationListeners::configparam_
ConfigurationParamListenerHolder configparam_[CONFIG_PARAM_LISTENER_NUM]
ConfigurationParamType listener array The ConfigurationParamType listener is stored.
Definition: ConfigurationListener.h:714
RTC::ConfigurationParamListenerHolder::~ConfigurationParamListenerHolder
virtual ~ConfigurationParamListenerHolder()
Destructor.
RTC::ConfigurationParamListenerHolder::notify
void notify(const char *config_set_name, const char *config_param_name)
Notify listeners.
RTC::ConfigurationParamListenerHolder::addListener
void addListener(ConfigurationParamListener *listener, bool autoclean)
Add the listener.
RTC::ConfigurationSetNameListenerHolder::removeListener
void removeListener(ConfigurationSetNameListener *listener)
Remove the listener.
RTC::ConfigurationSetNameListener
ConfigurationSetNameListener class.
Definition: ConfigurationListener.h:298
RTC::ConfigurationSetNameListener::~ConfigurationSetNameListener
virtual ~ConfigurationSetNameListener()
Destructor.
RTC::ConfigurationSetListenerHolder::addListener
void addListener(ConfigurationSetListener *listener, bool autoclean)
Add the listener.
Guard.h
Guard template class.
RTC::ConfigurationSetListenerHolder::notify
void notify(const coil::Properties &config_set)
Notify listeners.
RTC::ConfigurationSetNameListenerHolder::ConfigurationSetNameListenerHolder
ConfigurationSetNameListenerHolder()
Constructor.
RTC::ConfigurationSetNameListenerType
ConfigurationSetNameListenerType
The types of ConfigurationSetNameListener.
Definition: ConfigurationListener.h:266
RTC::CONFIG_SET_NAME_LISTENER_NUM
@ CONFIG_SET_NAME_LISTENER_NUM
Definition: ConfigurationListener.h:271
RTC::CONFIG_SET_LISTENER_NUM
@ CONFIG_SET_LISTENER_NUM
Definition: ConfigurationListener.h:162
RTC::ConfigurationSetListenerHolder::ConfigurationSetListenerHolder
ConfigurationSetListenerHolder()
Constructor.
RTC::ConfigurationParamListener
ConfigurationParamListener class.
Definition: ConfigurationListener.h:72
RTC::ConfigurationSetListenerHolder
ConfigurationSetListener holder class.
Definition: ConfigurationListener.h:490
RTC::ConfigurationSetListenerHolder::removeListener
void removeListener(ConfigurationSetListener *listener)
Remove the listener.
RTC::ConfigurationSetNameListener::toString
static const char * toString(ConfigurationSetNameListenerType type)
Convert ConfigurationSetNameListenerType into the string.
Definition: ConfigurationListener.h:325
RTC::ConfigurationListeners
Definition: ConfigurationListener.h:701
RTC::ConfigurationSetNameListener::operator()
virtual void operator()(const char *config_set_name)=0
Virtual Callback function.
coil::Properties
Class represents a set of properties.
Definition: Properties.h:101
RTC::ConfigurationParamListener::operator()
virtual void operator()(const char *config_set_name, const char *config_param_name)=0
Virtual Callback function.
RTC::ConfigurationParamListenerHolder
ConfigurationParamListener holder class.
Definition: ConfigurationListener.h:382
RTC::ON_ADD_CONFIG_SET
@ ON_ADD_CONFIG_SET
Definition: ConfigurationListener.h:161
RTC::ON_UPDATE_CONFIG_SET
@ ON_UPDATE_CONFIG_SET
Definition: ConfigurationListener.h:268
Mutex.h
coil::Guard< coil::Mutex >
RTC::ConfigurationSetListener::~ConfigurationSetListener
virtual ~ConfigurationSetListener()
Destructor.
RTC::ConfigurationParamListener::~ConfigurationParamListener
virtual ~ConfigurationParamListener()
Destructor.
RTC::ConfigurationSetListener::operator()
virtual void operator()(const coil::Properties &config_set)=0
Virtual Callback function.
RTC::ConfigurationSetNameListenerHolder::notify
void notify(const char *config_set_name)
Notify listeners.
RTC::ConfigurationSetNameListenerHolder::addListener
void addListener(ConfigurationSetNameListener *listener, bool autoclean)
Add the listener.
RTC
RT-Component.
RTC::ConfigurationParamListenerType
ConfigurationParamListenerType
The types of ConnectorDataListener.
Definition: ConfigurationListener.h:43
RTC::ConfigurationSetNameListenerHolder::~ConfigurationSetNameListenerHolder
virtual ~ConfigurationSetNameListenerHolder()
Destructor.
RTC::ON_UPDATE_CONFIG_PARAM
@ ON_UPDATE_CONFIG_PARAM
Definition: ConfigurationListener.h:45
RTC::ConfigurationSetListener
ConfigurationSetListener class.
Definition: ConfigurationListener.h:188
RTC::ConfigurationParamListenerHolder::removeListener
void removeListener(ConfigurationParamListener *listener)
Remove the listener.
RTC::ConfigurationSetListenerHolder::~ConfigurationSetListenerHolder
virtual ~ConfigurationSetListenerHolder()
Destructor.
RTC::ON_SET_CONFIG_SET
@ ON_SET_CONFIG_SET
Definition: ConfigurationListener.h:160
RTC::ConfigurationSetListener::toString
static const char * toString(ConfigurationSetListenerType type)
Convert ConfigurationSetNameListenerType into the string.
Definition: ConfigurationListener.h:215
RTC::CONFIG_PARAM_LISTENER_NUM
@ CONFIG_PARAM_LISTENER_NUM
Definition: ConfigurationListener.h:46