SuperTuxKart
|
Class representing an event that need to pass trough the system. This is used to remove ENet dependency in the network. It interfaces the ENetEvent structure. The user has to be extremely careful about the peer. Indeed, when packets are logged, the state of the peer cannot be stored at all times, and then the user of this class can rely only on the address/port of the peer, and not on values that might change over time. More...
#include <event.hpp>
Public Member Functions | |
Event (ENetEvent *event, std::shared_ptr< STKPeer > peer) | |
~Event () | |
Destructor that frees the memory of the package. | |
EVENT_TYPE | getType () const |
Returns the type of this event. | |
std::shared_ptr< STKPeer > | getPeerSP () const |
Returns the peer of this event (shared pointer). | |
STKPeer * | getPeer () const |
Returns the peer of this event. | |
const NetworkString & | data () const |
Get a const reference to the received data. | |
NetworkString & | data () |
Get a non-const reference to the received data. | |
bool | isSynchronous () const |
Determines if this event should be delivered synchronous or not. | |
uint64_t | getArrivalTime () const |
Returns the arrival time of this event. | |
PeerDisconnectInfo | getPeerDisconnectInfo () const |
Private Attributes | |
NetworkString * | m_data |
Copy of the data passed by the event. | |
EVENT_TYPE | m_type |
Type of the event. | |
std::shared_ptr< STKPeer > | m_peer |
Pointer to the peer that triggered that event. | |
uint64_t | m_arrival_time |
Arrivial time of the event, for timeouts. | |
PeerDisconnectInfo | m_pdi |
For disconnection event, a bit more info is provided. | |
Class representing an event that need to pass trough the system. This is used to remove ENet dependency in the network. It interfaces the ENetEvent structure. The user has to be extremely careful about the peer. Indeed, when packets are logged, the state of the peer cannot be stored at all times, and then the user of this class can rely only on the address/port of the peer, and not on values that might change over time.
|
inline |
Get a non-const reference to the received data.
A copy of the message data. This is empty for events like connection or disconnections.
|
inline |
Get a const reference to the received data.
This is empty for events like connection or disconnections.
|
inline |
Determines if this event should be delivered synchronous or not.
Only messages can be delivered synchronous.