#include <BasicQueue_T.h>
Collaboration diagram for OpenDDS::DCPS::BasicQueue< T >:

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 | |
| LinkType * | head_ |
| The first (oldest) link in the queue. | |
| LinkType * | tail_ |
| The last (newest) link in the queue. | |
| size_t | size_ |
| The number of links currently in the queue. | |
| PoolType | pool_ |
typedef BasicQueueLink<T> OpenDDS::DCPS::BasicQueue< T >::LinkType [private] |
typedef BasicQueueLinkPool<T> OpenDDS::DCPS::BasicQueue< T >::PoolType [private] |
typedef BasicQueueVisitor<T> OpenDDS::DCPS::BasicQueue< T >::VisitorType [private] |
| OpenDDS::DCPS::BasicQueue< T >::BasicQueue | ( | unsigned | links_per_pool, | |
| unsigned | initial_pools | |||
| ) | [inline] |
| virtual OpenDDS::DCPS::BasicQueue< T >::~BasicQueue | ( | ) | [inline, virtual] |
| 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.
| 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.
| 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.
| 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.
| 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.
| virtual int OpenDDS::DCPS::BasicQueue< T >::put | ( | T * | elem | ) | [inline, virtual] |
Put a pointer to an element (T*) on to the queue.
| 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.
| size_t OpenDDS::DCPS::BasicQueue< T >::size | ( | ) | const [inline] |
Accessor for the current number of elements in the queue.
LinkType* OpenDDS::DCPS::BasicQueue< T >::head_ [private] |
The first (oldest) link in the queue.
PoolType OpenDDS::DCPS::BasicQueue< T >::pool_ [private] |
The pool of precreated LinkType objects (a "self-growing" allocator is used by the pool).
size_t OpenDDS::DCPS::BasicQueue< T >::size_ [private] |
The number of links currently in the queue.
LinkType* OpenDDS::DCPS::BasicQueue< T >::tail_ [private] |
The last (newest) link in the queue.
1.4.7