OpenDDS::DCPS::BasicQueue< T > Class Template Reference

#include <BasicQueue_T.h>

Collaboration diagram for OpenDDS::DCPS::BasicQueue< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 BasicQueue (unsigned links_per_pool, unsigned initial_pools)
virtual ~BasicQueue ()
virtual int put (T *elem)
 Put a pointer to an element (T*) on to the queue.
virtual T * peek ()
virtual T * get ()
size_t size () const
 Accessor for the current number of elements in the queue.
void accept_visitor (VisitorType &visitor)
void accept_remove_visitor (VisitorType &visitor)
void accept_replace_visitor (VisitorType &visitor)

Private Types

typedef BasicQueueLinkPool<
T > 
PoolType
typedef BasicQueueLink< T > LinkType
typedef BasicQueueVisitor< T > VisitorType

Private Member Functions

void remove_next (LinkType *prev)

Private Attributes

LinkTypehead_
 The first (oldest) link in the queue.
LinkTypetail_
 The last (newest) link in the queue.
size_t size_
 The number of links currently in the queue.
PoolType pool_

template<typename T>
class OpenDDS::DCPS::BasicQueue< T >


Member Typedef Documentation

template<typename T>
typedef BasicQueueLink<T> OpenDDS::DCPS::BasicQueue< T >::LinkType [private]

template<typename T>
typedef BasicQueueLinkPool<T> OpenDDS::DCPS::BasicQueue< T >::PoolType [private]

template<typename T>
typedef BasicQueueVisitor<T> OpenDDS::DCPS::BasicQueue< T >::VisitorType [private]


Constructor & Destructor Documentation

template<typename T>
OpenDDS::DCPS::BasicQueue< T >::BasicQueue ( unsigned  links_per_pool,
unsigned  initial_pools 
) [inline]

template<typename T>
virtual OpenDDS::DCPS::BasicQueue< T >::~BasicQueue (  )  [inline, virtual]


Member Function Documentation

template<typename T>
void OpenDDS::DCPS::BasicQueue< T >::accept_remove_visitor ( VisitorType visitor  )  [inline]

Alternate way to supply a visitor to the queue - this will invoke visit_element(T* element, int& remove) on the supplied visitor object once for each element in this BasicQueue<T> object, in order.

The remove argument is a flag that should be set to true (1) in the visitor's visit_element_remove(T* element, int& remove) method if the visitor decides that the element should be removed from the queue. The remove flag is always set to false (0) prior to calling the visitor's visit_element_remove(T* element, int& remove) method.

The visitor can stop visitation early by returning 0 from its visit_element_remove(T* element, int& remove) method.

template<typename T>
void OpenDDS::DCPS::BasicQueue< T >::accept_replace_visitor ( VisitorType visitor  )  [inline]

This kind of visitation may cause the visitor to replace the currently visited element with a new element.

template<typename T>
void OpenDDS::DCPS::BasicQueue< T >::accept_visitor ( VisitorType visitor  )  [inline]

Standard way to supply a visitor to the queue - this will invoke visit_element(T* element) on the supplied visitor object once for each element in this BasicQueue<T> object, in order. The visitor can stop visitation early by returning 0 from its visit_element(T* element) method.

template<typename T>
virtual T* OpenDDS::DCPS::BasicQueue< T >::get (  )  [inline, virtual]

Extract the top element from the queue. Returns 0 if there are no elements in the queue.

template<typename T>
virtual T* OpenDDS::DCPS::BasicQueue< T >::peek (  )  [inline, virtual]

Peek at the element at the top of the queue. This is just like the get() operation except that the queue remains intact.

template<typename T>
virtual int OpenDDS::DCPS::BasicQueue< T >::put ( T *  elem  )  [inline, virtual]

Put a pointer to an element (T*) on to the queue.

template<typename T>
void OpenDDS::DCPS::BasicQueue< T >::remove_next ( LinkType prev  )  [inline, private]

Used by our accept_remove_visitor() method when an element needs to be removed from this BasicQueue<T> object. The element that is supposed to be removed is the next() link object of the supplied "prev" link object. It's done this way so that the (singlely) linked-list can be stitched back together after the appropriate link has been removed.

template<typename T>
size_t OpenDDS::DCPS::BasicQueue< T >::size (  )  const [inline]

Accessor for the current number of elements in the queue.


Member Data Documentation

template<typename T>
LinkType* OpenDDS::DCPS::BasicQueue< T >::head_ [private]

The first (oldest) link in the queue.

template<typename T>
PoolType OpenDDS::DCPS::BasicQueue< T >::pool_ [private]

The pool of precreated LinkType objects (a "self-growing" allocator is used by the pool).

template<typename T>
size_t OpenDDS::DCPS::BasicQueue< T >::size_ [private]

The number of links currently in the queue.

template<typename T>
LinkType* OpenDDS::DCPS::BasicQueue< T >::tail_ [private]

The last (newest) link in the queue.


The documentation for this class was generated from the following file:
Generated on Fri Jun 20 10:21:46 2008 for OpenDDS by  doxygen 1.4.7