SimpleIO/ConsoleIn.cpp
Go to the documentation of this file.
1 // -*- C++ -*-
10 #include "ConsoleIn.h"
11 #include <iostream>
12 
13 // Module specification
14 // <rtc-template block="module_spec">
15 static const char* consolein_spec[] =
16  {
17  "implementation_id", "ConsoleIn",
18  "type_name", "ConsoleIn",
19  "description", "Console input component",
20  "version", "1.0",
21  "vendor", "Noriaki Ando, AIST",
22  "category", "example",
23  "activity_type", "DataFlowComponent",
24  "max_instance", "10",
25  "language", "C++",
26  "lang_type", "compile",
27  ""
28  };
29 // </rtc-template>
30 
32  : RTC::DataFlowComponentBase(manager),
33  // <rtc-template block="initializer">
34  m_outOut("out", m_out)
35  // </rtc-template>
36 {
37  // Registration: InPort/OutPort/Service
38  // <rtc-template block="registration">
39  // Set InPort buffers
40 
41  // Set OutPort buffer
42 
43  // Set service provider to Ports
44 
45  // Set service consumers to Ports
46 
47  // Set CORBA Service Ports
48 
49  // </rtc-template>
50 
51 }
52 
54 {
55 }
56 
57 
59 {
60  addOutPort("out", m_outOut);
61 
63  new DataListener("ON_BUFFER_WRITE"));
65  new DataListener("ON_BUFFER_FULL"));
67  new DataListener("ON_BUFFER_WRITE_TIMEOUT"));
69  new DataListener("ON_BUFFER_OVERWRITE"));
71  new DataListener("ON_BUFFER_READ"));
73  new DataListener("ON_SEND"));
75  new DataListener("ON_RECEIVED"));
77  new DataListener("ON_RECEIVER_FULL"));
79  new DataListener("ON_RECEIVER_TIMEOUT"));
80 
82  new ConnListener("ON_BUFFER_EMPTY"));
84  new ConnListener("ON_BUFFER_READ_TIMEOUT"));
86  new ConnListener("ON_SENDER_EMPTY"));
88  new ConnListener("ON_SENDER_TIMEOUT"));
90  new ConnListener("ON_SENDER_ERROR"));
92  new ConnListener("ON_CONNECT"));
94  new ConnListener("ON_DISCONNECT"));
95 
96 
97  return RTC::RTC_OK;
98 }
100 {
101  std::cout << "Please input number: ";
102  std::cin >> m_out.data;
103  if (m_out.data == 666) return RTC::RTC_ERROR;
104  m_outOut.write();
105 
106  return RTC::RTC_OK;
107 }
108 
109 
110 extern "C"
111 {
112 
114  {
116  manager->registerFactory(profile,
117  RTC::Create<ConsoleIn>,
118  RTC::Delete<ConsoleIn>);
119  }
120 
121 };
122 
123 
#define RTC_ERROR(fmt)
Error log output macro.
Definition: SystemLogger.h:422
void addConnectorDataListener(ConnectorDataListenerType listener_type, ConnectorDataListener *listener, bool autoclean=true)
Adding BufferDataListener type listener.
void addConnectorListener(ConnectorListenerType callback_type, ConnectorListener *listener, bool autoclean=true)
Adding ConnectorListener type listener.
DataFlowComponentBase class.
ReturnCode_t
Definition: doil.h:53
Manager class.
Definition: Manager.h:80
ConsoleIn(RTC::Manager *manager)
bool addOutPort(const char *name, OutPortBase &outport)
[local interface] Register DataOutPort
Definition: RTObject.cpp:1645
ExecutionContextHandle_t UniqueId
void ConsoleInInit(RTC::Manager *manager)
virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id)
Callback function to execute periodically.
Class represents a set of properties.
Definition: Properties.h:101
virtual RTC::ReturnCode_t onInitialize()
Callback function to initialize.
virtual bool write(DataType &value)
Write data.
Definition: OutPort.h:203
OutPort< TimedLong > m_outOut
bool registerFactory(coil::Properties &profile, RtcNewFunc new_func, RtcDeleteFunc delete_func)
Register RT-Component Factory.
Definition: Manager.cpp:433
static const char * consolein_spec[]


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