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

#include <Session.hpp>

Inheritance diagram for server::Session:
Inheritance graph
Collaboration diagram for server::Session:
Collaboration graph

Public Member Functions

 Session (const std::string &id)
 Constructor.
 
 ~Session () override=default
 
std::string getId () const override
 Get the session ID.
 
bool isActive () const override
 Check if session is active.
 
uint32_t getPlayerId () const
 Get the player ID associated with this session.
 
void setPlayerId (uint32_t playerId)
 Set the player ID for this session.
 
bool isSpectator () const
 Check if this session is a spectator.
 
void setSpectator (bool spectator)
 Set spectator mode for this session.
 
void setActive (bool active)
 Set session active state.
 
- Public Member Functions inherited from server::ISession
virtual ~ISession ()=default
 

Private Attributes

std::string _id
 
uint32_t _playerId
 
bool _active {false}
 
bool _isSpectator {false}
 

Detailed Description

Definition at line 14 of file Session.hpp.

Constructor & Destructor Documentation

◆ Session()

server::Session::Session ( const std::string &  id)
explicit

Constructor.

Parameters
idSession ID (unique identifier)

Definition at line 12 of file Session.cpp.

◆ ~Session()

server::Session::~Session ( )
overridedefault

Member Function Documentation

◆ getId()

std::string server::Session::getId ( ) const
overridevirtual

Get the session ID.

Returns
std::string Session identifier

Implements server::ISession.

Definition at line 14 of file Session.cpp.

References _id.

◆ getPlayerId()

uint32_t server::Session::getPlayerId ( ) const

Get the player ID associated with this session.

Returns
uint32_t Player identifier

Definition at line 22 of file Session.cpp.

References _playerId.

◆ isActive()

bool server::Session::isActive ( ) const
overridevirtual

Check if session is active.

Returns
true if active, false otherwise

Implements server::ISession.

Definition at line 18 of file Session.cpp.

References _active.

◆ isSpectator()

bool server::Session::isSpectator ( ) const

Check if this session is a spectator.

Returns
bool true if spectator, false if player

Definition at line 30 of file Session.cpp.

References _isSpectator.

◆ setActive()

void server::Session::setActive ( bool  active)

Set session active state.

Parameters
activetrue to activate, false to deactivate

Definition at line 38 of file Session.cpp.

References _active.

◆ setPlayerId()

void server::Session::setPlayerId ( uint32_t  playerId)

Set the player ID for this session.

Parameters
playerIdPlayer identifier to associate

Definition at line 26 of file Session.cpp.

References _playerId.

◆ setSpectator()

void server::Session::setSpectator ( bool  spectator)

Set spectator mode for this session.

Parameters
spectatortrue for spectator, false for player

Definition at line 34 of file Session.cpp.

References _isSpectator.

Member Data Documentation

◆ _active

bool server::Session::_active {false}
private

Definition at line 59 of file Session.hpp.

Referenced by isActive(), and setActive().

◆ _id

std::string server::Session::_id
private

Definition at line 57 of file Session.hpp.

Referenced by getId().

◆ _isSpectator

bool server::Session::_isSpectator {false}
private

Definition at line 60 of file Session.hpp.

Referenced by isSpectator(), and setSpectator().

◆ _playerId

uint32_t server::Session::_playerId
private

Definition at line 58 of file Session.hpp.

Referenced by getPlayerId(), and setPlayerId().


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