#include "defs.h"
#include "tHeap.h"
Go to the source code of this file.
Classes | |
class | nBandwidthTaskPriorizer |
class | nBandwidthArbitrator |
class | nBandwidthSceduler |
class | nBandwidthTaskObject |
class | nBandwidthTaskSync |
class | nBandwidthTaskCreate |
Functions | |
tDECLARE_REFOBJ (nBandwidthTask) tDECLARE_REFOBJ(nBandwidthArbitrator) class nBandwidthTask |
tDECLARE_REFOBJ | ( | nBandwidthTask | ) |
Definition at line 41 of file nPriorizing.h.
References buffer, dt, and REAL.
00045 : public tHeapElement, public tReferencable< nBandwidthTask > 00046 { 00047 friend class tReferencable< nBandwidthTask >; 00048 friend class nBandwidthTaskPriorizer; 00049 00050 public: 00051 enum nType 00052 { 00053 Type_System = 0, // extremely important task for the integrety of the connection 00054 Type_Vital = 1, // task important for someone's survival in the game 00055 Type_Casual = 2, // not so important task 00056 Type_Count = 3 00057 }; 00058 00059 void Execute( nSendBuffer& buffer, nBandwidthControl& control ) { this->DoExecute( buffer, control ); } // executes the small task 00060 void Priorize() { if ( this->priorizer_ ) this->DoPriorize(); } // rethinks priority 00061 00062 int EstimateSize ( void ) const { return this->DoEstimateSize(); } // estimate bandwidth usage 00063 00064 nType Type ( void ) const { return type_; } // returns the type of task 00065 REAL Priority ( void ) const { return priority_; } // returns the priority ( event gets important after 1/priority_ seconds ) 00066 00067 void SetType ( nType t ); // sets the task type 00068 void AddPriority ( REAL add ) { priority_ += add; this->Priorize(); } // adds priority 00069 void Timestep ( REAL dt ) { waiting_ += dt; this->Priorize(); } // adds time 00070 00071 protected: 00072 virtual void DoExecute( nSendBuffer& buffer, nBandwidthControl& control ) = 0; // executes whatever it has to do 00073 virtual int DoEstimateSize() const = 0; // estimate bandwidth usage 00074 virtual void DoPriorize(); // rethinks priority 00075 00076 virtual tHeapBase *Heap() const; // in wich heap are we? 00077 00078 virtual ~nBandwidthTask(); 00079 nBandwidthTask( nType type ); 00080 private: 00081 nType type_; // type of this task 00082 REAL priority_; // something terrible happens if this task is not executed within 1/priority_ seconds 00083 REAL waiting_; // time this task is already waiting ( plus small offset ) 00084 nBandwidthTaskPriorizer* priorizer_; // the arbitrator taking care of this task 00085 };