(C++)  1.1.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
LiveDebuggerServer.h
1 #ifndef GRAIL_LIVE_DEBUGGER_SERVER
2 #define GRAIL_LIVE_DEBUGGER_SERVER
3 
4 #include "../GrailCore/DebugUtilities/IDebugSnapshotReceiver.h"
5 #include "../GrailYamlConverters/YamlConvertersDebug.h"
6 
7 #include "TCPServer.h"
8 #include "UDPServer.h"
9 
10 namespace grail
11 {
13  {
14  public:
15  LiveDebuggerServer(const std::string& serverName);
16  ~LiveDebuggerServer() override = default;
17 
18  // IDebugSnapshotReceiver interface
19  void ProcessSnapshot(GrailStateSnapshot& stateSnapshot) override;
20  void ProcessSnapshot(UtilityReasonerSnapshot& utilitySnapshot) override;
21  void ProcessSnapshot(PlannerReasonerSnapshot& plannerSnapshot) override;
22  void ProcessSnapshot(SimulatedGameReasonerSnapshot& simulatedGamesSnapshot) override;
23 
24  private:
25  template <typename SnapshotType>
26  void SendSnapshots(SnapshotType snapshot)
27  {
28  if(tcpServer.IsAnyConnected())
29  {
30  std::string serializedSnapshot = c4::yml::writeToString(snapshot);
31  tcpServer.SendToAll(serializedSnapshot);
32  }
33  }
34 
35  const Poco::UInt16 PORT_NUMBER = 6000;
36  TCPServer tcpServer;
37  UDPServer udpServer;
38  };
39 }
40 
41 #endif
Definition: IDebugSnapshotReceiver.h:7
Definition: LiveDebuggerServer.h:13
Definition: TCPServer.h:18
Definition: UDPServer.h:17
Definition: GrailStateSnapshot.h:14
Definition: PlannerSnapshots.h:70
Definition: SimulatedGamesSnapshots.h:95
Definition: UtilityReasonerSnapshot.h:11