SimpleIO/ConsoleIn.h
Go to the documentation of this file.
1 // -*- C++ -*-
10 #ifndef CONSOLEIN_H
11 #define CONSOLEIN_H
12 
13 #include <rtm/Manager.h>
15 #include <rtm/CorbaPort.h>
16 #include <rtm/DataInPort.h>
17 #include <rtm/DataOutPort.h>
18 #include <rtm/idl/BasicDataTypeSkel.h>
19 #include <rtm/ConnectorListener.h>
20 
21 #include <iostream>
22 // Service implementation headers
23 // <rtc-template block="service_impl_h">
24 
25 // </rtc-template>
26 
27 // Service Consumer stub headers
28 // <rtc-template block="consumer_stub_h">
29 
30 // </rtc-template>
31 
32 using namespace RTC;
33 
34 
35 class DataListener
36  : public ConnectorDataListenerT<RTC::TimedLong>
37 {
38 public:
39  DataListener(const char* name) : m_name(name) {}
40  virtual ~DataListener()
41  {
42  std::cout << "dtor of " << m_name << std::endl;
43  }
44 
45  virtual void operator()(const ConnectorInfo& info,
46  const TimedLong& data)
47  {
48  std::cout << "------------------------------" << std::endl;
49  std::cout << "Data Listener: " << m_name << std::endl;
50  std::cout << "Profile::name: " << info.name << std::endl;
51  std::cout << "Profile::id: " << info.id << std::endl;
52 // std::cout << "Profile::properties: " << std::endl;
53 // std::cout << info.properties;
54 // std::cout << std::endl;
55  std::cout << "Data: " << data.data << std::endl;
56  std::cout << "------------------------------" << std::endl;
57  };
58  std::string m_name;
59 };
60 
61 
62 class ConnListener
63  : public ConnectorListener
64 {
65 public:
66  ConnListener(const char* name) : m_name(name) {}
67  virtual ~ConnListener()
68  {
69  std::cout << "dtor of " << m_name << std::endl;
70  }
71 
72  virtual void operator()(const ConnectorInfo& info)
73  {
74  std::cout << "------------------------------" << std::endl;
75  std::cout << "Connector Listener: " << m_name << std::endl;
76  std::cout << "Profile::name: " << info.name << std::endl;
77  std::cout << "Profile::id: " << info.id << std::endl;
78  std::cout << "Profile::properties: " << std::endl;
79  std::cout << info.properties;
80  std::cout << std::endl;
81  std::cout << "------------------------------" << std::endl;
82  };
83  std::string m_name;
84 };
85 
86 
87 class ConsoleIn
89 {
90  public:
92  ~ConsoleIn();
93 
94  // The initialize action (on CREATED->ALIVE transition)
95  // formaer rtc_init_entry()
96  virtual RTC::ReturnCode_t onInitialize();
97 
98  // The finalize action (on ALIVE->END transition)
99  // formaer rtc_exiting_entry()
100  // virtual RTC::ReturnCode_t onFinalize();
101 
102  // The startup action when ExecutionContext startup
103  // former rtc_starting_entry()
104  // virtual RTC::ReturnCode_t onStartup(RTC::UniqueId ec_id);
105 
106  // The shutdown action when ExecutionContext stop
107  // former rtc_stopping_entry()
108  // virtual RTC::ReturnCode_t onShutdown(RTC::UniqueId ec_id);
109 
110  // The activated action (Active state entry action)
111  // former rtc_active_entry()
112  // virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id);
113 
114  // The deactivated action (Active state exit action)
115  // former rtc_active_exit()
116  // virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id);
117 
118  // The execution action that is invoked periodically
119  // former rtc_active_do()
120  virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id);
121 
122  // The aborting action when main logic error occurred.
123  // former rtc_aborting_entry()
124  // virtual RTC::ReturnCode_t onAborting(RTC::UniqueId ec_id);
125 
126  // The error action in ERROR state
127  // former rtc_error_do()
128  // virtual RTC::ReturnCode_t onError(RTC::UniqueId ec_id);
129 
130  // The reset action that is invoked resetting
131  // This is same but different the former rtc_init_entry()
132  // virtual RTC::ReturnCode_t onReset(RTC::UniqueId ec_id);
133 
134  // The state update action that is invoked after onExecute() action
135  // no corresponding operation exists in OpenRTm-aist-0.2.0
136  // virtual RTC::ReturnCode_t onStateUpdate(RTC::UniqueId ec_id);
137 
138  // The action that is invoked when execution context's rate is changed
139  // no corresponding operation exists in OpenRTm-aist-0.2.0
140  // virtual RTC::ReturnCode_t onRateChanged(RTC::UniqueId ec_id);
141 
142 
143  protected:
144  // DataInPort declaration
145  // <rtc-template block="inport_declare">
146 
147  // </rtc-template>
148 
149 
150  // DataOutPort declaration
151  // <rtc-template block="outport_declare">
152  TimedLong m_out;
153  OutPort<TimedLong> m_outOut;
154 
155  // </rtc-template>
156 
157  // CORBA Port declaration
158  // <rtc-template block="corbaport_declare">
159 
160  // </rtc-template>
161 
162  // Service declaration
163  // <rtc-template block="service_declare">
164 
165  // </rtc-template>
166 
167  // Consumer declaration
168  // <rtc-template block="consumer_declare">
169 
170  // </rtc-template>
171 
172  private:
173 
174 };
175 
176 
177 extern "C"
178 {
180 };
181 
182 #endif // CONSOLEIN_H
virtual void operator()(const ConnectorInfo &info, const TimedLong &data)
coil::Properties properties
Connection properties.
RT-Component.
DataFlowComponentBase class.
ReturnCode_t
Definition: doil.h:53
virtual ~ConnListener()
Manager class.
Definition: Manager.h:80
virtual void operator()(const ConnectorInfo &info)
Virtual Callback method.
Base class of OutPort.
CorbaPort class.
DataListener(const char *name)
RTComponent manager class.
ExecutionContextHandle_t UniqueId
ConnectorDataListenerT class.
Base class of InPort.
#define DLL_EXPORT
Definition: PluginC.cpp:8
std::string name
Connection name.
virtual ~DataListener()
ConnListener(const char *name)
connector listener class
DLL_EXPORT void ConsoleInInit(RTC::Manager *manager)
std::string id
ConnectionID.


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Thu Jun 6 2019 19:25:58