ExtTrigger/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 }
38 
40 {
41 }
42 
43 
45 {
46  // Registration: InPort/OutPort/Service
47  // <rtc-template block="registration">
48  // Set InPort buffers
49 
50  // Set OutPort buffer
51  addOutPort("out", m_outOut);
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  std::cout << "Please input number: ";
67  std::cin >> m_out.data;
68  std::cout << "Sending to subscriber: " << m_out.data << std::endl;
69  m_outOut.write();
70 
71  return RTC::RTC_OK;
72 }
73 
74 
75 extern "C"
76 {
77 
79  {
81  manager->registerFactory(profile,
82  RTC::Create<ConsoleIn>,
83  RTC::Delete<ConsoleIn>);
84  }
85 
86 };
87 
88 
RT-Component.
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:1649
ExecutionContextHandle_t UniqueId
void ConsoleInInit(RTC::Manager *manager)
static const char * consolein_spec[]
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:209
OutPort< TimedLong > m_outOut
bool registerFactory(coil::Properties &profile, RtcNewFunc new_func, RtcDeleteFunc delete_func)
Register RT-Component Factory.
Definition: Manager.cpp:560


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Mon Feb 28 2022 23:00:42