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

#include <BasicQueue_T.h>

Inheritance diagram for OpenDDS::DCPS::BasicQueue< T >:
Inheritance graph
[legend]
Collaboration diagram for OpenDDS::DCPS::BasicQueue< T >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

int put (T *elem)
 Put a pointer to an element (T*) on to the queue.
T * peek () const
void replace_head (T *value)
T * get ()
size_t size () const
 Accessor for the current number of elements in the queue.
void accept_visitor (VisitorType &visitor) const
void accept_remove_visitor (VisitorType &visitor)
void accept_replace_visitor (VisitorType &visitor)
void swap (BasicQueue &other)

Private Types

typedef BasicQueueVisitor< T > VisitorType
typedef QueueImpl::iterator iterator
typedef QueueImpl::const_iterator const_iterator

Private Member Functions

typedef OPENDDS_DEQUE (T *) QueueImpl

Private Attributes

QueueImpl elements_

Detailed Description

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

Definition at line 24 of file BasicQueue_T.h.


Member Typedef Documentation

template<typename T>
typedef QueueImpl::const_iterator OpenDDS::DCPS::BasicQueue< T >::const_iterator [private]

Definition at line 30 of file BasicQueue_T.h.

template<typename T>
typedef QueueImpl::iterator OpenDDS::DCPS::BasicQueue< T >::iterator [private]

Definition at line 29 of file BasicQueue_T.h.

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

Definition at line 27 of file BasicQueue_T.h.


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.

Definition at line 93 of file BasicQueue_T.h.

Referenced by OpenDDS::DCPS::TransportSendStrategy::clear(), and OpenDDS::DCPS::TransportSendStrategy::do_remove_sample().

00093                                                    {
00094     QueueImpl tmp;
00095     for (iterator itr = elements_.begin();
00096          itr != elements_.end(); ++itr) {
00097 
00098       int remove = 0;
00099       int keep_going = visitor.visit_element_remove(*itr, remove);
00100       if (!remove)
00101         tmp.push_back(*itr);
00102       if (keep_going == 0) {
00103         std::copy(++itr,elements_.end(), std::back_inserter(tmp));
00104         break;
00105       }
00106     }
00107     elements_.swap(tmp);
00108   }

Here is the caller graph for this function:

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.

Definition at line 111 of file BasicQueue_T.h.

Referenced by OpenDDS::DCPS::TransportSendStrategy::do_remove_sample().

00111                                                     {
00112     for (iterator itr = elements_.begin();
00113          itr != elements_.end(); ++itr) {
00114       if (visitor.visit_element_ref(*itr) == 0)
00115         return;
00116     }
00117   }

Here is the caller graph for this function:

template<typename T>
void OpenDDS::DCPS::BasicQueue< T >::accept_visitor ( VisitorType visitor  )  const [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.

Definition at line 72 of file BasicQueue_T.h.

Referenced by OpenDDS::DCPS::SingleSendBuffer::insert_buffer(), OpenDDS::DCPS::TransportSendStrategy::prepare_packet(), and OpenDDS::DCPS::ThreadPerConnectionSendTask::remove_sample().

00072                                                   {
00073     for (const_iterator itr = elements_.begin();
00074          itr != elements_.end(); ++itr) {
00075       visitor.visit_element(*itr);
00076     }
00077   }

Here is the caller graph for this function:

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

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

Definition at line 53 of file BasicQueue_T.h.

Referenced by OpenDDS::DCPS::TransportSendStrategy::adjust_packet_after_send(), OpenDDS::DCPS::TransportSendStrategy::get_packet_elems_from_queue(), and OpenDDS::DCPS::ThreadPerConnectionSendTask::svc().

00053            {
00054     T* result = 0;
00055     if (elements_.size()) {
00056       result = elements_.front();
00057       elements_.pop_front();
00058     }
00059     return result;
00060   }

Here is the caller graph for this function:

template<typename T>
typedef OpenDDS::DCPS::BasicQueue< T >::OPENDDS_DEQUE ( T *   )  [private]
template<typename T>
T* OpenDDS::DCPS::BasicQueue< T >::peek ( void   )  const [inline]

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

Definition at line 41 of file BasicQueue_T.h.

Referenced by OpenDDS::DCPS::TransportSendStrategy::adjust_packet_after_send(), OpenDDS::DCPS::TransportSendStrategy::current_packet_first_element(), OpenDDS::DCPS::TransportSendStrategy::get_packet_elems_from_queue(), OpenDDS::DCPS::SingleSendBuffer::insert(), and OpenDDS::DCPS::RtpsUdpDataLink::MultiSendBuffer::insert().

00041                   {
00042     return elements_.size() ? elements_[0] : 0;
00043   }

Here is the caller graph for this function:

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

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

Definition at line 34 of file BasicQueue_T.h.

Referenced by OpenDDS::DCPS::ThreadPerConnectionSendTask::add_request(), OpenDDS::DCPS::TransportSendStrategy::get_packet_elems_from_queue(), OpenDDS::DCPS::TransportSendStrategy::send(), and OpenDDS::DCPS::CopyChainVisitor::visit_element().

00034                    {
00035     elements_.push_back(elem);
00036     return 0;
00037   }

Here is the caller graph for this function:

template<typename T>
void OpenDDS::DCPS::BasicQueue< T >::replace_head ( T *  value  )  [inline]

Definition at line 45 of file BasicQueue_T.h.

Referenced by OpenDDS::DCPS::TransportSendStrategy::get_packet_elems_from_queue().

00045                               {
00046     if (elements_.size()) {
00047       elements_[0] = value;
00048     }
00049   }

Here is the caller graph for this function:

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

Definition at line 120 of file BasicQueue_T.h.

Referenced by OpenDDS::DCPS::TransportSendStrategy::clear().

00121   {
00122     elements_.swap(other.elements_);
00123   }

Here is the caller graph for this function:


Member Data Documentation

template<typename T>
QueueImpl OpenDDS::DCPS::BasicQueue< T >::elements_ [private]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1