PGE API 0.4
PR00F's Game Engine full documentation
Loading...
Searching...
No Matches
PgeClientImpl Class Referencefinal

Detailed Description

Definition at line 20 of file PgeClient.cpp.

+ Inheritance diagram for PgeClientImpl:

Public Member Functions

virtual ~PgeClientImpl ()
 Calls shutdown().
 
bool initialize () override
 Initialize the client subsystem.
 
bool shutdown () override
 This stops the client subsystem.
 
bool isInitialized () const override
 Gets the state of the client subsystem.
 
void disconnect (const std::string &sExtraDebugText="") override
 Terminates the active connection of the client instance.
 
void Update () override
 
bool pollIncomingMessages () override
 Moves incoming packets from the underlying network layer to PGE network layer as PgePackets.
 
void pollConnectionStateChanges () override
 
std::size_t getPacketQueueSize () const override
 
pge_network::PgePacket popFrontPacket () noexcept(false) override
 
std::set< pge_network::PgePktId > & getAllowListedPgeMessages () override
 
std::set< pge_network::MsgApp::TMsgId > & getAllowListedAppMessages () override
 
void send (const pge_network::PgePacket &pkt, const pge_network::PgeNetworkConnectionHandle &connHandle=pge_network::ServerConnHandle) override
 Sends the given packet to the network instance specified.
 
uint32_t getRxPacketCount () const override
 
uint32_t getTxPacketCount () const override
 
uint32_t getInjectPacketCount () const override
 
uint32_t getRxPacketPerSecondCount () const override
 
uint32_t getTxPacketPerSecondCount () const override
 
uint32_t getInjectPacketPerSecondCount () const override
 
const std::map< pge_network::MsgApp::TMsgId, uint32_t > & getRxMsgCount () const override
 
const std::map< pge_network::MsgApp::TMsgId, uint32_t > & getTxMsgCount () const override
 
const std::map< pge_network::MsgApp::TMsgId, uint32_t > & getInjectMsgCount () const override
 
std::map< pge_network::MsgApp::TMsgId, std::string > & getMsgAppId2StringMap () override
 
uint32_t getRxByteCount () const override
 
uint32_t getTxByteCount () const override
 
uint32_t getInjectByteCount () const override
 
void WriteList () const override
 Writes statistics to console.
 
bool connectToServer (const std::string &sServerAddress, const std::string &sAppVersion="") override
 Opens a connection to a server instance.
 
const pge_network::PgeNetworkConnectionHandlegetConnectionHandle () const override
 Returns client's handle to the connection opened towards the server.
 
const pge_network::PgeNetworkConnectionHandlegetConnectionHandleServerSide () const override
 Returns server's handle to the connection opened towards this client.
 
const char * getServerAddress () const override
 
int getPing (bool bForceUpdate) override
 
float getQualityLocal (bool bForceUpdate) override
 
float getQualityRemote (bool bForceUpdate) override
 
float getRxByteRate (bool bForceUpdate) override
 
float getTxByteRate (bool bForceUpdate) override
 
int64_t getPendingUnreliableBytes (bool bForceUpdate) override
 
int64_t getPendingReliableBytes (bool bForceUpdate) override
 
int64_t getSentButUnAckedReliableBytes (bool bForceUpdate) override
 
int64_t getInternalQueueTimeUSecs (bool bForceUpdate) override
 
std::string getDetailedConnectionStatus () const override
 
- Public Member Functions inherited from pge_network::PgeClient
CConsole & getConsole () const
 Returns access to console preset with logger module name as this class.
 
- Public Member Functions inherited from pge_network::PgeIClient
- Public Member Functions inherited from pge_network::PgeIServerClient

Private Member Functions

 PgeClientImpl (PGEcfgProfiles &cfgProfiles)
 
 PgeClientImpl (const PgeClientImpl &)
 
PgeClientImploperator= (const PgeClientImpl &)
 

Private Attributes

PGEcfgProfilesm_cfgProfiles
 
PgeGnsClientm_gnsClient
 

Friends

class pge_network::PgeClient
 

Additional Inherited Members

- Static Public Member Functions inherited from pge_network::PgeClient
static PgeIClientcreateAndGet (PGEcfgProfiles &cfgProfiles)
 Creates and gets the singleton implementation instance.
 
- Static Public Member Functions inherited from pge_network::PgeIClient
static const char * getLoggerModuleName ()
 Returns the logger module name of this class.
 

Constructor & Destructor Documentation

◆ ~PgeClientImpl()

PgeClientImpl::~PgeClientImpl ( )
virtual

Calls shutdown().

Definition at line 111 of file PgeClient.cpp.

◆ PgeClientImpl() [1/2]

PgeClientImpl::PgeClientImpl ( PGEcfgProfiles & cfgProfiles)
explicitprivate

Definition at line 376 of file PgeClient.cpp.

◆ PgeClientImpl() [2/2]

PgeClientImpl::PgeClientImpl ( const PgeClientImpl & other)
private

Definition at line 384 of file PgeClient.cpp.

