Go to the documentation of this file.00001
00010 #include "ConsoleOut.h"
00011
00012
00013
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
00029
00030 ConsoleOut::ConsoleOut(RTC::Manager* manager)
00031 : RTC::DataFlowComponentBase(manager),
00032
00033 m_inIn("in", m_in)
00034
00035
00036 {
00037 }
00038
00039 ConsoleOut::~ConsoleOut()
00040 {
00041 }
00042
00043
00044 RTC::ReturnCode_t ConsoleOut::onInitialize()
00045 {
00046
00047
00048
00049 addInPort("in", m_inIn);
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
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