OpenRTM-aist 2.0.2
Loading...
Searching...
No Matches
VxWorksInterruptExecutionContext.h
Go to the documentation of this file.
1// -*- C++ -*-
17#ifndef RTC_VXWORKSINTERRUPTEXECUTIONCONTEXT_H
18#define RTC_VXWORKSINTERRUPTEXECUTIONCONTEXT_H
19
20#include <rtm/RTC.h>
21
22#include <coil/Mutex.h>
23#include <coil/Condition.h>
24#include <coil/Task.h>
25
27
28#include <intLib.h>
29
30namespace RTC
31{
53 : public virtual POA_RTC::ExecutionContextService,
54 public virtual PortableServer::RefCountServantBase,
56 public coil::Task
57 {
58 typedef coil::Mutex Mutex;
59 typedef coil::Condition<Mutex> Condition;
60 public:
75
90
104 virtual void init(coil::Properties& props);
129 virtual int open(void *args);
130
158 virtual int close(unsigned long flags);
159
180 virtual int svc(void);
181
182 //============================================================
183 // ExecutionContextService
184 //============================================================
198 virtual void tick();
223 virtual CORBA::Boolean is_running(void)
224 throw (CORBA::SystemException);
225
253 virtual RTC::ReturnCode_t start(void)
254 throw (CORBA::SystemException);
255
282 virtual RTC::ReturnCode_t stop(void)
283 throw (CORBA::SystemException);
284
305 virtual CORBA::Double get_rate(void)
306 throw (CORBA::SystemException);
307
337 virtual RTC::ReturnCode_t set_rate(CORBA::Double rate)
338 throw (CORBA::SystemException);
339
373 virtual RTC::ReturnCode_t
374 activate_component(RTC::LightweightRTObject_ptr comp)
375 throw (CORBA::SystemException);
376
409 virtual RTC::ReturnCode_t
410 deactivate_component(RTC::LightweightRTObject_ptr comp)
411 throw (CORBA::SystemException);
412
444 virtual RTC::ReturnCode_t
445 reset_component(RTC::LightweightRTObject_ptr comp)
446 throw (CORBA::SystemException);
447
474 virtual RTC::LifeCycleState
475 get_component_state(RTC::LightweightRTObject_ptr comp)
476 throw (CORBA::SystemException);
477
497 virtual RTC::ExecutionKind get_kind(void)
498 throw (CORBA::SystemException);
499
531 virtual RTC::ReturnCode_t add_component(RTC::LightweightRTObject_ptr comp)
532 throw (CORBA::SystemException);
533
564 virtual RTC::ReturnCode_t
565 remove_component(RTC::LightweightRTObject_ptr comp)
566 throw (CORBA::SystemException);
567
587 virtual RTC::ExecutionContextProfile* get_profile(void)
588 throw (CORBA::SystemException);
589
590 protected:
591 template <class T>
592 void getProperty(coil::Properties& prop, const char* key, T& value)
593 {
594 if (prop.findNode(key) != 0)
595 {
596 T tmp;
597 if (coil::stringTo(tmp, prop[key].c_str()))
598 {
599 value = tmp;
600 }
601 }
602 }
606 virtual RTC::ReturnCode_t onStarted();
607 // template virtual functions adding/removing component
611 virtual RTC::ReturnCode_t
612 onAddedComponent(RTC::LightweightRTObject_ptr rtobj);
616 virtual RTC::ReturnCode_t
617 onRemovedComponent(RTC::LightweightRTObject_ptr rtobj);
621 virtual RTC::ReturnCode_t
626 virtual RTC::ReturnCode_t
631 virtual RTC::ReturnCode_t
633
634 private:
635 bool threadRunning()
636 {
637 std::lock_guard<coil::Mutex> guard(m_svcmutex);
638 return m_svc;
639 }
658 STATUS setInterrupt(coil::Properties& props);
666 RTC::Logger rtclog;
667
675 bool m_svc;
676 Mutex m_svcmutex;
677
685 struct Worker
686 {
687 Worker() : cond_(mutex_), ticked_(false) {};
688 Mutex mutex_;
689 Condition cond_;
690 bool ticked_;
691 };
692 // A condition variable for external triggered worker
693 Worker m_worker;
694 int exception_number;
695 }; // class VxWorksInterruptExecutionContext
696} // namespace RTC
697
698
699
700
701extern "C"
702{
719};
720
721#endif // RTC_VXWORKSINTERRUPTEXECUTIONCONTEXT_H
722
ExecutionContext base class.
RTComponent header.
void VxWorksInterruptExecutionContextInit(RTC::Manager *manager)
Register Factory class for this ExecutionContext.
A base class for ExecutionContext.
Definition ExecutionContextBase.h:366
Logger class.
Definition SystemLogger.h:101
Manager class.
Definition Manager.h:91
Definition VxWorksInterruptExecutionContext.h:57
virtual RTC::ReturnCode_t remove_component(RTC::LightweightRTObject_ptr comp)
Remove the RT-Component from participant list.
virtual int open(void *args)
Generate internal activity thread for ExecutionContext.
virtual RTC::ReturnCode_t onWaitingReset(RTC_impl::RTObjectStateMachine *comp, long int count)
onWaitingReset() template function
virtual RTC::ReturnCode_t deactivate_component(RTC::LightweightRTObject_ptr comp)
Deactivate an RT-component.
virtual CORBA::Double get_rate(void)
Get execution rate(Hz) of ExecutionContext.
virtual RTC::LifeCycleState get_component_state(RTC::LightweightRTObject_ptr comp)
Get RT-component's state.
virtual RTC::ReturnCode_t onWaitingActivated(RTC_impl::RTObjectStateMachine *comp, long int count)
onWaitingActivated() template function
virtual RTC::ExecutionContextProfile * get_profile(void)
Get the ExecutionContextProfile.
virtual RTC::ReturnCode_t start(void)
Start the ExecutionContext.
virtual RTC::ReturnCode_t add_component(RTC::LightweightRTObject_ptr comp)
Add an RT-component.
virtual RTC::ReturnCode_t stop(void)
Stop the ExecutionContext.
virtual int close(unsigned long flags)
Thread execution function for ExecutionContext.
virtual void init(coil::Properties &props)
Initialize the ExecutionContext.
void getProperty(coil::Properties &prop, const char *key, T &value)
Definition VxWorksInterruptExecutionContext.h:592
virtual RTC::ReturnCode_t onStarted()
onStarted() template function
virtual int svc(void)
Invoke each component's operation.
virtual RTC::ReturnCode_t reset_component(RTC::LightweightRTObject_ptr comp)
Reset the RT-component.
virtual RTC::ReturnCode_t onAddedComponent(RTC::LightweightRTObject_ptr rtobj)
onAddedComponent() template function
virtual CORBA::Boolean is_running(void)
Check for ExecutionContext running state.
virtual void tick()
Move forward one step of ExecutionContext.
virtual RTC::ReturnCode_t onWaitingDeactivated(RTC_impl::RTObjectStateMachine *comp, long int count)
onWaitingDeactivated() template function
virtual RTC::ReturnCode_t onRemovedComponent(RTC::LightweightRTObject_ptr rtobj)
onRemovedComponent() template function
virtual RTC::ReturnCode_t set_rate(CORBA::Double rate)
Set execution rate(Hz) of ExecutionContext.
virtual RTC::ReturnCode_t activate_component(RTC::LightweightRTObject_ptr comp)
Activate an RT-component.
virtual ~VxWorksInterruptExecutionContext(void)
Destructor.
virtual RTC::ExecutionKind get_kind(void)
Get the ExecutionKind.
Definition RTObjectStateMachine.h:43
RT-Component.