ComponentActionListener.h
Go to the documentation of this file.
1 // -*- C++ -*-
19 #ifndef RTC_COMPONENTACTIONLISTENER_H
20 #define RTC_COMPONENTACTIONLISTENER_H
21 
22 #include <vector>
23 #include <utility>
24 #include <coil/Mutex.h>
25 #include <coil/Guard.h>
26 #include <rtm/RTC.h>
27 #include <rtm/idl/RTCSkel.h>
28 #include <rtm/ConnectorBase.h>
29 
30 namespace RTC
31 {
33  //============================================================
58  {
72  };
73 
121  {
122  public:
146  static const char* toString(PreComponentActionListenerType type)
147  {
148  static const char* typeString[] =
149  {
150  "PRE_ON_INITIALIZE",
151  "PRE_ON_FINALIZE",
152  "PRE_ON_STARTUP",
153  "PRE_ON_SHUTDOWN",
154  "PRE_ON_ACTIVATED",
155  "PRE_ON_DEACTIVATED",
156  "PRE_ON_ABORTING",
157  "PRE_ON_ERROR",
158  "PRE_ON_RESET",
159  "PRE_ON_EXECUTE",
160  "PRE_ON_STATE_UPDATE",
161  "PRE_ON_RATE_CHANGED",
162  "PRE_COMPONENT_ACTION_LISTENER_NUM"
163  };
164  if (type < PRE_COMPONENT_ACTION_LISTENER_NUM) { return typeString[type]; }
165  return "";
166  }
167 
175  virtual ~PreComponentActionListener();
176 
192  virtual void operator()(UniqueId ec_id) = 0;
193  };
194 
195 
196  //============================================================
220  {
234  };
235 
236 
284  {
285  public:
309  static const char* toString(PostComponentActionListenerType type)
310  {
311  static const char* typeString[] =
312  {
313  "POST_ON_INITIALIZE",
314  "POST_ON_FINALIZE",
315  "POST_ON_STARTUP",
316  "POST_ON_SHUTDOWN",
317  "POST_ON_ACTIVATED",
318  "POST_ON_DEACTIVATED",
319  "POST_ON_ABORTING",
320  "POST_ON_ERROR",
321  "POST_ON_RESET",
322  "POST_ON_EXECUTE",
323  "POST_ON_STATE_UPDATE",
324  "POST_ON_RATE_CHANGED",
325  "POST_COMPONENT_ACTION_LISTENER_NUM"
326  };
328  {
329  return typeString[type];
330  }
331  return "";
332  }
333 
341  virtual ~PostComponentActionListener();
342 
358  virtual void operator()(UniqueId ec_id,
359  ReturnCode_t ret) = 0;
360  };
361 
362  //============================================================
377  {
381  };
382 
404  {
405  public:
429  static const char* toString(PortActionListenerType type)
430  {
431  static const char* typeString[] =
432  {
433  "ADD_PORT",
434  "REMOVE_PORT",
435  "PORT_ACTION_LISTENER_NUM"
436  };
437  if (type < PORT_ACTION_LISTENER_NUM) { return typeString[type]; }
438  return "";
439  }
440 
448  virtual ~PortActionListener();
449 
465  virtual void operator()(const ::RTC::PortProfile& pprof) = 0;
466  };
467 
468 
469  //============================================================
484  {
488  };
489 
511  {
512  public:
537  {
538  static const char* typeString[] =
539  {
540  "ATTACH_EC",
541  "DETACH_ECT",
542  "EC_ACTION_LISTENER_NUM"
543  };
544  if (type < EC_ACTION_LISTENER_NUM) { return typeString[type]; }
545  return "";
546  }
547 
556 
572  virtual void operator()(UniqueId ec_id) = 0;
573  };
574 
575 
576 
577  //============================================================
595  {
596  typedef std::pair<PreComponentActionListener*, bool> Entry;
598  public:
607 
616 
638  void addListener(PreComponentActionListener* listener, bool autoclean);
639 
657  void removeListener(PreComponentActionListener* listener);
658 
676  void notify(UniqueId ec_id);
677 
678  private:
679  std::vector<Entry> m_listeners;
681  };
682 
683 
701  {
702  typedef std::pair<PostComponentActionListener*, bool> Entry;
704  public:
721 
743  void addListener(PostComponentActionListener* listener, bool autoclean);
744 
762  void removeListener(PostComponentActionListener* listener);
763 
783  void notify(UniqueId ec_id, ReturnCode_t ret);
784 
785  private:
786  std::vector<Entry> m_listeners;
788  };
789 
790 
791  //============================================================
809  {
810  typedef std::pair<PortActionListener*, bool> Entry;
812  public:
828  virtual ~PortActionListenerHolder();
829 
851  void addListener(PortActionListener* listener, bool autoclean);
852 
870  void removeListener(PortActionListener* listener);
871 
891  void notify(const RTC::PortProfile& pprofile);
892 
893  private:
894  std::vector<Entry> m_listeners;
896  };
897 
915  {
916  typedef std::pair<ExecutionContextActionListener*, bool> Entry;
918  public:
935 
957  void addListener(ExecutionContextActionListener* listener, bool autoclean);
958 
976  void removeListener(ExecutionContextActionListener* listener);
977 
997  void notify(UniqueId ec_id);
998 
999  private:
1000  std::vector<Entry> m_listeners;
1002  };
1003 
1004 
1019  {
1020  public:
1065  };
1066 
1067 
1068 }; // namespace RTC
1069 
1070 #endif // RTC_COMPONENTACTIONLISTENER_H
std::pair< PortActionListener *, bool > Entry
static const char * toString(PortActionListenerType type)
Convert PreComponentActionListenerType into the string.
PreComponentActionListener holder class.
EXECUTION_HANDLE_TYPE_NATIVE ExecutionContextHandle_t
Definition: IRTC.h:63
RT-Component.
PostComponentActionListenerType
The types of ConnectorDataListener.
ExecutionContextActionListener holder class.
PortActionListener holder class.
Mutex class.
ReturnCode_t
Definition: doil.h:53
PortActionListenerType
The types of PortActionListener.
RTC::ReturnCode_t ret(RTC::Local::ReturnCode_t r)
std::pair< ExecutionContextActionListener *, bool > Entry
static const char * toString(ExecutionContextActionListenerType type)
Convert PreComponentActionListenerType into the string.
PreComponentActionListenerType
The types of ConnectorDataListener.
PreComponentActionListener class.
Connector base class.
ExecutionContextHandle_t UniqueId
static const char * toString(PostComponentActionListenerType type)
Convert PostComponentActionListenerType into the string.
ComponentActionListeners class.
std::pair< PreComponentActionListener *, bool > Entry
virtual void operator()(UniqueId ec_id)=0
Virtual Callback function.
virtual ~PreComponentActionListener()
Destructor.
PostComponentActionListener holder class.
static const char * toString(PreComponentActionListenerType type)
Convert PreComponentActionListenerType into the string.
RTComponent header.
ExecutionContextActionListenerType
The types of ExecutionContextActionListener.
PortActionListener class.
coil::Guard< coil::Mutex > Guard
PostComponentActionListener class.
std::pair< PostComponentActionListener *, bool > Entry
ExecutionContextActionListener class.


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