User Manual, Developers Guide and API Documentation

wns::RoundRobin< T > Class Template Reference

#include <RoundRobin.hpp>

Inheritance diagram for wns::RoundRobin< T >:

Inheritance graph
[legend]
Collaboration diagram for wns::RoundRobin< T >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void add (Element e)
 Add an element to the container.
void cancelRound () const
 Cancel an already started round.
void clear ()
const Element current () const
 Returns the next element to operate on without advancing to the element after the next element.
bool empty () const
 True if container empty.
void endRound ()
 End a round.
Container getAllElements () const
 Returns all elements.
bool hasNext () const
 True as long as there elements left in one round.
bool isInRound () const
 Return if currently in round.
const Element next () const
 Returns the next element to operate on.
void remove (Element e)
 Remove an element from the container.
 RoundRobin ()
long int size () const
 Number of elements in the container.
void startRound () const
 Start a new round.

Private Types

typedef std::vector< ElementContainer
typedef T Element

Private Member Functions

void advanceCursor () const

Private Attributes

long int countdown
long int cursor
Container elements
long int first
bool inRound


Detailed Description

template<typename T>
class wns::RoundRobin< T >

Definition at line 39 of file RoundRobin.hpp.


Member Typedef Documentation

template<typename T>
typedef std::vector<Element> wns::RoundRobin< T >::Container [private]

Definition at line 42 of file RoundRobin.hpp.

template<typename T>
typedef T wns::RoundRobin< T >::Element [private]

Definition at line 41 of file RoundRobin.hpp.


Constructor & Destructor Documentation

template<typename T>
wns::RoundRobin< T >::RoundRobin (  )  [inline, explicit]

Definition at line 45 of file RoundRobin.hpp.


Member Function Documentation

template<typename T>
void wns::RoundRobin< T >::add ( Element  e  )  [inline]

Note:
Elements must be unique
Calling add will insert the new value just before the current first position.

Definition at line 172 of file RoundRobin.hpp.

template<typename T>
void wns::RoundRobin< T >::advanceCursor (  )  const [inline, private]

Definition at line 238 of file RoundRobin.hpp.

template<typename T>
void wns::RoundRobin< T >::cancelRound (  )  const [inline]

Definition at line 85 of file RoundRobin.hpp.

template<typename T>
void wns::RoundRobin< T >::clear (  )  [inline]

Definition at line 220 of file RoundRobin.hpp.

template<typename T>
const Element wns::RoundRobin< T >::current (  )  const [inline]

Note:
May also be called while not in round

Definition at line 108 of file RoundRobin.hpp.

template<typename T>
bool wns::RoundRobin< T >::empty (  )  const [inline]

Definition at line 158 of file RoundRobin.hpp.

template<typename T>
void wns::RoundRobin< T >::endRound (  )  [inline]

Call this basically to unseal the container (see startRound())

Definition at line 74 of file RoundRobin.hpp.

template<typename T>
Container wns::RoundRobin< T >::getAllElements (  )  const [inline]

Note:
May be used for introspection only.

Definition at line 232 of file RoundRobin.hpp.

template<typename T>
bool wns::RoundRobin< T >::hasNext (  )  const [inline]

True as long as there elements left in one round, i.e. not all elements have been visited.

Definition at line 139 of file RoundRobin.hpp.

template<typename T>
bool wns::RoundRobin< T >::isInRound (  )  const [inline]

Definition at line 96 of file RoundRobin.hpp.

template<typename T>
const Element wns::RoundRobin< T >::next (  )  const [inline]

Returns:
The next element to operate on

Definition at line 121 of file RoundRobin.hpp.

template<typename T>
void wns::RoundRobin< T >::remove ( Element  e  )  [inline]

Removing an element will keep the first pointing to the same element after removing. If the element is removed the first is currently pointing to, the first is advanced to the next element.

Definition at line 196 of file RoundRobin.hpp.

template<typename T>
long int wns::RoundRobin< T >::size (  )  const [inline]

Definition at line 149 of file RoundRobin.hpp.

template<typename T>
void wns::RoundRobin< T >::startRound (  )  const [inline]

This effectively seals the container. In debug mode no add() or remove() is possible.

Definition at line 60 of file RoundRobin.hpp.


Member Data Documentation

template<typename T>
long int wns::RoundRobin< T >::countdown [mutable, private]

Definition at line 246 of file RoundRobin.hpp.

template<typename T>
long int wns::RoundRobin< T >::cursor [mutable, private]

Definition at line 245 of file RoundRobin.hpp.

template<typename T>
Container wns::RoundRobin< T >::elements [private]

Definition at line 242 of file RoundRobin.hpp.

template<typename T>
long int wns::RoundRobin< T >::first [private]

Definition at line 243 of file RoundRobin.hpp.

template<typename T>
bool wns::RoundRobin< T >::inRound [mutable, private]

Definition at line 244 of file RoundRobin.hpp.


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

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