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


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Sun Mar 26 2017 03:37:15