TDME2  1.9.200
ServerThread.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <vector>
5 
6 #include <tdme/tdme.h>
11 
12 using std::string;
13 using std::vector;
14 
20 
21 /**
22  * Application server thread
23  * @author Andreas Drewke
24  */
26 public:
27  // forbid class copy
29 
30  /**
31  * Public constructor
32  * @param context world
33  * @param server server
34  */
36 
37  /**
38  * @return mutex
39  */
40  Mutex* getMutex();
41 
42 private:
43  static constexpr int32_t VERBOSE_NETWORK { false };
44 
45  Context* context { nullptr };
46  ApplicationServer* server { nullptr };
48 
49  // overridden methods
50  virtual void run() override;
51 
52  /**
53  * Create datagrams
54  * @param safeLogicNetworkPackets safe logic network packets
55  * @param fastLogicNetworkPackets fast logic network packets
56  * @param sendPacketsSafe send packets safe
57  * @param sendPacketsFast send packets fast
58  */
59  void createDatagrams(vector<LogicNetworkPacket>& safeLogicNetworkPackets, vector<LogicNetworkPacket>& fastLogicNetworkPackets, vector<UDPPacket*>& sendPacketsSafe, vector<UDPPacket*>& sendPacketsFast);
60 
61  /**
62  * Get network packets game logic types
63  * @param logicNetworkPackets logic network packets
64  * @return network packet logics string
65  */
66  const string getLogicNetworkPacketsLogicTypes(vector<LogicNetworkPacket>& logicNetworkPackets);
67 };
Application server thread.
Definition: ServerThread.h:25
void createDatagrams(vector< LogicNetworkPacket > &safeLogicNetworkPackets, vector< LogicNetworkPacket > &fastLogicNetworkPackets, vector< UDPPacket * > &sendPacketsSafe, vector< UDPPacket * > &sendPacketsFast)
Create datagrams.
static constexpr int32_t VERBOSE_NETWORK
Definition: ServerThread.h:43
const string getLogicNetworkPacketsLogicTypes(vector< LogicNetworkPacket > &logicNetworkPackets)
Get network packets game logic types.
virtual void run() override
Abstract run() method, should be implemented by subclassed class, will be called after spawn by start...
ServerThread(Context *context, ApplicationServer *server)
Public constructor.
Mutex implementation.
Definition: Mutex.h:19
Base class for threads.
Definition: Thread.h:20
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6