Member Function Documentation

◆ connectToServer()

bool PgeClientImpl::connectToServer ( const std::string & sServerAddress,
const std::string & sAppVersion = "" )
overridevirtual

Opens a connection to a server instance.

If the function is successful, any call to the derived isInitialized() and isConnected() is expected to return true. Note: you can disconnect from server by invoking the derived disconnect() or shutdown() which are implemented already in hidden class.

Parameters
sServerAddressIPv4 or IPv6 address of PgeServer we want to connect to.
sAppVersionClient application version. If server expects a specific client version, we should fill it here.
Returns
True on success, false otherwise or when it is already connected to server. Note that mismatch between the specified client application version and server application version will be found out later and it does NOT have effect on the return value: the server will disconnect the mismatching client a bit later.

Implements pge_network::PgeIClient.

Definition at line 314 of file PgeClient.cpp.

◆ disconnect()

void PgeClientImpl::disconnect ( const std::string & sExtraDebugText = "")
overridevirtual

Terminates the active connection of the client instance.

Parameters
sExtraDebugTextAn optional text that will be sent to the other side and will be logged to help debugging.

Implements pge_network::PgeIServerClient.

Definition at line 152 of file PgeClient.cpp.

◆ getAllowListedAppMessages()

std::set< pge_network::MsgApp::TMsgId > & PgeClientImpl::getAllowListedAppMessages ( )
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 195 of file PgeClient.cpp.

◆ getAllowListedPgeMessages()

std::set< pge_network::PgePktId > & PgeClientImpl::getAllowListedPgeMessages ( )
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 190 of file PgeClient.cpp.

◆ getConnectionHandle()

const pge_network::PgeNetworkConnectionHandle & PgeClientImpl::getConnectionHandle ( ) const
overridevirtual

Returns client's handle to the connection opened towards the server.

Implements pge_network::PgeIClient.

Definition at line 299 of file PgeClient.cpp.

◆ getConnectionHandleServerSide()

const pge_network::PgeNetworkConnectionHandle & PgeClientImpl::getConnectionHandleServerSide ( ) const
overridevirtual

Returns server's handle to the connection opened towards this client.

Implements pge_network::PgeIClient.

Definition at line 304 of file PgeClient.cpp.

◆ getDetailedConnectionStatus()

std::string PgeClientImpl::getDetailedConnectionStatus ( ) const
overridevirtual

Implements pge_network::PgeIClient.

Definition at line 364 of file PgeClient.cpp.

◆ getInjectByteCount()

uint32_t PgeClientImpl::getInjectByteCount ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 270 of file PgeClient.cpp.

◆ getInjectMsgCount()

const std::map< pge_network::MsgApp::TMsgId, uint32_t > & PgeClientImpl::getInjectMsgCount ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 250 of file PgeClient.cpp.

◆ getInjectPacketCount()

uint32_t PgeClientImpl::getInjectPacketCount ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 220 of file PgeClient.cpp.

◆ getInjectPacketPerSecondCount()

uint32_t PgeClientImpl::getInjectPacketPerSecondCount ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 235 of file PgeClient.cpp.

◆ getInternalQueueTimeUSecs()

int64_t PgeClientImpl::getInternalQueueTimeUSecs ( bool bForceUpdate)
overridevirtual

Implements pge_network::PgeIClient.

Definition at line 359 of file PgeClient.cpp.

◆ getMsgAppId2StringMap()

std::map< pge_network::MsgApp::TMsgId, std::string > & PgeClientImpl::getMsgAppId2StringMap ( )
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 255 of file PgeClient.cpp.

◆ getPacketQueueSize()

std::size_t PgeClientImpl::getPacketQueueSize ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 180 of file PgeClient.cpp.

◆ getPendingReliableBytes()

int64_t PgeClientImpl::getPendingReliableBytes ( bool bForceUpdate)
overridevirtual

Implements pge_network::PgeIClient.

Definition at line 349 of file PgeClient.cpp.

◆ getPendingUnreliableBytes()

int64_t PgeClientImpl::getPendingUnreliableBytes ( bool bForceUpdate)
overridevirtual

Implements pge_network::PgeIClient.

Definition at line 344 of file PgeClient.cpp.

◆ getPing()

int PgeClientImpl::getPing ( bool bForceUpdate)
overridevirtual

Implements pge_network::PgeIClient.

Definition at line 319 of file PgeClient.cpp.

◆ getQualityLocal()

float PgeClientImpl::getQualityLocal ( bool bForceUpdate)
overridevirtual

Implements pge_network::PgeIClient.

Definition at line 324 of file PgeClient.cpp.

◆ getQualityRemote()

float PgeClientImpl::getQualityRemote ( bool bForceUpdate)
overridevirtual

Implements pge_network::PgeIClient.

Definition at line 329 of file PgeClient.cpp.

◆ getRxByteCount()

uint32_t PgeClientImpl::getRxByteCount ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 260 of file PgeClient.cpp.

◆ getRxByteRate()

float PgeClientImpl::getRxByteRate ( bool bForceUpdate)
overridevirtual

