00001 // -*- C++ -*- 00010 #ifndef SEQIN_H 00011 #define SEQIN_H 00012 00013 #include <rtm/idl/BasicDataTypeSkel.h> 00014 #include <rtm/Manager.h> 00015 #include <rtm/DataFlowComponentBase.h> 00016 #include <rtm/CorbaPort.h> 00017 #include <rtm/DataInPort.h> 00018 #include <rtm/DataOutPort.h> 00019 00020 // Service implementation headers 00021 // <rtc-template block="service_impl_h"> 00022 00023 // </rtc-template> 00024 00025 // Service Consumer stub headers 00026 // <rtc-template block="consumer_stub_h"> 00027 00028 // </rtc-template> 00029 00030 using namespace RTC; 00031 00032 extern bool g_Listener_dump_enabled; 00033 00034 class DataListener 00035 : public ConnectorDataListenerT<RTC::TimedLong> 00036 { 00037 public: 00038 DataListener(const char* name) : m_name(name) {} 00039 virtual ~DataListener() 00040 { 00041 // Connector Listener Dump check 00042 if(g_Listener_dump_enabled) 00043 { 00044 std::cout << "dtor of " << m_name << std::endl; 00045 } 00046 } 00047 00048 virtual void operator()(const ConnectorInfo& info, 00049 const TimedLong& data) 00050 { 00051 // Connector Listener Dump check 00052 if(g_Listener_dump_enabled) 00053 { 00054 std::cout << "------------------------------" << std::endl; 00055 std::cout << "Data Listener: " << m_name << std::endl; 00056 std::cout << "Profile::name: " << info.name << std::endl; 00057 std::cout << "Profile::id: " << info.id << std::endl; 00058 // std::cout << "Profile::properties: " << std::endl; 00059 // std::cout << info.properties; 00060 // std::cout << std::endl; 00061 std::cout << "Data: " << data.data << std::endl; 00062 std::cout << "------------------------------" << std::endl; 00063 } 00064 }; 00065 std::string m_name; 00066 }; 00067 00068 00069 class ConnListener 00070 : public ConnectorListener 00071 { 00072 public: 00073 ConnListener(const char* name) : m_name(name) {} 00074 virtual ~ConnListener() 00075 { 00076 // Connector Listener Dump check 00077 if(g_Listener_dump_enabled) 00078 { 00079 std::cout << "dtor of " << m_name << std::endl; 00080 } 00081 } 00082 00083 virtual void operator()(const ConnectorInfo& info) 00084 { 00085 // Connector Listener Dump check 00086 if(g_Listener_dump_enabled) 00087 { 00088 std::cout << "------------------------------" << std::endl; 00089 std::cout << "Connector Listener: " << m_name << std::endl; 00090 std::cout << "Profile::name: " << info.name << std::endl; 00091 std::cout << "Profile::id: " << info.id << std::endl; 00092 std::cout << "Profile::properties: " << std::endl; 00093 std::cout << info.properties; 00094 std::cout << std::endl; 00095 std::cout << "------------------------------" << std::endl; 00096 } 00097 }; 00098 std::string m_name; 00099 }; 00100 00101 00102 class SeqIn 00103 : public RTC::DataFlowComponentBase 00104 { 00105 public: 00106 SeqIn(RTC::Manager* manager); 00107 ~SeqIn(); 00108 00109 // The initialize action (on CREATED->ALIVE transition) 00110 // formaer rtc_init_entry() 00111 virtual RTC::ReturnCode_t onInitialize(); 00112 00113 // The finalize action (on ALIVE->END transition) 00114 // formaer rtc_exiting_entry() 00115 // virtual RTC::ReturnCode_t onFinalize(); 00116 00117 // The startup action when ExecutionContext startup 00118 // former rtc_starting_entry() 00119 // virtual RTC::ReturnCode_t onStartup(RTC::UniqueId ec_id); 00120 00121 // The shutdown action when ExecutionContext stop 00122 // former rtc_stopping_entry() 00123 // virtual RTC::ReturnCode_t onShutdown(RTC::UniqueId ec_id); 00124 00125 // The activated action (Active state entry action) 00126 // former rtc_active_entry() 00127 // virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id); 00128 00129 // The deactivated action (Active state exit action) 00130 // former rtc_active_exit() 00131 // virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id); 00132 00133 // The execution action that is invoked periodically 00134 // former rtc_active_do() 00135 virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id); 00136 00137 // The aborting action when main logic error occurred. 00138 // former rtc_aborting_entry() 00139 // virtual RTC::ReturnCode_t onAborting(RTC::UniqueId ec_id); 00140 00141 // The error action in ERROR state 00142 // former rtc_error_do() 00143 // virtual RTC::ReturnCode_t onError(RTC::UniqueId ec_id); 00144 00145 // The reset action that is invoked resetting 00146 // This is same but different the former rtc_init_entry() 00147 // virtual RTC::ReturnCode_t onReset(RTC::UniqueId ec_id); 00148 00149 // The state update action that is invoked after onExecute() action 00150 // no corresponding operation exists in OpenRTm-aist-0.2.0 00151 // virtual RTC::ReturnCode_t onStateUpdate(RTC::UniqueId ec_id); 00152 00153 // The action that is invoked when execution context's rate is changed 00154 // no corresponding operation exists in OpenRTm-aist-0.2.0 00155 // virtual RTC::ReturnCode_t onRateChanged(RTC::UniqueId ec_id); 00156 00157 00158 protected: 00159 // DataInPort declaration 00160 // <rtc-template block="inport_declare"> 00161 TimedOctet m_Octet; 00162 InPort<TimedOctet> m_OctetIn; 00163 TimedShort m_Short; 00164 InPort<TimedShort> m_ShortIn; 00165 TimedLong m_Long; 00166 InPort<TimedLong> m_LongIn; 00167 TimedFloat m_Float; 00168 InPort<TimedFloat> m_FloatIn; 00169 TimedDouble m_Double; 00170 InPort<TimedDouble> m_DoubleIn; 00171 TimedOctetSeq m_OctetSeq; 00172 InPort<TimedOctetSeq> m_OctetSeqIn; 00173 TimedShortSeq m_ShortSeq; 00174 InPort<TimedShortSeq> m_ShortSeqIn; 00175 TimedLongSeq m_LongSeq; 00176 InPort<TimedLongSeq> m_LongSeqIn; 00177 TimedFloatSeq m_FloatSeq; 00178 InPort<TimedFloatSeq> m_FloatSeqIn; 00179 TimedDoubleSeq m_DoubleSeq; 00180 InPort<TimedDoubleSeq> m_DoubleSeqIn; 00181 00182 // </rtc-template> 00183 00184 00185 // DataOutPort declaration 00186 // <rtc-template block="outport_declare"> 00187 00188 // </rtc-template> 00189 00190 // CORBA Port declaration 00191 // <rtc-template block="corbaport_declare"> 00192 00193 // </rtc-template> 00194 00195 // Service declaration 00196 // <rtc-template block="service_declare"> 00197 00198 // </rtc-template> 00199 00200 // Consumer declaration 00201 // <rtc-template block="consumer_declare"> 00202 00203 // </rtc-template> 00204 00205 private: 00206 00207 }; 00208 00209 00210 extern "C" 00211 { 00212 DLL_EXPORT void SeqInInit(RTC::Manager* manager); 00213 }; 00214 00215 #endif // SEQIN_H