OpenRTM-aist 2.0.2
読み取り中…
検索中…
一致する文字列を見つけられません
ExtTrigExecutionContext.h
[詳解]
1// -*- C++ -*-
18#ifndef RTC_EXTTRIGEXECUTIONCONTEXT_H
19#define RTC_EXTTRIGEXECUTIONCONTEXT_H
20
21#include <rtm/RTC.h>
22
23#include <condition_variable>
24#include <coil/Task.h>
25
27
28namespace RTC
29{
53 : public virtual POA_OpenRTM::ExtTrigExecutionContextService,
54 public virtual PortableServer::RefCountServantBase,
56 public coil::Task
57 {
58 public:
73
88
113 int open(void *args) override;
114
135 int svc() override;
136
164 int close(unsigned long flags) override;
165
166 //============================================================
167 // ExtTrigExecutionContextService
168 //============================================================
182 void tick() override;
183
184 //============================================================
185 // ExecutionContextService
186 //============================================================
211 CORBA::Boolean is_running() override;
212
240 RTC::ReturnCode_t start() override;
241
268 RTC::ReturnCode_t stop() override;
269
290 CORBA::Double get_rate() override;
291
321 RTC::ReturnCode_t set_rate(CORBA::Double rate) override;
322
356 RTC::ReturnCode_t
357 activate_component(RTC::LightweightRTObject_ptr comp) override;
358
391 RTC::ReturnCode_t
392 deactivate_component(RTC::LightweightRTObject_ptr comp) override;
393
425 RTC::ReturnCode_t
426 reset_component(RTC::LightweightRTObject_ptr comp) override;
427
454 RTC::LifeCycleState
455 get_component_state(RTC::LightweightRTObject_ptr comp) override;
456
476 RTC::ExecutionKind get_kind() override;
477
509 RTC::ReturnCode_t add_component(RTC::LightweightRTObject_ptr comp) override;
510
541 RTC::ReturnCode_t
542 remove_component(RTC::LightweightRTObject_ptr comp) override;
543
563 RTC::ExecutionContextProfile* get_profile() override;
564
565 protected:
569 RTC::ReturnCode_t onStarted() override;
570 // template virtual functions adding/removing component
574 RTC::ReturnCode_t
575 onAddedComponent(RTC::LightweightRTObject_ptr rtobj) override;
579 RTC::ReturnCode_t
580 onRemovedComponent(RTC::LightweightRTObject_ptr rtobj) override;
584 RTC::ReturnCode_t
585 onWaitingActivated(RTC_impl::RTObjectStateMachine* comp, long int count) override;
589 RTC::ReturnCode_t
594 RTC::ReturnCode_t
595 onWaitingReset(RTC_impl::RTObjectStateMachine* comp, long int count) override;
596
597 private:
598 bool threadRunning()
599 {
600 std::lock_guard<std::mutex> guard(m_svcmutex);
601 return m_svc;
602 }
610 RTC::Logger rtclog{"exttrig_async_ec"};
611
619 bool m_svc{false};
620 std::mutex m_svcmutex;
621
629 struct Worker
630 {
631 Worker() {}
632 std::mutex mutex_;
633 std::condition_variable cond_;
634 bool ticked_{false};
635 };
636 // A condition variable for external triggered worker
637 Worker m_worker;
638 }; // class ExtTrigExecutionContext
639} // namespace RTC
640
641
642extern "C"
643{
660}
661
662#endif // RTC_EXTTRIGEXECUTIONCONTEXT_H
ExecutionContext base class
void ExtTrigExecutionContextInit(RTC::Manager *manager)
当該 ExecutionContext 用Factoryクラスの登録。
RTComponent header
ExecutionContext用基底クラス
Definition ExecutionContextBase.h:366
ステップ実行が可能な ExecutionContext クラス
Definition ExtTrigExecutionContext.h:57
RTC::ReturnCode_t start() override
ExecutionContext の実行を開始
RTC::ReturnCode_t set_rate(CORBA::Double rate) override
ExecutionContext の実行周期(Hz)を設定する
int close(unsigned long flags) override
ExecutionContext 用のスレッド実行関数
ExtTrigExecutionContext()
コンストラクタ
RTC::ReturnCode_t deactivate_component(RTC::LightweightRTObject_ptr comp) override
RTコンポーネントを非アクティブ化する
CORBA::Boolean is_running() override
ExecutionContext 実行状態確認関数
RTC::ReturnCode_t onWaitingActivated(RTC_impl::RTObjectStateMachine *comp, long int count) override
onWaitingActivated() template function
RTC::ExecutionKind get_kind() override
ExecutionKind を取得する
RTC::ExecutionContextProfile * get_profile() override
ExecutionContextProfile を取得する
~ExtTrigExecutionContext() override
デストラクタ
CORBA::Double get_rate() override
ExecutionContext の実行周期(Hz)を取得する
RTC::ReturnCode_t onAddedComponent(RTC::LightweightRTObject_ptr rtobj) override
onAddedComponent() template function
void tick() override
処理を1ステップ進める
RTC::ReturnCode_t onStarted() override
onStarted() template function
RTC::ReturnCode_t stop() override
ExecutionContext の実行を停止
RTC::LifeCycleState get_component_state(RTC::LightweightRTObject_ptr comp) override
RTコンポーネントの状態を取得する
RTC::ReturnCode_t remove_component(RTC::LightweightRTObject_ptr comp) override
RTコンポーネントを参加者リストから削除する
RTC::ReturnCode_t onWaitingReset(RTC_impl::RTObjectStateMachine *comp, long int count) override
onWaitingReset() template function
int svc() override
各 Component の処理を呼び出す。
RTC::ReturnCode_t onWaitingDeactivated(RTC_impl::RTObjectStateMachine *comp, long int count) override
onWaitingDeactivated() template function
RTC::ReturnCode_t activate_component(RTC::LightweightRTObject_ptr comp) override
RTコンポーネントをアクティブ化する
int open(void *args) override
ExecutionContext用アクティビティスレッドを生成する
RTC::ReturnCode_t onRemovedComponent(RTC::LightweightRTObject_ptr rtobj) override
onRemovedComponent() template function
RTC::ReturnCode_t add_component(RTC::LightweightRTObject_ptr comp) override
RTコンポーネントを追加する
RTC::ReturnCode_t reset_component(RTC::LightweightRTObject_ptr comp) override
RTコンポーネントをリセットする
Logger クラス
Definition SystemLogger.h:101
Manager クラス
Definition Manager.h:91
Definition RTObjectStateMachine.h:43
RTコンポーネント