Robot Devastation
Server.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_SERVER_HPP__
6 #define __RD_SERVER_HPP__
7 
8 #include <map>
9 #include <mutex>
10 
11 #include <yarp/os/RFModule.h>
12 #include <yarp/os/ResourceFinder.h>
13 #include <yarp/os/RpcServer.h>
14 #include <yarp/os/Port.h>
15 
16 #include "Player.hpp"
17 #include "RpcResponder.hpp"
18 
19 namespace rd{
20 
26 class Server : public yarp::os::RFModule
27 {
28 
29  public:
35  bool configure(yarp::os::ResourceFinder &rf);
36 
43  double getPeriod();
44 
45  virtual ~Server();
46 
47  protected:
48  bool interruptModule();
49  bool updateModule();
50 
52  bool quiet;
53 
54  int serverStatus;
55 
56  std::map <int, Player> players;
57  std::map <int, int> players_belief;
58  std::mutex players_mutex; //-- To work with players & players_belief
59 
60  yarp::os::RpcServer rpcServer;
61  RpcResponder rdRpcResponder;
62  yarp::os::Port rdBroadcast;
63 };
64 
65 } //rd
66 
67 #endif // __RD_SERVER_HPP__
rd
The main, catch-all namespace for Robot Devastation.
Definition: groups.dox:4
rd::Server::configure
bool configure(yarp::os::ResourceFinder &rf)
Run the program.
Definition: Server.cpp:15
rd::Server::getPeriod
double getPeriod()
Definition: Server.cpp:36
rd::Server
The parent Robot Devastation class of the rdServer program.
Definition: Server.hpp:26
rd::RpcResponder
RPC broadcast port.
Definition: RpcResponder.hpp:25
rd::Server::quiet
bool quiet
Definition: Server.hpp:52