Grail (C++)  1.4.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
LiveDebuggerServer.h
1 // Copyright QED Software 2023.
2 
3 #ifndef GRAIL_LIVE_DEBUGGER_SERVER
4 #define GRAIL_LIVE_DEBUGGER_SERVER
5 
6 #include "../GrailCore/DebugUtilities/IDebugSnapshotReceiver.h"
7 #include "../GrailYamlConverters/YamlConvertersDebug.h"
8 
9 #include "TCPServer.h"
10 #include "UDPServer.h"
11 
12 namespace grail
13 {
14 namespace live
15 {
17  {
18  public:
19  LiveDebuggerServer(const std::string& serverName);
20  virtual ~LiveDebuggerServer() override;
21 
22  void Start();
23  void Stop();
24 
25  protected:
26  const Poco::UInt16 PORT_NUMBER = 6000;
27  TCPServer tcpServer;
28 
29  private:
30  template <typename SnapshotType>
31  void SendSnapshots(SnapshotType snapshot)
32  {
33  if(tcpServer.IsAnyConnected())
34  {
35  std::string serializedSnapshot = c4::yml::writeToString(snapshot);
36  tcpServer.SendToAll(serializedSnapshot);
37  }
38  }
39 
40  UDPServer udpServer;
41  };
42 }
43 }
44 
45 #endif
grail::live::TCPServer
Definition: TCPServer.h:22
grail::live::UDPServer
Definition: UDPServer.h:21
grail::IDebugSnapshotReceiver
Definition: IDebugSnapshotReceiver.h:16
grail::live::LiveDebuggerServer
Definition: LiveDebuggerServer.h:16