#include <nNetwork.h>
Public Types | |
enum | Usage { Usage_Planning, Usage_Execution } |
Public Member Functions | |
nBandwidthControl (nBandwidthControl *parent=NULL) | |
~nBandwidthControl () | |
void | Reset () |
void | SetRate (unsigned short rate) |
unsigned short | Rate () |
REAL | Control (Usage planned) |
void | Use (Usage planned, REAL bandwidth) |
bool | CanSend () |
REAL | Score () |
void | Update (REAL ts) |
Private Attributes | |
REAL | rateControlPlanned_ |
REAL | rateControl_ |
unsigned short | rate_ |
nBandwidthControl * | parent_ |
Definition at line 197 of file nNetwork.h.
Definition at line 200 of file nNetwork.h.
00201 { 00202 Usage_Planning, 00203 Usage_Execution 00204 };
nBandwidthControl::nBandwidthControl | ( | nBandwidthControl * | parent = NULL |
) |
Definition at line 1973 of file nNetwork.cpp.
References parent_, and Reset().
01976 { 01977 #ifdef DEBUG 01978 if ( parent ) 01979 parent->numChildren_ ++; 01980 numChildren_ = 0; 01981 #endif 01982 01983 parent_ = parent; 01984
nBandwidthControl::~nBandwidthControl | ( | ) |
Definition at line 1986 of file nNetwork.cpp.
01989 { 01990 #ifdef DEBUG 01991 if ( parent_ ) 01992 parent_->numChildren_ --; 01993 01994 tASSERT( numChildren_ == 0 );
void nBandwidthControl::Reset | ( | ) |
Definition at line 1996 of file nNetwork.cpp.
Referenced by nBandwidthControl().
01999 { 02000 rateControlPlanned_ = rateControl_ = 1000.0f;
void nBandwidthControl::SetRate | ( | unsigned short | rate | ) | [inline] |
unsigned short nBandwidthControl::Rate | ( | ) | [inline] |
Definition at line 217 of file nNetwork.h.
References rateControl_, rateControlPlanned_, and Usage_Planning.
Referenced by nNetObject::SyncAll().
00217 { 00218 return Usage_Planning == planned ? rateControlPlanned_ : rateControl_; 00219 }
Definition at line 2002 of file nNetwork.cpp.
Referenced by nSendBuffer::AddMessage(), nSendBuffer::Broadcast(), and nSendBuffer::Send().
02005 { 02006 tRecorderSync< REAL >::Archive( "_RATE_CONTROL_USAGE", 4, bandwidth );
bool nBandwidthControl::CanSend | ( | ) | [inline] |
Definition at line 222 of file nNetwork.h.
References rateControlPlanned_.
Referenced by sn_SendPlanned1().
00222 { 00223 return rateControlPlanned_ > 0; 00224 }
REAL nBandwidthControl::Score | ( | ) | [inline] |
Definition at line 225 of file nNetwork.h.
References rate_, and rateControlPlanned_.
Referenced by nBandwidthArbitrator::Fill().
00225 { 00226 return rateControlPlanned_ / rate_; 00227 }
void nBandwidthControl::Update | ( | REAL | ts | ) |
Definition at line 2008 of file nNetwork.cpp.
02011 { 02012 tRecorderSync< REAL >::Archive( "_RATE_CONTROL", 12, rateControl_ ); 02013 tRecorderSync< REAL >::Archive( "_RATE_CONTROL_PLANNED", 12, rateControlPlanned_ ); 02014 02015 rateControl_ += ( rate_ * 1000 ) * ts; 02016 02017 if ( rateControl_ > 1000.0f ) 02018 { 02019 rateControl_ = 1000.0f; 02020 } 02021
REAL nBandwidthControl::rateControlPlanned_ [private] |
REAL nBandwidthControl::rateControl_ [private] |
unsigned short nBandwidthControl::rate_ [private] |
nBandwidthControl* nBandwidthControl::parent_ [private] |