#include <Incoming_Message_Queue.h>
Collaboration diagram for TAO_Incoming_Message_Queue:
Public Member Functions | |
TAO_Incoming_Message_Queue (TAO_ORB_Core *orb_core) | |
Constructor. | |
~TAO_Incoming_Message_Queue (void) | |
Destructor. | |
TAO_Queued_Data * | dequeue_head (void) |
Adding and deleting a node from the queue. | |
TAO_Queued_Data * | dequeue_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_Data * | last_added_ |
A circular linked list of messages awaiting processing. | |
CORBA::ULong | size_ |
The size of the queue. | |
TAO_ORB_Core * | orb_core_ |
Copy of our ORB Core. | |
Friends | |
class | TAO_Transport |
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 54 of file Incoming_Message_Queue.h.
TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE TAO_Incoming_Message_Queue::TAO_Incoming_Message_Queue | ( | TAO_ORB_Core * | orb_core | ) |
Constructor.
Definition at line 8 of file Incoming_Message_Queue.inl.
00009 : last_added_ (0), 00010 size_ (0), 00011 orb_core_ (orb_core) 00012 { 00013 }
TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Incoming_Message_Queue::~TAO_Incoming_Message_Queue | ( | void | ) |
Destructor.
Definition at line 18 of file Incoming_Message_Queue.cpp.
References TAO_Queued_Data::release().
00019 { 00020 const CORBA::ULong sz = this->size_; 00021 00022 // Delete all the nodes left behind 00023 for (CORBA::ULong i = 0; 00024 i < sz; 00025 ++i) 00026 { 00027 TAO_Queued_Data *qd = this->dequeue_head (); 00028 TAO_Queued_Data::release (qd); 00029 } 00030 }
TAO_Queued_Data * TAO_Incoming_Message_Queue::dequeue_head | ( | void | ) |
Adding and deleting a node from the queue.
Definition at line 34 of file Incoming_Message_Queue.cpp.
References last_added_, and TAO_Queued_Data::next().
00035 { 00036 if (this->size_ == 0) 00037 return 0; 00038 00039 // Get the node on the head of the queue... 00040 TAO_Queued_Data * const head = this->last_added_->next (); 00041 00042 // Reset the head node.. 00043 this->last_added_->next (head->next ()); 00044 00045 // Decrease the size and reset last_added_ if empty 00046 if (--this->size_ == 0) 00047 this->last_added_ = 0; 00048 00049 return head; 00050 }
TAO_Queued_Data * TAO_Incoming_Message_Queue::dequeue_tail | ( | void | ) |
Definition at line 53 of file Incoming_Message_Queue.cpp.
References last_added_, and TAO_Queued_Data::next().
00054 { 00055 // This is a bit painful stuff... 00056 if (this->size_ == 0) 00057 return 0; 00058 00059 // Get the node on the head of the queue... 00060 TAO_Queued_Data *head = 00061 this->last_added_->next (); 00062 00063 while (head->next () != this->last_added_) 00064 { 00065 head = head->next (); 00066 } 00067 00068 // Put the head in tmp. 00069 head->next (this->last_added_->next ()); 00070 00071 TAO_Queued_Data *ret_qd = this->last_added_; 00072 00073 this->last_added_ = head; 00074 00075 // Decrease the size 00076 if (--this->size_ == 0) 00077 this->last_added_ = 0; 00078 00079 return ret_qd; 00080 }
int TAO_Incoming_Message_Queue::enqueue_tail | ( | TAO_Queued_Data * | nd | ) |
Definition at line 83 of file Incoming_Message_Queue.cpp.
References last_added_, TAO_Queued_Data::next(), and size_.
00084 { 00085 if (this->size_ == 0) 00086 { 00087 this->last_added_ = nd; 00088 this->last_added_->next (this->last_added_); 00089 } 00090 else 00091 { 00092 nd->next (this->last_added_->next ()); 00093 this->last_added_->next (nd); 00094 this->last_added_ = nd; 00095 } 00096 00097 ++this->size_; 00098 return 0; 00099 }
ACE_INLINE CORBA::ULong TAO_Incoming_Message_Queue::queue_length | ( | void | ) | const |
Return the length of the queue..
Definition at line 16 of file Incoming_Message_Queue.inl.
References size_.
Referenced by TAO_Transport::process_queue_head().
00017 { 00018 return this->size_; 00019 }
friend class TAO_Transport [friend] |
Definition at line 74 of file Incoming_Message_Queue.h.
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 84 of file Incoming_Message_Queue.h.
Referenced by dequeue_head(), dequeue_tail(), and enqueue_tail().
The size of the queue.
Definition at line 87 of file Incoming_Message_Queue.h.
Referenced by enqueue_tail(), and queue_length().