#include <src/network/TrafficControl.h>
Public Member Functions | |
bool | dataSort (obj i, obj j) |
void | deleteObject (unsigned int objectID) |
void | fixCreatorDependencies (std::list< obj >::iterator it, std::list< obj > &list, unsigned int clientID) |
void | printList (std::list< obj > &list, unsigned int clientID) |
bool | prioritySort (uint32_t clientID, obj i, obj j) |
void | processObjectList (unsigned int clientID, unsigned int gamestateID, std::list< obj > &list) |
void | setConfigValues () |
TrafficControl () | |
Constructor: assures that only one reference will be created and sets the pointer. | |
virtual | ~TrafficControl () |
Destructor: resets the instance pointer to 0. | |
Static Public Member Functions | |
static TrafficControl * | getInstance () |
static void | processAck (unsigned int clientID, unsigned int gamestateID) |
Static Protected Attributes | |
static TrafficControl * | instance_ = 0 |
Private Member Functions | |
void | ack (unsigned int clientID, unsigned int gamestateID) |
virtual void | clientConnected (unsigned int clientID) |
virtual void | clientDisconnected (unsigned int clientID) |
void | cut (std::list< obj > &list, unsigned int targetsize) |
void | evaluateList (unsigned int clientID, std::list< obj > &list) |
void | insertinClientListPerm (unsigned int clientID, obj objinf) |
void | updateClientListTemp (std::list< obj > &list) |
Private Attributes | |
bool | bActive_ |
std::map< unsigned int, std::map< unsigned int, objInfo > > | clientListPerm_ |
std::map< unsigned int, std::map< unsigned int, std::list< obj > > > | clientListTemp_ |
unsigned int | currentClientID |
unsigned int | currentGamestateID |
unsigned int | targetSize |
orxonox::TrafficControl::TrafficControl | ( | ) |
Constructor: assures that only one reference will be created and sets the pointer.
References instance_, RegisterObject, and setConfigValues().
orxonox::TrafficControl::~TrafficControl | ( | ) | [virtual] |
void orxonox::TrafficControl::ack | ( | unsigned int | clientID, | |
unsigned int | gamestateID | |||
) | [private] |
virtual void orxonox::TrafficControl::clientConnected | ( | unsigned int | clientID | ) | [inline, private, virtual] |
Implements orxonox::ClientConnectionListener.
void orxonox::TrafficControl::clientDisconnected | ( | unsigned int | clientID | ) | [private, virtual] |
Implements orxonox::ClientConnectionListener.
References bActive_, clientListPerm_, and clientListTemp_.
void orxonox::TrafficControl::cut | ( | std::list< obj > & | list, | |
unsigned int | targetsize | |||
) | [private] |
cut takes the current list that has to be returned to the gsmanager and shortens it in criteria of bandwidth of clientID(XY)
References clientListPerm_, currentClientID, and orxonox::SCHED_PRIORITY_OFFSET.
Referenced by evaluateList().
sort-algorithm for sorting the objectList after position in original data stream
References orxonox::obj::objDataOffset.
Referenced by evaluateList().
void orxonox::TrafficControl::deleteObject | ( | unsigned int | objectID | ) |
void orxonox::TrafficControl::evaluateList | ( | unsigned int | clientID, | |
std::list< obj > & | list | |||
) | [private] |
evaluates Data given (list) and produces result(->Data to be updated)
evaluateList evaluates whether new obj are there, whether there are things to be updatet and manipulates all this.
References bActive_, clientListPerm_, currentGamestateID, cut(), dataSort(), fixCreatorDependencies(), insertinClientListPerm(), prioritySort(), targetSize, and updateClientListTemp().
Referenced by processObjectList().
void orxonox::TrafficControl::fixCreatorDependencies | ( | std::list< obj >::iterator | it, | |
std::list< obj > & | list, | |||
unsigned int | clientID | |||
) |
References clientListPerm_, orxonox::GAMESTATEID_INITIAL, and orxonox::OBJECTID_UNKNOWN.
Referenced by evaluateList().
TrafficControl * orxonox::TrafficControl::getInstance | ( | ) | [static] |
void orxonox::TrafficControl::insertinClientListPerm | ( | unsigned int | clientID, | |
obj | objinf | |||
) | [private] |
Definition of private members updateClientListPerm returns void
References clientListPerm_, currentGamestateID, orxonox::GAMESTATEID_INITIAL, orxonox::Synchronisable::getPriority(), orxonox::Synchronisable::getSynchronisable(), orxonox::obj::objCreatorID, orxonox::obj::objID, and orxonox::obj::objSize.
Referenced by evaluateList().
void orxonox::TrafficControl::printList | ( | std::list< obj > & | list, | |
unsigned int | clientID | |||
) |
References clientListPerm_, and COUT.
sort-algorithm for sorting the objectlist after priorities
References clientListPerm_, and orxonox::obj::objID.
Referenced by evaluateList().
static void orxonox::TrafficControl::processAck | ( | unsigned int | clientID, | |
unsigned int | gamestateID | |||
) | [inline, static] |
void orxonox::TrafficControl::processObjectList | ( | unsigned int | clientID, | |
unsigned int | gamestateID, | |||
std::list< obj > & | list | |||
) |
References currentClientID, currentGamestateID, and evaluateList().
Referenced by orxonox::packet::Gamestate::doSelection().
void orxonox::TrafficControl::setConfigValues | ( | ) |
is being used by GSManager from Server: list contains: ObjIds, CreatorIds, Size (in this order) from Client XY Elements of list are accessed by *list[i] Elements of struct i are therefore: *list[i].objID
Definition of public members
Reimplemented from orxonox::OrxonoxClass.
References bActive_, SetConfigValue, and targetSize.
Referenced by TrafficControl().
void orxonox::TrafficControl::updateClientListTemp | ( | std::list< obj > & | list | ) | [private] |
updateClientListTemp takes the shortened list which will be sent to the gsmanager and puts the *info into clientListTemp
References clientListTemp_, currentClientID, and currentGamestateID.
Referenced by evaluateList().
bool orxonox::TrafficControl::bActive_ [private] |
Referenced by ack(), clientDisconnected(), evaluateList(), and setConfigValues().
std::map<unsigned int, std::map<unsigned int, objInfo > > orxonox::TrafficControl::clientListPerm_ [private] |
permanent client list: contains client ids, object ids and objectInfos (in this order)
Referenced by ack(), clientDisconnected(), cut(), evaluateList(), fixCreatorDependencies(), insertinClientListPerm(), printList(), and prioritySort().
std::map<unsigned int, std::map<unsigned int, std::list<obj> > > orxonox::TrafficControl::clientListTemp_ [private] |
temporary client list: contains client ids, gamestate ids and object ids (in this order)
Referenced by ack(), clientDisconnected(), and updateClientListTemp().
unsigned int orxonox::TrafficControl::currentClientID [private] |
Referenced by cut(), processObjectList(), and updateClientListTemp().
unsigned int orxonox::TrafficControl::currentGamestateID [private] |
updateReferenceList currentGamestateID and currentClientID will be defined as soon as TrafficControl is being called by Server
Referenced by evaluateList(), insertinClientListPerm(), processObjectList(), and updateClientListTemp().
TrafficControl * orxonox::TrafficControl::instance_ = 0 [static, protected] |
Initializing protected members
Referenced by getInstance(), processAck(), TrafficControl(), and ~TrafficControl().
unsigned int orxonox::TrafficControl::targetSize [private] |
Referenced by evaluateList(), and setConfigValues().