Implements pge_network::PgeIClient.

Definition at line 334 of file PgeClient.cpp.

◆ getRxMsgCount()

const std::map< pge_network::MsgApp::TMsgId, uint32_t > & PgeClientImpl::getRxMsgCount ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 240 of file PgeClient.cpp.

◆ getRxPacketCount()

uint32_t PgeClientImpl::getRxPacketCount ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 210 of file PgeClient.cpp.

◆ getRxPacketPerSecondCount()

uint32_t PgeClientImpl::getRxPacketPerSecondCount ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 225 of file PgeClient.cpp.

◆ getSentButUnAckedReliableBytes()

int64_t PgeClientImpl::getSentButUnAckedReliableBytes ( bool bForceUpdate)
overridevirtual

Implements pge_network::PgeIClient.

Definition at line 354 of file PgeClient.cpp.

◆ getServerAddress()

const char * PgeClientImpl::getServerAddress ( ) const
overridevirtual

Implements pge_network::PgeIClient.

Definition at line 309 of file PgeClient.cpp.

◆ getTxByteCount()

uint32_t PgeClientImpl::getTxByteCount ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 265 of file PgeClient.cpp.

◆ getTxByteRate()

float PgeClientImpl::getTxByteRate ( bool bForceUpdate)
overridevirtual

Implements pge_network::PgeIClient.

Definition at line 339 of file PgeClient.cpp.

◆ getTxMsgCount()

const std::map< pge_network::MsgApp::TMsgId, uint32_t > & PgeClientImpl::getTxMsgCount ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 245 of file PgeClient.cpp.

◆ getTxPacketCount()

uint32_t PgeClientImpl::getTxPacketCount ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 215 of file PgeClient.cpp.

◆ getTxPacketPerSecondCount()

uint32_t PgeClientImpl::getTxPacketPerSecondCount ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 230 of file PgeClient.cpp.

◆ initialize()

bool PgeClientImpl::initialize ( )
overridevirtual

Initialize the client subsystem.

Returns
The result of the initialization. True on success, false otherwise.

Implements pge_network::PgeIServerClient.

Definition at line 121 of file PgeClient.cpp.

◆ isInitialized()

bool PgeClientImpl::isInitialized ( ) const
overridevirtual

Gets the state of the client subsystem.

Returns
True if the client subsystem is successfully connected to a server, false otherwise.

Implements pge_network::PgeIServerClient.

Definition at line 142 of file PgeClient.cpp.

◆ operator=()

PgeClientImpl & PgeClientImpl::operator= ( const PgeClientImpl & )
private

Definition at line 390 of file PgeClient.cpp.

◆ pollConnectionStateChanges()

void PgeClientImpl::pollConnectionStateChanges ( )
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 175 of file PgeClient.cpp.

◆ pollIncomingMessages()

bool PgeClientImpl::pollIncomingMessages ( )
overridevirtual

Moves incoming packets from the underlying network layer to PGE network layer as PgePackets.

Returns
True on success, false on error.

Implements pge_network::PgeIServerClient.

Definition at line 166 of file PgeClient.cpp.

◆ popFrontPacket()

pge_network::PgePacket PgeClientImpl::popFrontPacket ( )
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 185 of file PgeClient.cpp.

◆ send()

void PgeClientImpl::send ( const pge_network::PgePacket & pkt,
const pge_network::PgeNetworkConnectionHandle & connHandle = pge_network::ServerConnHandle )
overridevirtual

Sends the given packet to the network instance specified.

Parameters
pktThe packet to be sent.
connHandleThe addressed network instance, that can be either a server or client instance. The default parameter means the addressed instance is the server instance. If server is specified and current instance is the server, the packet will be injected to self instead of actually sending it to the lower network level.

Implements pge_network::PgeIServerClient.

Definition at line 200 of file PgeClient.cpp.

◆ shutdown()

bool PgeClientImpl::shutdown ( )
overridevirtual

This stops the client subsystem.

No effect before initialization. After shutdown, initialize() and connectToServer() can be called again.

Returns
True on successful shutdown, false otherwise.

Implements pge_network::PgeIServerClient.

Definition at line 133 of file PgeClient.cpp.

◆ Update()

void PgeClientImpl::Update ( )
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 157 of file PgeClient.cpp.

◆ WriteList()

void PgeClientImpl::WriteList ( ) const
overridevirtual

Writes statistics to console.

Implements pge_network::PgeIServerClient.

Definition at line 275 of file PgeClient.cpp.

Friends And Related Symbol Documentation

◆ pge_network::PgeClient

friend class pge_network::PgeClient
friend

Definition at line 101 of file PgeClient.cpp.

Member Data Documentation

◆ m_cfgProfiles

PGEcfgProfiles& PgeClientImpl::m_cfgProfiles
private

Definition at line 94 of file PgeClient.cpp.

◆ m_gnsClient

PgeGnsClient& PgeClientImpl::m_gnsClient
private

Definition at line 95 of file PgeClient.cpp.


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