00001 // -*- C++ -*- 00019 #ifndef RTC_EXTTRIGEXECUTIONCONTEXT_H 00020 #define RTC_EXTTRIGEXECUTIONCONTEXT_H 00021 00022 #include <rtm/RTC.h> 00023 00024 #include <coil/Mutex.h> 00025 #include <coil/Condition.h> 00026 #include <coil/Task.h> 00027 00028 #include <rtm/Manager.h> 00029 #include <rtm/PeriodicExecutionContext.h> 00030 00031 #ifdef WIN32 00032 #pragma warning( disable : 4290 ) 00033 #endif 00034 00035 namespace RTC 00036 { 00059 class ExtTrigExecutionContext 00060 : public virtual PeriodicExecutionContext 00061 { 00062 typedef coil::Mutex Mutex; 00063 typedef coil::Condition<Mutex> Condition; 00064 public: 00078 ExtTrigExecutionContext(); 00079 00093 virtual ~ExtTrigExecutionContext(void); 00094 00108 virtual void tick() 00109 throw (CORBA::SystemException); 00110 00131 virtual int svc(void); 00132 00133 private: 00134 struct Worker 00135 { 00136 Worker() : _cond(_mutex), _called(false) {}; 00137 Mutex _mutex; 00138 Condition _cond; 00139 bool _called; 00140 }; 00141 // A condition variable for external triggered worker 00142 Worker m_worker; 00143 }; // class ExtTrigExecutionContext 00144 }; // namespace RTC 00145 00146 #ifdef WIN32 00147 #pragma warning( default : 4290 ) 00148 #endif 00149 00150 00151 extern "C" 00152 { 00168 void ExtTrigExecutionContextInit(RTC::Manager* manager); 00169 }; 00170 00171 #endif // RTC_EXTTRIGEXECUTIONCONTEXT_H