#include <nPriorizing.h>
Public Member Functions | |
~nBandwidthSceduler () | |
void | UseBandwidth (REAL dt) |
void | AddArbitrator (nBandwidthArbitrator &arbitrator) |
void | RemoveArbitrator (nBandwidthArbitrator &arbitrator) |
Private Attributes | |
tList< nBandwidthArbitrator, false, true > | arbitratorList_ |
tHeap< nBandwidthArbitrator > | arbitratorHeap_ |
Friends | |
class | nBandwidthArbitrator |
Definition at line 144 of file nPriorizing.h.
nBandwidthSceduler::~nBandwidthSceduler | ( | ) |
Definition at line 281 of file nPriorizing.cpp.
References RemoveArbitrator().
00282 { 00283 while ( this->arbitratorList_.Len() > 0 ) 00284 { 00285 this->RemoveArbitrator( *this->arbitratorList_(0) ); 00286 } 00287 }
void nBandwidthSceduler::UseBandwidth | ( | REAL | dt | ) |
Definition at line 289 of file nPriorizing.cpp.
References arbitratorHeap_, arbitratorList_, tASSERT, and nBandwidthArbitrator::UseBandwidth().
00290 { 00291 int i; 00292 00293 // andvance all timers 00294 for ( i = this->arbitratorList_.Len()-1; i>=0; --i ) 00295 { 00296 this->arbitratorList_(i)->Timestep( dt ); 00297 } 00298 00299 // let the first arbitrator do its job 00300 if ( this->arbitratorHeap_.Len() <= 0 ) 00301 { 00302 return; 00303 } 00304 00305 bool goon = true; 00306 while( goon ) 00307 { 00308 goon = false; 00309 00310 nBandwidthArbitrator* arbitrator = this->arbitratorHeap_(0); 00311 tASSERT( arbitrator ); 00312 00313 goon = arbitrator->UseBandwidth( dt ); 00314 } 00315 }
void nBandwidthSceduler::AddArbitrator | ( | nBandwidthArbitrator & | arbitrator | ) |
Definition at line 318 of file nPriorizing.cpp.
References tList< T, MALLOC, REFERENCE >::Add(), arbitratorHeap_, arbitratorList_, tHeap< T >::Insert(), NULL, nBandwidthArbitrator::sceduler_, and tASSERT.
00319 { 00320 tASSERT( NULL == arbitrator.sceduler_ ); 00321 00322 tJUST_CONTROLLED_PTR< nBandwidthArbitrator > keepalive( &arbitrator ); 00323 00324 this->arbitratorHeap_.Insert( &arbitrator ); 00325 this->arbitratorList_.Add( &arbitrator ); 00326 00327 arbitrator.sceduler_ = this; 00328 }
void nBandwidthSceduler::RemoveArbitrator | ( | nBandwidthArbitrator & | arbitrator | ) |
Definition at line 331 of file nPriorizing.cpp.
References arbitratorHeap_, arbitratorList_, NULL, tList< T, MALLOC, REFERENCE >::Remove(), tHeap< T >::Remove(), nBandwidthArbitrator::sceduler_, and tASSERT.
Referenced by nBandwidthArbitrator::~nBandwidthArbitrator(), and ~nBandwidthSceduler().
00332 { 00333 tASSERT( this == arbitrator.sceduler_ ); 00334 00335 tJUST_CONTROLLED_PTR< nBandwidthArbitrator > keepalive( &arbitrator ); 00336 00337 this->arbitratorHeap_.Remove( &arbitrator ); 00338 this->arbitratorList_.Remove( &arbitrator ); 00339 00340 arbitrator.sceduler_ = NULL; 00341 }
friend class nBandwidthArbitrator [friend] |
Definition at line 146 of file nPriorizing.h.
tList< nBandwidthArbitrator, false, true > nBandwidthSceduler::arbitratorList_ [private] |
Definition at line 155 of file nPriorizing.h.
Referenced by AddArbitrator(), RemoveArbitrator(), and UseBandwidth().
tHeap< nBandwidthArbitrator > nBandwidthSceduler::arbitratorHeap_ [private] |
Definition at line 156 of file nPriorizing.h.
Referenced by AddArbitrator(), nBandwidthArbitrator::Heap(), RemoveArbitrator(), and UseBandwidth().