ConsoleOut.cpp
Go to the documentation of this file.
00001 // -*- C++ -*-
00010 #include "ConsoleOut.h"
00011 
00012 // Module specification
00013 // <rtc-template block="module_spec">
00014 static const char* consoleout_spec[] =
00015   {
00016     "implementation_id", "ConsoleOut",
00017     "type_name",         "ConsoleOut",
00018     "description",       "Console output component",
00019     "version",           "1.0",
00020     "vendor",            "Noriaki Ando, AIST",
00021     "category",          "example",
00022     "activity_type",     "DataFlowComponent",
00023     "max_instance",      "10",
00024     "language",          "C++",
00025     "lang_type",         "compile",
00026     ""
00027   };
00028 // </rtc-template>
00029 
00030 ConsoleOut::ConsoleOut(RTC::Manager* manager)
00031   : RTC::DataFlowComponentBase(manager),
00032     // <rtc-template block="initializer">
00033     m_inIn("in", m_in)
00034     
00035     // </rtc-template>
00036 {
00037 }
00038 
00039 ConsoleOut::~ConsoleOut()
00040 {
00041 }
00042 
00043 
00044 RTC::ReturnCode_t ConsoleOut::onInitialize()
00045 {
00046   // Registration: InPort/OutPort/Service
00047   // <rtc-template block="registration">
00048   // Set InPort buffers
00049   addInPort("in", m_inIn);
00050   
00051   // Set OutPort buffer
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 ConsoleOut::onExecute(RTC::UniqueId ec_id)
00065 {
00066   if (m_inIn.isNew())
00067     {
00068       m_inIn.read();
00069       std::cout << "Received: " << m_in.data << std::endl;
00070       std::cout << "TimeStamp: " << m_in.tm.sec << "[s] ";
00071       std::cout << m_in.tm.nsec << "[ns]" << std::endl;
00072     }
00073   coil::usleep(1000);
00074 
00075   return RTC::RTC_OK;
00076 }
00077 
00078 
00079 extern "C"
00080 {
00081  
00082   void ConsoleOutInit(RTC::Manager* manager)
00083   {
00084     coil::Properties profile(consoleout_spec);
00085     manager->registerFactory(profile,
00086                              RTC::Create<ConsoleOut>,
00087                              RTC::Delete<ConsoleOut>);
00088   }
00089   
00090 };
00091 
00092 


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Sat Jun 8 2019 18:49:03