Robot Devastation
RpcResponder.hpp
1 // Authors: see AUTHORS.md at project root.
2 // CopyPolicy: released under the terms of the LGPLv2.1, see LICENSE at project root.
3 // URL: https://github.com/asrob-uc3m/robotDevastation
4 
5 #ifndef __RD_RPC_RESPONDER__
6 #define __RD_RPC_RESPONDER__
7 
8 #include <map>
9 #include <mutex>
10 
11 #include <yarp/os/PortReader.h>
12 #include <yarp/os/ConnectionReader.h>
13 #include <yarp/os/Port.h>
14 
15 #include "Player.hpp"
16 
17 namespace rd
18 {
19 
25 class RpcResponder : public yarp::os::PortReader
26 {
27 public:
28  void setPlayers(std::map<int,Player> *value, std::map <int,int>* players_belief,
29  std::mutex* players_mutex);
30 
32  static const int MAX_BELIEF;
33 
34 private:
36  virtual bool read(yarp::os::ConnectionReader& connection);
37 
38  yarp::os::Port* rdBroadcast;
39  std::map <int,Player>* players;
40  std::map <int,int>* players_belief;
41  std::mutex* players_mutex;
42 };
43 
44 }
45 
46 #endif
rd::RpcResponder::read
virtual bool read(yarp::os::ConnectionReader &connection)
Implements the actual responder (callback on RPC).
Definition: RpcResponder.cpp:16
rd
The main, catch-all namespace for Robot Devastation.
Definition: groups.dox:4
rd::RpcResponder::MAX_BELIEF
static const int MAX_BELIEF
Timeout [s] / Period [s].
Definition: RpcResponder.hpp:32
rd::RpcResponder
RPC broadcast port.
Definition: RpcResponder.hpp:25