20 #ifndef RTC_PERIODICEXECUTIONCONTEXT_H
21 #define RTC_PERIODICEXECUTIONCONTEXT_H
30 #include <rtm/idl/RTCSkel.h>
31 #include <rtm/idl/OpenRTMSkel.h>
36 #define NUM_OF_LIFECYCLESTATE 4
39 #pragma warning( disable : 4290 )
113 double rate = 1000.0);
175 virtual int open(
void *args);
196 virtual int svc(
void);
225 virtual int close(
unsigned long flags);
255 throw (CORBA::SystemException);
284 virtual ReturnCode_t
start(
void)
285 throw (CORBA::SystemException);
313 virtual ReturnCode_t
stop(
void)
314 throw (CORBA::SystemException);
336 virtual CORBA::Double
get_rate(
void)
337 throw (CORBA::SystemException);
368 virtual ReturnCode_t
set_rate(CORBA::Double rate)
369 throw (CORBA::SystemException);
405 throw (CORBA::SystemException);
440 throw (CORBA::SystemException);
474 throw (CORBA::SystemException);
503 throw (CORBA::SystemException);
524 virtual ExecutionKind
get_kind(
void)
525 throw (CORBA::SystemException);
558 virtual ReturnCode_t
add_component(LightweightRTObject_ptr comp)
559 throw (CORBA::SystemException);
611 throw (CORBA::SystemException);
633 throw (CORBA::SystemException);
648 typedef RTC_Utils::StateHolder<ExecContextState>
ECStates;
694 m_sm.setListener(
this);
704 st.
prev = INACTIVE_STATE;
705 st.
curr = INACTIVE_STATE;
706 st.
next = INACTIVE_STATE;
707 m_sm.setStartState(st);
708 m_sm.goTo(INACTIVE_STATE);
742 virtual void on_startup(
void) = 0;
760 virtual void on_shutdown(
void) = 0;
783 virtual void on_activated(
const ECStates& st) = 0;
806 virtual void on_deactivated(
const ECStates& st) = 0;
829 virtual void on_aborting(
const ECStates& st) = 0;
856 virtual void on_error(
const ECStates& st) = 0;
883 virtual void on_reset(
const ECStates& st) = 0;
911 virtual void on_execute(
const ECStates& st) = 0;
939 virtual void on_state_update(
const ECStates& st) = 0;
958 virtual void on_rate_changed(
void) = 0;
978 virtual void worker(
void) {
return m_sm.worker();}
997 virtual ExecContextState
get_state(
void){
return m_sm.getState();}
1046 template <
class Object>
1070 DFP(Object obj, ExecutionContextHandle_t
id)
1139 if (
m_obj->on_activated(
ec_id) != RTC::RTC_OK)
1141 m_sm.goTo(ERROR_STATE);
1243 m_sm.goTo(ERROR_STATE);
1278 m_sm.goTo(ERROR_STATE);
1311 if (
m_obj->on_state_update(
ec_id) != RTC::RTC_OK)
1313 m_sm.goTo(ERROR_STATE);
1369 Comp(LightweightRTObject_ptr ref, OpenRTM::DataFlowComponent_ptr dfp,
1370 ExecutionContextHandle_t
id)
1371 :
_ref(LightweightRTObject::_duplicate(ref)),
1372 _sm(OpenRTM::DataFlowComponent::_duplicate(dfp), id)
1404 :
m_comp(LightweightRTObject::_duplicate(comp)) {}
1574 RTObject_var m_comp;
1577 : m_comp(RTObject::_duplicate(comp)) {}
1580 return m_comp->_is_equivalent(comp);
1587 #pragma warning( default : 4290 )
1603 #endif // RTC_PERIODICEXECUTIONCONTEXT_H