Emergency 20 Dokumentation  4.2.0
LocalHost.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"
15 
16 #include <qsf/job/JobProxy.h>
17 
18 #include <memory> // For std::unique_ptr
19 #include <string>
20 
21 
22 //[-------------------------------------------------------]
23 //[ Forward declarations ]
24 //[-------------------------------------------------------]
25 namespace em5
26 {
27  namespace multiplayer
28  {
29  class DataRecorder;
30  class DataPlayer;
31  }
32 }
33 
34 
35 //[-------------------------------------------------------]
36 //[ Namespace ]
37 //[-------------------------------------------------------]
38 namespace em5
39 {
40  namespace multiplayer
41  {
42  namespace client
43  {
44 
45 
46  //[-------------------------------------------------------]
47  //[ Classes ]
48  //[-------------------------------------------------------]
55  {
56 
57 
58  //[-------------------------------------------------------]
59  //[ Public methods ]
60  //[-------------------------------------------------------]
61  public:
69  explicit LocalHost(const std::string& dataPath);
70 
75  virtual ~LocalHost();
76 
77 
78  //[-------------------------------------------------------]
79  //[ Public virtual em5::multiplayer::client::HostBase methods ]
80  //[-------------------------------------------------------]
81  public:
82  virtual bool connect(const std::string& hostOrIpAddress, uint16 port) override;
83  virtual bool sendData(const qsf::game::BitStream& bitStream) override;
84 
85 
86  //[-------------------------------------------------------]
87  //[ Private methods ]
88  //[-------------------------------------------------------]
89  private:
94  bool handleNonIngameOperationMessages(const qsf::game::BitStream& bitStream);
95 
96  void onRealtimeGameClockUpdate(const qsf::JobArguments& jobArguments);
97 
98 
99  //[-------------------------------------------------------]
100  //[ Private data ]
101  //[-------------------------------------------------------]
102  private:
103  std::unique_ptr<DataPlayer> mGamePlayer;
104  std::unique_ptr<DataRecorder> mCommandRecorder;
105  qsf::JobProxy mRealtimeGameClockUpdateJobProxy;
106  qsf::Time mTimePassedSinceStart;
107 
108 
109  };
110 
111 
112 //[-------------------------------------------------------]
113 //[ Namespace ]
114 //[-------------------------------------------------------]
115  } // client
116  } // multiplayer
117 } // em5
Definition: ActionPriority.h:13
Job proxy class.
Definition: JobProxy.h:51
#define EM5_API_EXPORT
Definition: Export.h:28
EMERGENCY 5 multiplayer host base class (represents an host on the client side)
Definition: HostBase.h:50
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
unsigned short uint16
Definition: PlatformTypes.h:178
EMERGENCY 5 multiplayer local host (a special client side multiplayer host instance for testing the d...
Definition: LocalHost.h:54
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32