14 #include <coil/Async.h> 21 "implementation_id",
"MyServiceConsumer",
22 "type_name",
"MyServiceConsumer",
23 "description",
"MyService Consumer Sample component",
26 "category",
"Generic",
27 "activity_type",
"DataFlowComponent",
30 "lang_type",
"compile",
38 m_MyServicePort(
"MyService"),
40 async_set_value(0), async_echo(0)
110 std::cout << std::endl;
111 std::cout <<
"Command list: " << std::endl;
112 std::cout <<
" echo [msg] : echo message." << std::endl;
113 std::cout <<
" set_value [value]: set value." << std::endl;
114 std::cout <<
" get_value : get current value." << std::endl;
115 std::cout <<
" get_echo_history : get input messsage history." << std::endl;
116 std::cout <<
" get_value_history: get input value history." << std::endl;
120 std::string::size_type pos;
121 std::vector<std::string> argv;
122 std::getline(std::cin, args);
124 pos = args.find_first_of(
" ");
125 if (pos != std::string::npos)
127 argv.push_back(args.substr(0, pos));
128 argv.push_back(args.substr(++pos));
132 argv.push_back(args);
137 std::cout <<
"echo() finished: " <<
m_result << std::endl;
142 if (argv[0] ==
"echo" && argv.size() > 1)
156 std::cout <<
"set_value() still invoking" << std::endl;
161 if (argv[0] ==
"set_value" && argv.size() > 1)
163 CORBA::Float val(atof(argv[1].c_str()));
166 std::cout <<
"Set remote value: " << val << std::endl;
171 if (argv[0] ==
"get_value")
173 std::cout <<
"Current remote value: " 178 if (argv[0] ==
"get_echo_history")
185 if (argv[0] ==
"get_value_history")
192 std::cout <<
"Invalid command or argument(s)." << std::endl;
196 std::cout <<
"No service connected." << std::endl;
246 RTC::Create<MyServiceConsumer>,
247 RTC::Delete<MyServiceConsumer>);
virtual bool finished()=0
Check on completion state.
virtual RTC::ReturnCode_t onInitialize()
Callback function to initialize.
DataFlowComponentBase class.
MyServiceConsumer(RTC::Manager *manager)
RTC::CorbaPort m_MyServicePort
MyService Consumer Sample component.
ExecutionContextHandle_t UniqueId
void MyServiceConsumerInit(RTC::Manager *manager)
CORBA sequence utility template functions.
virtual void invoke()=0
Asynchronous invocation.
virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id)
Callback function to execute periodically.
Class represents a set of properties.
bool addPort(PortBase &port)
[local interface] Register Port
RTC::CorbaConsumer< SimpleService::MyService > m_myservice0
bool registerConsumer(const char *instance_name, const char *type_name, CorbaConsumerBase &consumer)
Register the consumer.
bool registerFactory(coil::Properties &profile, RtcNewFunc new_func, RtcDeleteFunc delete_func)
Register RT-Component Factory.
Functor for_each(CorbaSequence &seq, Functor f)
Apply the functor to all CORBA sequence elements.
static const char * myserviceconsumer_spec[]
Async_t< Object, Func > * AsyncInvoker(Object *obj, Func func, bool auto_delete=false)
Helper function for async member function summons.