ConsoleIn.cpp
Go to the documentation of this file.
00001 // -*- C++ -*-
00010 #include "ConsoleIn.h"
00011 #include <iostream>
00012 
00013 // Module specification
00014 // <rtc-template block="module_spec">
00015 static const char* consolein_spec[] =
00016   {
00017     "implementation_id", "ConsoleIn",
00018     "type_name",         "ConsoleIn",
00019     "description",       "Console input component",
00020     "version",           "1.0",
00021     "vendor",            "Noriaki Ando, AIST",
00022     "category",          "example",
00023     "activity_type",     "DataFlowComponent",
00024     "max_instance",      "10",
00025     "language",          "C++",
00026     "lang_type",         "compile",
00027     ""
00028   };
00029 // </rtc-template>
00030 
00031 ConsoleIn::ConsoleIn(RTC::Manager* manager)
00032   : RTC::DataFlowComponentBase(manager),
00033     // <rtc-template block="initializer">
00034     m_outOut("out", m_out)
00035     // </rtc-template>
00036 {
00037 }
00038 
00039 ConsoleIn::~ConsoleIn()
00040 {
00041 }
00042 
00043 
00044 RTC::ReturnCode_t ConsoleIn::onInitialize()
00045 {
00046   // Registration: InPort/OutPort/Service
00047   // <rtc-template block="registration">
00048   // Set InPort buffers
00049   
00050   // Set OutPort buffer
00051   addOutPort("out", m_outOut);
00052   
00053   // Set service provider to Ports
00054   
00055   // Set service consumers to Ports
00056   
00057   // Set CORBA Service Ports
00058   
00059   // </rtc-template>
00060 
00061   return RTC::RTC_OK;
00062 }
00063 
00064 RTC::ReturnCode_t ConsoleIn::onExecute(RTC::UniqueId ec_id)
00065 {
00066   std::cout << "Please input number: ";
00067   std::cin >> m_out.data;
00068   std::cout << "Sending to subscriber: " << m_out.data << std::endl;
00069   m_outOut.write();
00070 
00071   return RTC::RTC_OK;
00072 }
00073 
00074 
00075 extern "C"
00076 {
00077  
00078   void ConsoleInInit(RTC::Manager* manager)
00079   {
00080     coil::Properties profile(consolein_spec);
00081     manager->registerFactory(profile,
00082                              RTC::Create<ConsoleIn>,
00083                              RTC::Delete<ConsoleIn>);
00084   }
00085   
00086 };
00087 
00088 


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