Orxonox  0.0.5 Codename: Arcturus
Classes | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
orxonox::GamestateManager Class Referenceabstract

This Class implements a manager for gamestates: More...

#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/network/GamestateManager.h>

Inheritance diagram for orxonox::GamestateManager:
orxonox::GamestateHandler orxonox::Host orxonox::Client orxonox::Server

Classes

struct  peerInfo
 

Public Member Functions

 GamestateManager ()
 
 ~GamestateManager ()
 
virtual bool ackGamestate (unsigned int gamestateID, unsigned int peerID) override
 Acknowledge a received gamestate. More...
 
virtual bool addGamestate (packet::Gamestate *gs, unsigned int peerID) override
 
void addPeer (uint32_t peerID)
 Add a peer to the game. More...
 
void finishGamestate (unsigned int peerID, packet::Gamestate *&destgamestate, packet::Gamestate *base, packet::Gamestate *gamestate)
 
virtual uint32_t getCurrentGamestateID () override
 
std::vector< packet::Gamestate * > getGamestates ()
 Return a vector with the gamestates of all peers. More...
 
virtual uint32_t getLastReceivedGamestateID (unsigned int peerID) override
 Return the ID of the last received gamestate for a certain peer. More...
 
bool getSnapshot ()
 Update the current gamestate. More...
 
bool hasPeers ()
 
bool processGamestates ()
 Process the queued gamestates. More...
 
void removePeer (uint32_t peerID)
 Remove a peer from the game. More...
 
bool sendAck (unsigned int gamestateID, uint32_t peerID)
 Send Acknowledgement packet. More...
 
void setSynched (uint32_t peerID)
 
bool update ()
 

Protected Member Functions

virtual bool sendPacket (packet::Packet *packet)=0
 
- Protected Member Functions inherited from orxonox::GamestateHandler
 GamestateHandler ()
 
virtual ~GamestateHandler ()
 

Private Member Functions

bool processGamestate (packet::Gamestate *gs)
 Process an incoming Gamestate packet. More...
 

Private Attributes

packet::GamestatecurrentGamestate_
 
std::map< unsigned int, packet::Gamestate * > gamestateQueue
 
unsigned int id_
 
std::map< uint32_t, peerInfopeerMap_
 
ThreadPoolPool_
 

Detailed Description

This Class implements a manager for gamestates:

Inherited by Host

EN/DECODATION: a: last Gamestate a client has received b: new Gamestate x: diffed and compressed gamestate x = (a ^ b) b = (a ^ x) diff(a, diff(a, x)) = x (hope this is correct)

Author
Oliver Scheuss

Constructor & Destructor Documentation

orxonox::GamestateManager::GamestateManager ( )
orxonox::GamestateManager::~GamestateManager ( )

Member Function Documentation

bool orxonox::GamestateManager::ackGamestate ( unsigned int  gamestateID,
unsigned int  peerID 
)
overridevirtual

Acknowledge a received gamestate.

Parameters
gamestateIDThe ID of the gamestate to be acknowledged
peerIDThe ID of the peer to send the Acknowledgement to

Implements orxonox::GamestateHandler.

bool orxonox::GamestateManager::addGamestate ( packet::Gamestate gs,
unsigned int  peerID 
)
overridevirtual
void orxonox::GamestateManager::addPeer ( uint32_t  peerID)

Add a peer to the game.

Parameters
peerIDThe ID of the peer to add.
void orxonox::GamestateManager::finishGamestate ( unsigned int  peerID,
packet::Gamestate *&  destgamestate,
packet::Gamestate base,
packet::Gamestate gamestate 
)
virtual uint32_t orxonox::GamestateManager::getCurrentGamestateID ( )
inlineoverridevirtual
std::vector< packet::Gamestate * > orxonox::GamestateManager::getGamestates ( )

Return a vector with the gamestates of all peers.

uint32_t orxonox::GamestateManager::getLastReceivedGamestateID ( unsigned int  peerID)
overridevirtual

Return the ID of the last received gamestate for a certain peer.

Parameters
peerIDThe ID of the peer\

Implements orxonox::GamestateHandler.

bool orxonox::GamestateManager::getSnapshot ( )

Update the current gamestate.

bool orxonox::GamestateManager::hasPeers ( )
inline
bool orxonox::GamestateManager::processGamestate ( packet::Gamestate gs)
private

Process an incoming Gamestate packet.

Parameters
gsPointer to the incoming Gamestate packet
bool orxonox::GamestateManager::processGamestates ( )

Process the queued gamestates.

void orxonox::GamestateManager::removePeer ( uint32_t  peerID)

Remove a peer from the game.

Parameters
peerIDThe ID of the peer to be removed
bool orxonox::GamestateManager::sendAck ( unsigned int  gamestateID,
uint32_t  peerID 
)

Send Acknowledgement packet.

Parameters
gamestateIdThe gamestate ID we want to acknowledge
peerIDThe ID of the peer we want to send the Acknowledgement to
virtual bool orxonox::GamestateManager::sendPacket ( packet::Packet packet)
protectedpure virtual

Implemented in orxonox::Client, and orxonox::Server.

void orxonox::GamestateManager::setSynched ( uint32_t  peerID)
inline
bool orxonox::GamestateManager::update ( )

Member Data Documentation

packet::Gamestate* orxonox::GamestateManager::currentGamestate_
private
std::map<unsigned int, packet::Gamestate*> orxonox::GamestateManager::gamestateQueue
private
unsigned int orxonox::GamestateManager::id_
private
std::map<uint32_t, peerInfo> orxonox::GamestateManager::peerMap_
private
ThreadPool* orxonox::GamestateManager::Pool_
private

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