TAO_Incoming_Message_Queue Class Reference

A queue of the messages in the incoming data path. More...

#include <Incoming_Message_Queue.h>

Collaboration diagram for TAO_Incoming_Message_Queue:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_Incoming_Message_Queue (TAO_ORB_Core *orb_core)
 Constructor.

 ~TAO_Incoming_Message_Queue (void)
 Destructor.

TAO_Queued_Datadequeue_head (void)
 Adding and deleting a node from the queue.

TAO_Queued_Datadequeue_tail (void)
int enqueue_tail (TAO_Queued_Data *nd)
CORBA::ULong queue_length (void) const
 Return the length of the queue..


Private Attributes

TAO_Queued_Datalast_added_
 A circular linked list of messages awaiting processing.

CORBA::ULong size_
 The size of the queue.

TAO_ORB_Coreorb_core_
 Copy of our ORB Core.


Friends

class TAO_Transport

Detailed Description

A queue of the messages in the incoming data path.

Please read the documentation in the TAO_Transport class to find out more about the design of the incoming data path.

Under certain conditions TAO may have to maintain a queue per-connection. This queue is drained by the pluggable protocols framework, normally under control of the ACE_Reactor, but other configurations are conceivable.

The memory that is allocated for holding the messages comes from the global pool for the following reasons

Definition at line 58 of file Incoming_Message_Queue.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Incoming_Message_Queue::TAO_Incoming_Message_Queue TAO_ORB_Core orb_core  ) 
 

Constructor.

Definition at line 19 of file Incoming_Message_Queue.cpp.

00020   : last_added_ (0),
00021     size_ (0),
00022     orb_core_ (orb_core)
00023 {
00024 }

TAO_Incoming_Message_Queue::~TAO_Incoming_Message_Queue void   ) 
 

Destructor.

Definition at line 26 of file Incoming_Message_Queue.cpp.

References dequeue_head(), and TAO_Queued_Data::release().

00027 {
00028   const CORBA::ULong sz = this->size_;
00029 
00030   // Delete all the nodes left behind
00031   for (CORBA::ULong i = 0;
00032        i < sz;
00033        ++i)
00034     {
00035       TAO_Queued_Data *qd = this->dequeue_head ();
00036       TAO_Queued_Data::release (qd);
00037     }
00038 }


Member Function Documentation

TAO_Queued_Data * TAO_Incoming_Message_Queue::dequeue_head void   ) 
 

Adding and deleting a node from the queue.

Definition at line 42 of file Incoming_Message_Queue.cpp.

References last_added_, and TAO_Queued_Data::next_.

Referenced by TAO_Transport::process_queue_head(), and ~TAO_Incoming_Message_Queue().

00043 {
00044   if (this->size_ == 0)
00045     return 0;
00046 
00047   // Get the node on the head of the queue...
00048   TAO_Queued_Data * const head = this->last_added_->next_;
00049 
00050   // Reset the head node..
00051   this->last_added_->next_ = head->next_;
00052 
00053   // Decrease the size and reset last_added_ if empty
00054   if (--this->size_ == 0)
00055     this->last_added_ = 0;
00056 
00057   return head;
00058 }

TAO_Queued_Data * TAO_Incoming_Message_Queue::dequeue_tail void   ) 
 

Definition at line 61 of file Incoming_Message_Queue.cpp.

References last_added_, and TAO_Queued_Data::next_.

00062 {
00063   // This is a bit painful stuff...
00064   if (this->size_ == 0)
00065     return 0;
00066 
00067   // Get the node on the head of the queue...
00068   TAO_Queued_Data *head =
00069     this->last_added_->next_;
00070 
00071   while (head->next_ != this->last_added_)
00072     {
00073       head = head->next_;
00074     }
00075 
00076   // Put the head in tmp.
00077   head->next_ = this->last_added_->next_;
00078 
00079   TAO_Queued_Data *ret_qd = this->last_added_;
00080 
00081   this->last_added_ = head;
00082 
00083   // Decrease the size
00084   if (--this->size_ == 0)
00085     this->last_added_ = 0;
00086 
00087  return ret_qd;
00088 }

int TAO_Incoming_Message_Queue::enqueue_tail TAO_Queued_Data nd  ) 
 

Definition at line 91 of file Incoming_Message_Queue.cpp.

References last_added_, and TAO_Queued_Data::next_.

Referenced by TAO_Transport::consolidate_enqueue_message().

00092 {
00093   if (this->size_ == 0)
00094     {
00095       this->last_added_ = nd;
00096       this->last_added_->next_ = this->last_added_;
00097     }
00098   else
00099     {
00100       nd->next_ = this->last_added_->next_;
00101       this->last_added_->next_ = nd;
00102       this->last_added_ = nd;
00103     }
00104 
00105   ++ this->size_;
00106   return 0;
00107 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE CORBA::ULong TAO_Incoming_Message_Queue::queue_length void   )  const
 

Return the length of the queue..

Definition at line 11 of file Incoming_Message_Queue.inl.

Referenced by TAO_Transport::handle_input_parse_data(), and TAO_Transport::process_queue_head().

00012 {
00013   return this->size_;
00014 }


Friends And Related Function Documentation

friend class TAO_Transport [friend]
 

Definition at line 78 of file Incoming_Message_Queue.h.


Member Data Documentation

TAO_Queued_Data* TAO_Incoming_Message_Queue::last_added_ [private]
 

A circular linked list of messages awaiting processing.

last_message_added_ points to the most recent message added to the list. The earliest addition can be easily accessed via last_message_added_->next_.

Definition at line 88 of file Incoming_Message_Queue.h.

Referenced by dequeue_head(), dequeue_tail(), and enqueue_tail().

TAO_ORB_Core* TAO_Incoming_Message_Queue::orb_core_ [private]
 

Copy of our ORB Core.

Definition at line 94 of file Incoming_Message_Queue.h.

CORBA::ULong TAO_Incoming_Message_Queue::size_ [private]
 

The size of the queue.

Definition at line 91 of file Incoming_Message_Queue.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 12:14:52 2006 for TAO by doxygen 1.3.6