R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
server::NetworkEvent Class Reference

Base class for all network-related events. More...

#include <NetworkEvent.hpp>

Inheritance diagram for server::NetworkEvent:
Inheritance graph
Collaboration diagram for server::NetworkEvent:
Collaboration graph

Public Types

enum class  Type {
  UNKNOWN , CLIENT_CONNECTED , CLIENT_DISCONNECTED , MESSAGE_RECEIVED ,
  MESSAGE_SENT
}
 

Public Member Functions

 NetworkEvent (Type type, int clientId=-1)
 
virtual ~NetworkEvent () override=default
 
Type getType () const
 Get the type of the network event.
 
int getClientId () const
 Get the ID of the client related to this event.
 
- Public Member Functions inherited from server::IEvent
 IEvent ()=default
 
virtual ~IEvent ()=default
 

Private Attributes

Type _type {Type::UNKNOWN}
 
int _clientId {-1}
 

Detailed Description

Base class for all network-related events.

Represents events related to client-server communication.

Definition at line 21 of file NetworkEvent.hpp.

Member Enumeration Documentation

◆ Type

enum class server::NetworkEvent::Type
strong
Enumerator
UNKNOWN 
CLIENT_CONNECTED 
CLIENT_DISCONNECTED 
MESSAGE_RECEIVED 
MESSAGE_SENT 

Definition at line 23 of file NetworkEvent.hpp.

Constructor & Destructor Documentation

◆ NetworkEvent()

NetworkEvent::NetworkEvent ( Type  type,
int  clientId = -1 
)
explicit

Definition at line 12 of file NetworkEvent.cpp.

◆ ~NetworkEvent()

virtual server::NetworkEvent::~NetworkEvent ( )
overridevirtualdefault

Member Function Documentation

◆ getClientId()

int NetworkEvent::getClientId ( ) const

Get the ID of the client related to this event.

Definition at line 18 of file NetworkEvent.cpp.

References _clientId.

◆ getType()

NetworkEvent::Type NetworkEvent::getType ( ) const

Get the type of the network event.

Definition at line 14 of file NetworkEvent.cpp.

References _type.

Member Data Documentation

◆ _clientId

int server::NetworkEvent::_clientId {-1}
private

Definition at line 40 of file NetworkEvent.hpp.

Referenced by getClientId().

◆ _type

Type server::NetworkEvent::_type {Type::UNKNOWN}
private

Definition at line 39 of file NetworkEvent.hpp.

Referenced by getType().


The documentation for this class was generated from the following files: