Emergency 20 Dokumentation  4.2.0
LocalClient.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
13 #include "em5/Export.h"
16 
18 
19 #include <qsf/job/JobProxy.h>
20 
21 #include <memory> // For std::unique_ptr
22 #include <string>
23 
24 
25 //[-------------------------------------------------------]
26 //[ Forward declarations ]
27 //[-------------------------------------------------------]
28 namespace em5
29 {
30  namespace multiplayer
31  {
32  class DataRecorder;
33  class DataPlayer;
34  }
35 }
36 
37 
38 //[-------------------------------------------------------]
39 //[ Namespace ]
40 //[-------------------------------------------------------]
41 namespace em5
42 {
43  namespace multiplayer
44  {
45  namespace server
46  {
47 
48 
49  //[-------------------------------------------------------]
50  //[ Classes ]
51  //[-------------------------------------------------------]
58  {
59 
60 
61  //[-------------------------------------------------------]
62  //[ Public methods ]
63  //[-------------------------------------------------------]
64  public:
72  explicit LocalClient(const std::string& dataPath);
73 
78  virtual ~LocalClient();
79 
80  void onConnected();
81 
82 
83  //[-------------------------------------------------------]
84  //[ Public virtual em5::multiplayer::client::ClientBase methods ]
85  //[-------------------------------------------------------]
86  public:
87  virtual void disconnect() override;
88  virtual void disconnect(bool force) override;
89  virtual uint64 getId() const override;
90  virtual bool sendData(const qsf::Clock& simulationClock, const qsf::game::BitStream& bitStream) override;
91  virtual bool sendData(const qsf::game::BitStream& bitStream) override;
92 
93 
94  //[-------------------------------------------------------]
95  //[ Private methods ]
96  //[-------------------------------------------------------]
97  private:
102  void onHandleNonIngameOperationMessages(const qsf::JobArguments& jobArguments);
103 
104  void onRealtimeGameClockUpdate(const qsf::JobArguments& jobArguments);
105 
106 
107  //[-------------------------------------------------------]
108  //[ Private data ]
109  //[-------------------------------------------------------]
110  private:
111  std::unique_ptr<DataRecorder> mGameRecorder;
112  std::unique_ptr<DataPlayer> mCommandPlayer;
113  OperationMessage mNonIngameOperationMessage;
114  qsf::game::BitStream mNonIngameOperationMessageData;
115  qsf::JobProxy mHandleNonIngameOperationMessagesJobProxy;
116  qsf::JobProxy mRealtimeGameClockUpdateJobProxy;
117  qsf::Time mTimePassedSinceStart;
118 
119 
120  };
121 
122 
123 //[-------------------------------------------------------]
124 //[ Namespace ]
125 //[-------------------------------------------------------]
126  } // client
127  } // multiplayer
128 } // em5
Definition: ActionPriority.h:13
Job proxy class.
Definition: JobProxy.h:51
Clock class.
Definition: Clock.h:33
#define EM5_API_EXPORT
Definition: Export.h:28
EMERGENCY 5 multiplayer client base class (represents a client on the server side) ...
Definition: ClientBase.h:52
OperationMessage
EMERGENCY 5 multiplayer operation message types.
Definition: OperationMessages.h:51
uint64_t uint64
Definition: PlatformTypes.h:184
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
Game bit stream class (just a wrapper for linnet bit stream)
Definition: BitStream.h:40
EMERGENCY 5 multiplayer local client (a special server side multiplayer client instance for testing t...
Definition: LocalClient.h:57
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32