ExtTrigger/ConsoleOut.cpp
Go to the documentation of this file.
1 // -*- C++ -*-
10 #include "ConsoleOut.h"
11 
12 // Module specification
13 // <rtc-template block="module_spec">
14 static const char* consoleout_spec[] =
15  {
16  "implementation_id", "ConsoleOut",
17  "type_name", "ConsoleOut",
18  "description", "Console output component",
19  "version", "1.0",
20  "vendor", "Noriaki Ando, AIST",
21  "category", "example",
22  "activity_type", "DataFlowComponent",
23  "max_instance", "10",
24  "language", "C++",
25  "lang_type", "compile",
26  ""
27  };
28 // </rtc-template>
29 
31  : RTC::DataFlowComponentBase(manager),
32  // <rtc-template block="initializer">
33  m_inIn("in", m_in)
34 
35  // </rtc-template>
36 {
37 }
38 
40 {
41 }
42 
43 
45 {
46  // Registration: InPort/OutPort/Service
47  // <rtc-template block="registration">
48  // Set InPort buffers
49  addInPort("in", m_inIn);
50 
51  // Set OutPort buffer
52 
53  // Set service provider to Ports
54 
55  // Set service consumers to Ports
56 
57  // Set CORBA Service Ports
58 
59  // </rtc-template>
60 
61  return RTC::RTC_OK;
62 }
63 
65 {
66  if (m_inIn.isNew())
67  {
68  m_inIn.read();
69  std::cout << "Received: " << m_in.data << std::endl;
70  std::cout << "TimeStamp: " << m_in.tm.sec << "[s] ";
71  std::cout << m_in.tm.nsec << "[ns]" << std::endl;
72  }
73  coil::usleep(1000);
74 
75  return RTC::RTC_OK;
76 }
77 
78 
79 extern "C"
80 {
81 
83  {
85  manager->registerFactory(profile,
86  RTC::Create<ConsoleOut>,
87  RTC::Delete<ConsoleOut>);
88  }
89 
90 };
91 
92 
RT-Component.
static const char * consoleout_spec[]
void ConsoleOutInit(RTC::Manager *manager)
DataFlowComponentBase class.
ReturnCode_t
Definition: doil.h:53
Manager class.
Definition: Manager.h:80
ExecutionContextHandle_t UniqueId
virtual RTC::ReturnCode_t onInitialize()
Callback function to initialize.
virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id)
Callback function to execute periodically.
Class represents a set of properties.
Definition: Properties.h:101
ConsoleOut(RTC::Manager *manager)
virtual bool isNew()
Check whether the data is newest.
Definition: InPort.h:225
bool addInPort(const char *name, InPortBase &inport)
[local interface] Register DataInPort
Definition: RTObject.cpp:1604
InPort< TimedLong > m_inIn
bool registerFactory(coil::Properties &profile, RtcNewFunc new_func, RtcDeleteFunc delete_func)
Register RT-Component Factory.
Definition: Manager.cpp:433
bool read()
Readout the value from DataPort.
Definition: InPort.h:378
int usleep(useconds_t usec)
Stop a processing at specified micro second time.
Definition: ace/coil/Time.h:51


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Mon Jun 10 2019 14:07:51