iCub-main
RpcServerImpl.cpp
Go to the documentation of this file.
1 #include <yarp/os/all.h>
2 #include <RpcServerImpl.h>
3 
4 #include <iostream>
5 
7 {
8  answer=-1;
9  running=true;
10 }
11 
13 {
14  std::cout<<"The answer is "<<answer<<std::endl;
15  return answer;
16 }
17 
18 bool RpcServerImpl::set_answer(const int32_t rightAnswer)
19 {
20  if (running)
21  {
22  answer=rightAnswer;
23  return true;
24  }
25  else
26  return false;
27 }
28 
29 int32_t RpcServerImpl::add_int(const int32_t x)
30 {
31  if (running)
32  answer+=x;
33 
34  return answer;
35 }
36 
38 {
39  running=true;
40  return true;
41 }
42 
44 {
45  running=false;
46  return true;
47 }
48 
50 {
51  return running;
52 }
53 
virtual int32_t get_answer()
Get answer from server.
virtual int32_t add_int(const int32_t x)
virtual bool start()
Start service.
virtual bool set_answer(const int32_t rightAnswer)
virtual bool stop()
Stop service.
virtual bool is_running()
Check is service is running.