00001 // -*- C++ -*- 00007 #ifndef RTSAMPLE_H 00008 #define RTSAMPLE_H 00009 00010 #include <rtm/idl/BasicDataTypeSkel.h> 00011 #include <rtm/Manager.h> 00012 #include <rtm/DataFlowComponentBase.h> 00013 #include <rtm/CorbaPort.h> 00014 #include <rtm/DataInPort.h> 00015 #include <rtm/DataOutPort.h> 00016 00017 #include <coil/TimeMeasure.h> 00018 00019 // Service implementation headers 00020 // <rtc-template block="service_impl_h"> 00021 00022 // </rtc-template> 00023 00024 // Service Consumer stub headers 00025 // <rtc-template block="consumer_stub_h"> 00026 00027 // </rtc-template> 00028 00029 using namespace RTC; 00030 00031 class RTSample : public RTC::DataFlowComponentBase 00032 { 00033 public: 00034 RTSample(RTC::Manager* manager); 00035 ~RTSample(); 00036 00037 // The initialize action (on CREATED->ALIVE transition) 00038 // formaer rtc_init_entry() 00039 virtual RTC::ReturnCode_t onInitialize(); 00040 00041 // The finalize action (on ALIVE->END transition) 00042 // formaer rtc_exiting_entry() 00043 // virtual RTC::ReturnCode_t onFinalize(); 00044 00045 // The startup action when ExecutionContext startup 00046 // former rtc_starting_entry() 00047 // virtual RTC::ReturnCode_t onStartup(RTC::UniqueId ec_id); 00048 00049 // The shutdown action when ExecutionContext stop 00050 // former rtc_stopping_entry() 00051 // virtual RTC::ReturnCode_t onShutdown(RTC::UniqueId ec_id); 00052 00053 // The activated action (Active state entry action) 00054 // former rtc_active_entry() 00055 virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id); 00056 00057 // The deactivated action (Active state exit action) 00058 // former rtc_active_exit() 00059 virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id); 00060 00061 // The execution action that is invoked periodically 00062 // former rtc_active_do() 00063 virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id); 00064 00065 // The aborting action when main logic error occurred. 00066 // former rtc_aborting_entry() 00067 // virtual RTC::ReturnCode_t onAborting(RTC::UniqueId ec_id); 00068 00069 // The error action in ERROR state 00070 // former rtc_error_do() 00071 // virtual RTC::ReturnCode_t onError(RTC::UniqueId ec_id); 00072 00073 // The reset action that is invoked resetting 00074 // This is same but different the former rtc_init_entry() 00075 // virtual RTC::ReturnCode_t onReset(RTC::UniqueId ec_id); 00076 00077 // The state update action that is invoked after onExecute() action 00078 // no corresponding operation exists in OpenRTm-aist-0.2.0 00079 // virtual RTC::ReturnCode_t onStateUpdate(RTC::UniqueId ec_id); 00080 00081 // The action that is invoked when execution context's rate is changed 00082 // no corresponding operation exists in OpenRTm-aist-0.2.0 00083 // virtual RTC::ReturnCode_t onRateChanged(RTC::UniqueId ec_id); 00084 00085 00086 protected: 00087 // Configuration variable declaration 00088 // <rtc-template block="config_declare"> 00089 00090 // </rtc-template> 00091 00092 // DataInPort declaration 00093 // <rtc-template block="inport_declare"> 00094 00095 // </rtc-template> 00096 00097 // DataOutPort declaration 00098 // <rtc-template block="outport_declare"> 00099 00100 // </rtc-template> 00101 00102 // CORBA Port declaration 00103 // <rtc-template block="corbaport_declare"> 00104 00105 // </rtc-template> 00106 00107 // Service declaration 00108 // <rtc-template block="service_declare"> 00109 00110 // </rtc-template> 00111 00112 // Consumer declaration 00113 // <rtc-template block="consumer_declare"> 00114 00115 // </rtc-template> 00116 00117 private: 00118 coil::TimeMeasure m_tm; 00119 00120 }; 00121 00122 00123 extern "C" 00124 { 00125 DLL_EXPORT void RTSampleInit(RTC::Manager* manager); 00126 }; 00127 00128 #endif // RTSAMPLE_H 00129