nBandwidthControl Class Reference

#include <nNetwork.h>

Collaboration diagram for nBandwidthControl:

Collaboration graph
[legend]

List of all members.

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_
nBandwidthControlparent_


Detailed Description

Definition at line 197 of file nNetwork.h.


Member Enumeration Documentation

enum nBandwidthControl::Usage

Enumerator:
Usage_Planning 
Usage_Execution 

Definition at line 200 of file nNetwork.h.

00201     {
00202         Usage_Planning,
00203         Usage_Execution
00204     };


Constructor & Destructor Documentation

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 

Here is the call graph for this function:

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 );


Member Function Documentation

void nBandwidthControl::Reset (  ) 

Definition at line 1996 of file nNetwork.cpp.

Referenced by nBandwidthControl().

01999 {
02000     rateControlPlanned_ = rateControl_ = 1000.0f;

Here is the caller graph for this function:

void nBandwidthControl::SetRate ( unsigned short  rate  )  [inline]

Definition at line 210 of file nNetwork.h.

References rate_.

00210                                                               {
00211         rate_ = rate;
00212     }

unsigned short nBandwidthControl::Rate (  )  [inline]

Definition at line 213 of file nNetwork.h.

References rate_.

00213                                 {
00214         return rate_;
00215     }

REAL nBandwidthControl::Control ( Usage  planned  )  [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     }

Here is the caller graph for this function:

void nBandwidthControl::Use ( Usage  planned,
REAL  bandwidth 
)

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 );

Here is the caller graph for this function:

bool nBandwidthControl::CanSend (  )  [inline]

Definition at line 222 of file nNetwork.h.

References rateControlPlanned_.

Referenced by sn_SendPlanned1().

00222                                          {
00223         return rateControlPlanned_ > 0;
00224     }

Here is the caller graph for this function:

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     }

Here is the caller graph for this function:

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 


Member Data Documentation

REAL nBandwidthControl::rateControlPlanned_ [private]

Definition at line 231 of file nNetwork.h.

Referenced by CanSend(), Control(), and Score().

REAL nBandwidthControl::rateControl_ [private]

Definition at line 232 of file nNetwork.h.

Referenced by Control().

unsigned short nBandwidthControl::rate_ [private]

Definition at line 233 of file nNetwork.h.

Referenced by Rate(), Score(), and SetRate().

nBandwidthControl* nBandwidthControl::parent_ [private]

Definition at line 234 of file nNetwork.h.

Referenced by nBandwidthControl().


The documentation for this class was generated from the following files:
Generated on Sat Mar 15 23:46:52 2008 for Armagetron Advanced by  doxygen 1.5.4