Orxonox: orxonox::GamestateManager Class Reference

# orxonox::GamestateManager Class Reference

`#include <src/network/GamestateManager.h>`

Inheritance diagram for orxonox::GamestateManager:

List of all members.

## Public Member Functions

bool | ack (unsigned int gamestateID, unsigned int clientID)
bool | add (packet::Gamestate *gs, unsigned int clientID)
void | finishGamestate (unsigned int clientID, packet::Gamestate **destgamestate, packet::Gamestate *base, packet::Gamestate *gamestate)
| GamestateManager ()
bool | getSnapshot ()
bool | processGamestates ()
void | removeClient (ClientInformation *client)
void | sendGamestates ()
bool | update ()
| ~GamestateManager ()

## Private Member Functions

bool | processGamestate (packet::Gamestate *gs)

## Private Attributes

std::map< unsigned int, std::map< unsigned int, packet::Gamestate * > > | gamestateMap_
std::map< unsigned int, packet::Gamestate * > | gamestateQueue
unsigned int | id_
ThreadPool * | Pool_
packet::Gamestate * | reference
TrafficControl * | trafficControl_

## Detailed Description

This Class implements a manager for gamestates:

- creating snapshots of gamestates
- writing gamestates to universe
- diffing gamestates 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 | ( |  | ) |

References trafficControl_.

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

References gamestateMap_, gamestateQueue, reference, and trafficControl_.

## Member Function Documentation

bool orxonox::GamestateManager::ack | ( | unsigned int | gamestateID,
|  | unsigned int | clientID |
| ) |  |  | `[virtual]`

Implements orxonox::GamestateHandler.

References orxonox::ACKID_NACK, COUT, orxonox::ClientInformation::findClient(), orxonox::GAMESTATEID_INITIAL, gamestateMap_, orxonox::ClientInformation::getGamestateID(), orxonox::TrafficControl::processAck(), and orxonox::ClientInformation::setGamestateID().

bool orxonox::GamestateManager::add | ( | packet::Gamestate * | gs,
|  | unsigned int | clientID |
| ) |  |  | `[virtual]`

Implements orxonox::GamestateHandler.

References gamestateQueue.

void orxonox::GamestateManager::finishGamestate | ( | unsigned int | clientID,
|  | packet::Gamestate ** | destgamestate,
|  | packet::Gamestate * | base,
|  | packet::Gamestate * | gamestate |
| ) |  |  |

References orxonox::packet::Gamestate::compressData(), orxonox::packet::Gamestate::diff(), orxonox::packet::Gamestate::doSelection(), orxonox::packet::Type::Gamestate, gamestateMap_, orxonox::packet::Gamestate::getID(), and orxonox::packet::Packet::setClientID().

Referenced by sendGamestates().

bool orxonox::GamestateManager::getSnapshot | ( |  | ) |

References orxonox::packet::Gamestate::collectData(), orxonox::packet::Type::Gamestate, id_, and reference.

Referenced by update().

bool orxonox::GamestateManager::processGamestate | ( | packet::Gamestate * | gs | ) | `[private]`

References orxonox::packet::Gamestate::decompressData(), orxonox::packet::Gamestate::isCompressed(), orxonox::packet::Gamestate::isDiffed(), and orxonox::packet::Gamestate::spreadData().

Referenced by processGamestates().

bool orxonox::GamestateManager::processGamestates | ( |  | ) |

References orxonox::NetworkCallbackManager::callCallbacks(), gamestateQueue, and processGamestate().

Referenced by orxonox::Server::update().

void orxonox::GamestateManager::removeClient | ( | ClientInformation * | client | ) |

References gamestateMap_, and orxonox::ClientInformation::getID().

Referenced by orxonox::Server::disconnectClient().

void orxonox::GamestateManager::sendGamestates | ( |  | ) |

References COUT, finishGamestate(), orxonox::GAMESTATEID_INITIAL, gamestateMap_, orxonox::ClientInformation::getBegin(), orxonox::ClientInformation::getGamestateID(), orxonox::ClientInformation::getID(), orxonox::ClientInformation::getPacketLoss(), orxonox::ClientInformation::getRTT(), orxonox::ClientInformation::getSynched(), orxonox::ClientInformation::next(), and reference.

Referenced by orxonox::Server::sendGameState().

bool orxonox::GamestateManager::update | ( |  | ) |

References getSnapshot().

Referenced by orxonox::Server::updateGamestate().

## Member Data Documentation

std::map<unsigned int, std::map<unsigned int, packet::Gamestate*> > orxonox::GamestateManager::gamestateMap_`[private]`

Referenced by ack(), finishGamestate(), removeClient(), sendGamestates(), and ~GamestateManager().

std::map<unsigned int, packet::Gamestate*> orxonox::GamestateManager::gamestateQueue`[private]`

Referenced by add(), processGamestates(), and ~GamestateManager().

unsigned int orxonox::GamestateManager::id_`[private]`

Referenced by getSnapshot().

ThreadPool* orxonox::GamestateManager::Pool_`[private]`

packet::Gamestate* orxonox::GamestateManager::reference`[private]`

Referenced by getSnapshot(), sendGamestates(), and ~GamestateManager().

TrafficControl* orxonox::GamestateManager::trafficControl_`[private]`

Referenced by GamestateManager(), and ~GamestateManager().

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

- src/network/GamestateManager.h
- src/network/GamestateManager.cc