OpenRTM-aist  1.2.1
ExtTrigExecutionContext.h
[詳解]
1 // -*- C++ -*-
18 #ifndef RTC_EXTTRIGEXECUTIONCONTEXT_H
19 #define RTC_EXTTRIGEXECUTIONCONTEXT_H
20 
21 #include <rtm/RTC.h>
22 
23 #include <coil/Mutex.h>
24 #include <coil/Condition.h>
25 #include <coil/Task.h>
26 
28 
29 #ifdef WIN32
30 #pragma warning( disable : 4290 )
31 #endif
32 
33 namespace RTC
34 {
58  : public virtual POA_OpenRTM::ExtTrigExecutionContextService,
59  public virtual PortableServer::RefCountServantBase,
61  public coil::Task
62  {
63  typedef coil::Mutex Mutex;
66  public:
81 
95  virtual ~ExtTrigExecutionContext(void);
96 
121  virtual int open(void *args);
122 
143  virtual int svc(void);
144 
172  virtual int close(unsigned long flags);
173 
174  //============================================================
175  // ExtTrigExecutionContextService
176  //============================================================
190  virtual void tick()
191  throw (CORBA::SystemException);
192 
193  //============================================================
194  // ExecutionContextService
195  //============================================================
220  virtual CORBA::Boolean is_running(void)
221  throw (CORBA::SystemException);
222 
250  virtual RTC::ReturnCode_t start(void)
251  throw (CORBA::SystemException);
252 
279  virtual RTC::ReturnCode_t stop(void)
280  throw (CORBA::SystemException);
281 
302  virtual CORBA::Double get_rate(void)
303  throw (CORBA::SystemException);
304 
334  virtual RTC::ReturnCode_t set_rate(CORBA::Double rate)
335  throw (CORBA::SystemException);
336 
370  virtual RTC::ReturnCode_t
372  throw (CORBA::SystemException);
373 
406  virtual RTC::ReturnCode_t
408  throw (CORBA::SystemException);
409 
441  virtual RTC::ReturnCode_t
443  throw (CORBA::SystemException);
444 
471  virtual RTC::LifeCycleState
473  throw (CORBA::SystemException);
474 
494  virtual RTC::ExecutionKind get_kind(void)
495  throw (CORBA::SystemException);
496 
528  virtual RTC::ReturnCode_t add_component(RTC::LightweightRTObject_ptr comp)
529  throw (CORBA::SystemException);
530 
561  virtual RTC::ReturnCode_t
563  throw (CORBA::SystemException);
564 
584  virtual RTC::ExecutionContextProfile* get_profile(void)
585  throw (CORBA::SystemException);
586 
587  protected:
591  virtual RTC::ReturnCode_t onStarted();
592  // template virtual functions adding/removing component
596  virtual RTC::ReturnCode_t
601  virtual RTC::ReturnCode_t
606  virtual RTC::ReturnCode_t
607  onWaitingActivated(RTC_impl::RTObjectStateMachine* comp, long int count);
611  virtual RTC::ReturnCode_t
616  virtual RTC::ReturnCode_t
617  onWaitingReset(RTC_impl::RTObjectStateMachine* comp, long int count);
618 
619  private:
620  bool threadRunning()
621  {
622  Guard guard(m_svcmutex);
623  return m_svc;
624  }
632  RTC::Logger rtclog;
633 
641  bool m_svc;
642  Mutex m_svcmutex;
643 
651  struct Worker
652  {
653  Worker() : cond_(mutex_), ticked_(false) {};
654  Mutex mutex_;
655  Condition cond_;
656  bool ticked_;
657  };
658  // A condition variable for external triggered worker
659  Worker m_worker;
660  }; // class ExtTrigExecutionContext
661 }; // namespace RTC
662 
663 #ifdef WIN32
664 #pragma warning( default : 4290 )
665 #endif
666 
667 
668 extern "C"
669 {
686 };
687 
688 #endif // RTC_EXTTRIGEXECUTIONCONTEXT_H
RTコンポーネント
virtual RTC::ReturnCode_t stop(void)
ExecutionContext の実行を停止
Mutex クラス
Definition: Mutex.h:40
virtual RTC::LifeCycleState get_component_state(RTC::LightweightRTObject_ptr comp)
RTコンポーネントの状態を取得する
void ExtTrigExecutionContextInit(RTC::Manager *manager)
当該 ExecutionContext 用Factoryクラスの登録。
virtual CORBA::Double get_rate(void)
ExecutionContext の実行周期(Hz)を取得する
ExecutionContext用基底クラス
Definition: ExecutionContextBase.h:369
virtual CORBA::Boolean is_running(void)
ExecutionContext 実行状態確認関数
virtual RTC::ReturnCode_t add_component(RTC::LightweightRTObject_ptr comp)
RTコンポーネントを追加する
virtual RTC::ReturnCode_t deactivate_component(RTC::LightweightRTObject_ptr comp)
RTコンポーネントを非アクティブ化する
Manager クラス
Definition: Manager.h:81
ExecutionContext base class.
virtual RTC::ReturnCode_t onStarted()
onStarted() template function
virtual int open(void *args)
ExecutionContext用アクティビティスレッドを生成する
virtual RTC::ReturnCode_t set_rate(CORBA::Double rate)
ExecutionContext の実行周期(Hz)を設定する
virtual RTC::ReturnCode_t remove_component(RTC::LightweightRTObject_ptr comp)
RTコンポーネントを参加者リストから削除する
virtual RTC::ReturnCode_t activate_component(RTC::LightweightRTObject_ptr comp)
RTコンポーネントをアクティブ化する
virtual int close(unsigned long flags)
ExecutionContext 用のスレッド実行関数
virtual RTC::ExecutionContextProfile * get_profile(void)
ExecutionContextProfile を取得する
Logger クラス
Definition: SystemLogger.h:99
virtual RTC::ReturnCode_t onWaitingActivated(RTC_impl::RTObjectStateMachine *comp, long int count)
onWaitingActivated() template function
Definition: RTObjectStateMachine.h:46
virtual void tick()
処理を1ステップ進める
virtual RTC::ReturnCode_t onWaitingReset(RTC_impl::RTObjectStateMachine *comp, long int count)
onWaitingReset() template function
Task クラス
Definition: Task.h:39
virtual RTC::ReturnCode_t onAddedComponent(RTC::LightweightRTObject_ptr rtobj)
onAddedComponent() template function
virtual ~ExtTrigExecutionContext(void)
デストラクタ
RTC::LightweightRTObject_ptr LightweightRTObject_ptr
Definition: ExecutionContextWorker.h:43
RTComponent header.
virtual RTC::ReturnCode_t onWaitingDeactivated(RTC_impl::RTObjectStateMachine *comp, long int count)
onWaitingDeactivated() template function
virtual RTC::ReturnCode_t start(void)
ExecutionContext の実行を開始
virtual RTC::ReturnCode_t reset_component(RTC::LightweightRTObject_ptr comp)
RTコンポーネントをリセットする
virtual int svc(void)
各 Component の処理を呼び出す。
virtual RTC::ExecutionKind get_kind(void)
ExecutionKind を取得する
virtual RTC::ReturnCode_t onRemovedComponent(RTC::LightweightRTObject_ptr rtobj)
onRemovedComponent() template function
ExtTrigExecutionContext()
コンストラクタ
ステップ実行が可能な ExecutionContext クラス
Definition: ExtTrigExecutionContext.h:57