Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

WindowPosition Class Reference

Represents a sequence number and its corresponding position in a sliding window. More...

#include <WindowPosition.h>

Inheritance diagram for WindowPosition::

BasicObject List of all members.

Public Methods

 WindowPosition ()
 Create a WindowPosition starting at zero, window size is set to 1. More...

 WindowPosition (int size, int start=DONT_CARE)
 Create a WindowPosition with a range of zero to size, starting at the location specified. More...

 WindowPosition (const WindowPosition &)
 Copy constructor. More...

virtual ~WindowPosition ()
bool withinRange (WindowPosition start, WindowPosition end)
 Return true if this WindowPosition is between the two passed in. More...

int distanceTo (WindowPosition end)
 Measures the distance from this WindowPosition to the one specified. More...

int getPosition ()
 Returns the current position as an int. More...

int getSeqNum ()
 Return the sequence number. More...

bool operator!= (WindowPosition value)
 Return true if the two window positions are not equal. More...

bool operator== (WindowPosition value)
 Return true if the two window positions are equal. More...

int incrementSeqNum ()
 Adds one to the window position, and wraps around if necessary. More...

int decrementSeqNum ()
 Subtracts one from the window position, and wraps around if necessary. More...

WindowPosition operator= (const WindowPosition &other)
 Same a copy constructor. More...

WindowPosition operator+ (int value)
 Adds the value specified to the window position, and wraps around if necessary. More...

WindowPosition operator- (int value)
 Subtracts the value specified from the window position, and wraps around if necessary. More...

virtual void toStream (std::ostream &)
 Prints current position and size. More...


Private Attributes

int m_seqNum
int m_seqNumSpace
int m_windowSize

Detailed Description

Represents a sequence number and its corresponding position in a sliding window.

Both of these values are counters that must wrap around at some point, and each has a different value at which it wraps around.

Todo:
Add ability to set window size and sequence number space. Remove the constructor with two args, it just needs one. Add a constructor with three arguments.

Definition at line 4 of file WindowPosition.h.


Constructor & Destructor Documentation

WindowPosition::WindowPosition
 

Create a WindowPosition starting at zero, window size is set to 1.

Definition at line 15 of file WindowPosition.cpp.

WindowPosition::WindowPosition int size,
int start = DONT_CARE
 

Create a WindowPosition with a range of zero to size, starting at the location specified.

Definition at line 26 of file WindowPosition.cpp.

WindowPosition::WindowPosition const WindowPosition & other
 

Copy constructor.

Definition at line 48 of file WindowPosition.cpp.

virtual WindowPosition::~WindowPosition [inline, virtual]
 

Definition at line 14 of file WindowPosition.h.


Member Function Documentation

int WindowPosition::decrementSeqNum
 

Subtracts one from the window position, and wraps around if necessary.

Definition at line 83 of file WindowPosition.cpp.

int WindowPosition::distanceTo WindowPosition end
 

Measures the distance from this WindowPosition to the one specified.

Definition at line 197 of file WindowPosition.cpp.

Referenced by SendWindow::computeEffectiveWindow().

int WindowPosition::getPosition
 

Returns the current position as an int.

Definition at line 216 of file WindowPosition.cpp.

Referenced by SendWindow::addPacket(), ReceiveWindow::addPacket(), ReceiveWindow::calcCredits(), ReceiveWindow::calcMaxAck(), ReceiveWindow::canAdd(), ReceiveWindow::getNext(), SendWindow::onAckRecvd(), SendWindow::reliableSend(), SendWindow::sentPacketTimeoutImpl(), SendWindow::toStream(), and ReceiveWindow::toStream().

int WindowPosition::getSeqNum
 

Return the sequence number.

Definition at line 225 of file WindowPosition.cpp.

Referenced by ReceiveWindow::calcMaxAck(), SendWindow::computeEffectiveWindow(), ReceiveWindow::getNext(), SendWindow::onAckRecvd(), SendWindow::reliableSend(), ReceiveWindow::sendAck(), SendWindow::sendEmptyPacket(), and SendWindow::sentPacketTimeoutImpl().

int WindowPosition::incrementSeqNum
 

Adds one to the window position, and wraps around if necessary.

Definition at line 71 of file WindowPosition.cpp.

Referenced by ReceiveWindow::calcCredits(), ReceiveWindow::calcMaxAck(), and ReceiveWindow::getNext().

bool WindowPosition::operator!= WindowPosition value
 

Return true if the two window positions are not equal.

Definition at line 129 of file WindowPosition.cpp.

WindowPosition WindowPosition::operator+ int value
 

Adds the value specified to the window position, and wraps around if necessary.

Definition at line 95 of file WindowPosition.cpp.

WindowPosition WindowPosition::operator- int value
 

Subtracts the value specified from the window position, and wraps around if necessary.

Definition at line 110 of file WindowPosition.cpp.

WindowPosition WindowPosition::operator= const WindowPosition & other
 

Same a copy constructor.

Definition at line 59 of file WindowPosition.cpp.

bool WindowPosition::operator== WindowPosition value
 

Return true if the two window positions are equal.

Definition at line 149 of file WindowPosition.cpp.

void WindowPosition::toStream std::ostream & s [virtual]
 

Prints current position and size.

Reimplemented from BasicObject.

Definition at line 234 of file WindowPosition.cpp.

bool WindowPosition::withinRange WindowPosition start,
WindowPosition end
 

Return true if this WindowPosition is between the two passed in.

The check is inclusive, so that if this WindowPosition falls on a boundary, this will return true. The order of the arguments is very important. If one of the arguments has a DONT_CARE sequence number, this will return true.

Parameters:
start   Lower bound.
end   Upper bound.

Definition at line 163 of file WindowPosition.cpp.

Referenced by ReceiveWindow::calcCredits(), and SendWindow::onAckRecvd().


Member Data Documentation

int WindowPosition::m_seqNum [private]
 

Definition at line 32 of file WindowPosition.h.

int WindowPosition::m_seqNumSpace [private]
 

Definition at line 33 of file WindowPosition.h.

int WindowPosition::m_windowSize [private]
 

Definition at line 34 of file WindowPosition.h.


The documentation for this class was generated from the following files:
Generated at Thu Jul 11 13:32:00 2002 for Peekabooty by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001