|
R-Type
Distributed multiplayer game engine in C++
|
Event representing a network message. More...
#include <NetworkEvent.hpp>


Public Member Functions | |
| NetworkEvent (NetworkMessageType type, std::vector< uint8_t > data) | |
| Construct a network event. | |
| NetworkMessageType | getType () const |
| Get the message type. | |
| const std::vector< uint8_t > & | getData () const |
| Get the message data. | |
| uint64_t | getTimestamp () const |
| Get the timestamp. | |
| void | setTimestamp (uint64_t timestamp) |
| Set the timestamp. | |
| const std::string & | getMessageContent () const |
| Get decoded message content (for convenience) | |
| void | setMessageContent (const std::string &content) |
| Set decoded message content. | |
Public Member Functions inherited from IEvent | |
| virtual | ~IEvent ()=default |
| Virtual destructor. | |
Private Attributes | |
| NetworkMessageType | _type |
| Type of network message. | |
| std::vector< uint8_t > | _data |
| Raw binary data payload. | |
| uint64_t | _timestamp |
| Timestamp for latency measurement. | |
| std::string | _messageContent |
| Decoded message content (optional, for convenience) | |
Event representing a network message.
NetworkEvent encapsulates network messages received from or sent to the server:
Flow:
Definition at line 50 of file NetworkEvent.hpp.
|
inline |
Construct a network event.
| type | Type of network message |
| data | Raw binary data payload |
Definition at line 58 of file NetworkEvent.hpp.
|
inline |
Get the message data.
Definition at line 71 of file NetworkEvent.hpp.
References _data.
Referenced by GameLoop::handleNetworkMessage().
|
inline |
Get decoded message content (for convenience)
Definition at line 89 of file NetworkEvent.hpp.
References _messageContent.
|
inline |
Get the timestamp.
Definition at line 77 of file NetworkEvent.hpp.
References _timestamp.
|
inline |
Get the message type.
Definition at line 65 of file NetworkEvent.hpp.
References _type.
|
inline |
Set decoded message content.
| content | Decoded message |
Definition at line 95 of file NetworkEvent.hpp.
References _messageContent.
Referenced by Replicator::networkThreadLoop().
|
inline |
Set the timestamp.
| timestamp | Time when message was received |
Definition at line 83 of file NetworkEvent.hpp.
References _timestamp.
|
private |
|
private |
Decoded message content (optional, for convenience)
Definition at line 101 of file NetworkEvent.hpp.
Referenced by getMessageContent(), and setMessageContent().
|
private |
Timestamp for latency measurement.
Definition at line 100 of file NetworkEvent.hpp.
Referenced by getTimestamp(), and setTimestamp().
|
private |