00001 // -*- C++ -*- 00020 #ifndef DataFlowComponentBase_h 00021 #define DataFlowComponentBase_h 00022 00023 #include <memory> 00024 #include <rtc/IRTC.h> 00025 #include <rtc/IDataFlowComponent.h> 00026 00027 namespace RTC 00028 { 00029 namespace Local 00030 { 00040 class DataFlowComponentBase 00041 : public virtual IDataFlowComponent 00042 { 00043 public: 00044 typedef RTC::Local::ReturnCode_t ReturnCode_t; 00045 typedef RTC::Local::ExecutionContextHandle_t ExecutionContextHandle_t; 00046 typedef RTC::Local::ComponentProfile ComponentProfile; 00047 typedef RTC::Local::PortServiceList PortServiceList; 00048 typedef RTC::Local::ExecutionContextList ExecutionContextList; 00049 typedef RTC::Local::IExecutionContext IExecutionContext; 00050 00051 DataFlowComponentBase(); 00052 virtual ~DataFlowComponentBase(); 00053 00054 //------------------------------------------------------------ 00055 // RTObject 00056 //------------------------------------------------------------ 00057 virtual bool is_alive(IExecutionContext& ec); 00058 virtual ReturnCode_t initialize(); 00059 virtual ReturnCode_t finalize(); 00060 virtual ReturnCode_t exit(); 00061 virtual const ComponentProfile& get_component_profile(); 00062 virtual PortServiceList& get_ports(); 00063 virtual ExecutionContextHandle_t attach_context(IExecutionContext& ec); 00064 virtual ReturnCode_t detach_context(ExecutionContextHandle_t ec_handle); 00065 virtual IExecutionContext& get_context(ExecutionContextHandle_t ec_handle); 00066 virtual ExecutionContextList& get_owned_contexts() const; 00067 virtual ExecutionContextList& get_participating_contexts() const; 00068 00069 //------------------------------------------------------------ 00070 // ComponentAction 00071 //------------------------------------------------------------ 00072 virtual ReturnCode_t on_initialize(); 00073 virtual ReturnCode_t on_finalize(); 00074 virtual ReturnCode_t on_startup(ExecutionContextHandle_t ec_handle); 00075 virtual ReturnCode_t on_shutdown(ExecutionContextHandle_t ec_handle); 00076 virtual ReturnCode_t on_activated(ExecutionContextHandle_t ec_handle); 00077 virtual ReturnCode_t on_deactivated(ExecutionContextHandle_t ec_handle); 00078 virtual ReturnCode_t on_aborting(ExecutionContextHandle_t ec_handle); 00079 virtual ReturnCode_t on_error(ExecutionContextHandle_t ec_handle); 00080 virtual ReturnCode_t on_reset(ExecutionContextHandle_t ec_handle); 00081 00082 //------------------------------------------------------------ 00083 // DataFlowComponentAction 00084 //------------------------------------------------------------ 00085 virtual ReturnCode_t on_execute(ExecutionContextHandle_t ec_handle); 00086 virtual ReturnCode_t on_state_update(ExecutionContextHandle_t ec_handle); 00087 virtual ReturnCode_t on_rate_changed(ExecutionContextHandle_t ec_handle); 00088 00089 00090 protected: 00091 00092 private: 00093 class DataFlowComponentImpl; 00094 std::auto_ptr<DataFlowComponentImpl> pimpl; 00095 }; 00096 }; // namespace Local 00097 }; // namespace RTC 00098 #endif // DataFlowComponentBase_h 00099