Go to the documentation of this file.00001
00010 #ifndef CONSOLEIN_H
00011 #define CONSOLEIN_H
00012
00013 #include <rtm/Manager.h>
00014 #include <rtm/DataFlowComponentBase.h>
00015 #include <rtm/CorbaPort.h>
00016 #include <rtm/DataInPort.h>
00017 #include <rtm/DataOutPort.h>
00018 #include <rtm/idl/BasicDataTypeSkel.h>
00019 #include <rtm/ConnectorListener.h>
00020
00021 #include <iostream>
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 using namespace RTC;
00033
00034
00035 class DataListener
00036 : public ConnectorDataListenerT<RTC::TimedLong>
00037 {
00038 public:
00039 DataListener(const char* name) : m_name(name) {}
00040 virtual ~DataListener()
00041 {
00042 std::cout << "dtor of " << m_name << std::endl;
00043 }
00044
00045 virtual void operator()(const ConnectorInfo& info,
00046 const TimedLong& data)
00047 {
00048 std::cout << "------------------------------" << std::endl;
00049 std::cout << "Data Listener: " << m_name << std::endl;
00050 std::cout << "Profile::name: " << info.name << std::endl;
00051 std::cout << "Profile::id: " << info.id << std::endl;
00052
00053
00054
00055 std::cout << "Data: " << data.data << std::endl;
00056 std::cout << "------------------------------" << std::endl;
00057 };
00058 std::string m_name;
00059 };
00060
00061
00062 class ConnListener
00063 : public ConnectorListener
00064 {
00065 public:
00066 ConnListener(const char* name) : m_name(name) {}
00067 virtual ~ConnListener()
00068 {
00069 std::cout << "dtor of " << m_name << std::endl;
00070 }
00071
00072 virtual void operator()(const ConnectorInfo& info)
00073 {
00074 std::cout << "------------------------------" << std::endl;
00075 std::cout << "Connector Listener: " << m_name << std::endl;
00076 std::cout << "Profile::name: " << info.name << std::endl;
00077 std::cout << "Profile::id: " << info.id << std::endl;
00078 std::cout << "Profile::properties: " << std::endl;
00079 std::cout << info.properties;
00080 std::cout << std::endl;
00081 std::cout << "------------------------------" << std::endl;
00082 };
00083 std::string m_name;
00084 };
00085
00086
00087 class ConsoleIn
00088 : public RTC::DataFlowComponentBase
00089 {
00090 public:
00091 ConsoleIn(RTC::Manager* manager);
00092 ~ConsoleIn();
00093
00094
00095
00096 virtual RTC::ReturnCode_t onInitialize();
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120 virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id);
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143 protected:
00144
00145
00146
00147
00148
00149
00150
00151
00152 TimedLong m_out;
00153 OutPort<TimedLong> m_outOut;
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172 private:
00173
00174 };
00175
00176
00177 extern "C"
00178 {
00179 DLL_EXPORT void ConsoleInInit(RTC::Manager* manager);
00180 };
00181
00182 #endif // CONSOLEIN_H