User Manual, Developers Guide and API Documentation

wns::container::Pool< ID > Class Template Reference

Bookkeeping for TCP ports. More...

#include <container/Pool.hpp>

Inheritance diagram for wns::container::Pool< ID >:

Inheritance graph
[legend]
Collaboration diagram for wns::container::Pool< ID >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void bind (ID id)
 Tell the pool this Port is used.
int getCapacity () const
simTimeType getUnbindDelay () const
 Get the unbindDelay for this PortPool.
bool isAvailable (ID id) const
 Check if a Port is still available.
 Pool (simTimeType _unbindDelay, ID _lowestId, ID _highestId)
 Full Pool (all 65535 Ports are available == in the pool).
ID suggestPort () const
 Suggest a free port (will not bind the port!).
void unbind (ID id)
 Tell the pool this Port is not used any longer.
virtual ~Pool ()
 Destructor.

Private Types

typedef std::set< ID > PoolContainer

Private Attributes

PoolContainer boundIds
 Keeps track of bound ports.
ID highestId
 The highest possible port number (2^16 - 1).
ID lowestId
 The highest possible port number (2^16 - 1).
int maximumCapacity
 The number of IDs that may be bound.
simTimeType unbindDelay
 The delay between call to unbind and the time instance when the port is returned to the port pool.

Classes

class  Unbind
 Unbind event which is used to delay the port reuse. More...


Detailed Description

template<typename ID>
class wns::container::Pool< ID >

Available Ports range from 1 to 65535. O is not available!

Definition at line 48 of file Pool.hpp.


Member Typedef Documentation

template<typename ID>
typedef std::set<ID> wns::container::Pool< ID >::PoolContainer [private]

Definition at line 50 of file Pool.hpp.


Constructor & Destructor Documentation

template<typename ID>
wns::container::Pool< ID >::Pool ( simTimeType  _unbindDelay,
ID  _lowestId,
ID  _highestId 
) [inline, explicit]

Parameters:
[in] unbindDelay When ports are freed they are returned to the port pool after unbindDelay time has passed.

Definition at line 58 of file Pool.hpp.

template<typename ID>
virtual wns::container::Pool< ID >::~Pool (  )  [inline, virtual]

Definition at line 77 of file Pool.hpp.


Member Function Documentation

template<typename ID>
void wns::container::Pool< ID >::bind ( ID  id  )  [inline]

Definition at line 83 of file Pool.hpp.

template<typename ID>
int wns::container::Pool< ID >::getCapacity (  )  const [inline]

Definition at line 149 of file Pool.hpp.

template<typename ID>
simTimeType wns::container::Pool< ID >::getUnbindDelay (  )  const [inline]

Returns:
unbindDelay

Definition at line 161 of file Pool.hpp.

template<typename ID>
bool wns::container::Pool< ID >::isAvailable ( ID  id  )  const [inline]

Returns:
true if Port is available, false else

Definition at line 141 of file Pool.hpp.

template<typename ID>
ID wns::container::Pool< ID >::suggestPort (  )  const [inline]

Parameters:
[in] lowerBorder start search from here (default 1024)
Use suggestPort() with bind() in combination:
 Port p = portPool.suggestPort();
 portPool.bind(p);

Definition at line 117 of file Pool.hpp.

template<typename ID>
void wns::container::Pool< ID >::unbind ( ID  id  )  [inline]

Definition at line 96 of file Pool.hpp.


Member Data Documentation

template<typename ID>
PoolContainer wns::container::Pool< ID >::boundIds [private]

Definition at line 212 of file Pool.hpp.

template<typename ID>
ID wns::container::Pool< ID >::highestId [private]

Definition at line 217 of file Pool.hpp.

template<typename ID>
ID wns::container::Pool< ID >::lowestId [private]

Definition at line 222 of file Pool.hpp.

template<typename ID>
int wns::container::Pool< ID >::maximumCapacity [private]

Definition at line 227 of file Pool.hpp.

template<typename ID>
simTimeType wns::container::Pool< ID >::unbindDelay [private]

Definition at line 208 of file Pool.hpp.


The documentation for this class was generated from the following file:

Generated on Sat May 26 03:32:52 2012 for openWNS by  doxygen 1.5.5