Public Member Functions | Private Attributes | Friends

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 54 of file Incoming_Message_Queue.h.


Constructor & Destructor Documentation

TAO_Incoming_Message_Queue::TAO_Incoming_Message_Queue ( TAO_ORB_Core orb_core  ) 

Constructor.

Definition at line 8 of file Incoming_Message_Queue.inl.

  : last_added_ (0),
    size_ (0),
    orb_core_ (orb_core)
{
}

TAO_Incoming_Message_Queue::~TAO_Incoming_Message_Queue ( void   ) 

Destructor.

Definition at line 18 of file Incoming_Message_Queue.cpp.

{
  CORBA::ULong const sz = this->size_;

  // Delete all the nodes left behind
  for (CORBA::ULong i = 0;
       i < sz;
       ++i)
    {
      TAO_Queued_Data *qd = this->dequeue_head ();
      TAO_Queued_Data::release (qd);
    }
}


Member Function Documentation

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.

{
  if (this->size_ == 0)
    return 0;

  // Get the node on the head of the queue...
  TAO_Queued_Data * const head = this->last_added_->next ();

  // Reset the head node..
  this->last_added_->next (head->next ());

  // Decrease the size and reset last_added_ if empty
  if (--this->size_ == 0)
    this->last_added_ = 0;

  return head;
}

TAO_Queued_Data * TAO_Incoming_Message_Queue::dequeue_tail ( void   ) 

Definition at line 53 of file Incoming_Message_Queue.cpp.

{
  // This is a bit painful stuff...
  if (this->size_ == 0)
    return 0;

  // Get the node on the head of the queue...
  TAO_Queued_Data *head = this->last_added_->next ();

  while (head->next () != this->last_added_)
    {
      head = head->next ();
    }

  // Put the head in tmp.
  head->next (this->last_added_->next ());

  TAO_Queued_Data *ret_qd = this->last_added_;

  this->last_added_ = head;

  // Decrease the size
  if (--this->size_ == 0)
    this->last_added_ = 0;

 return ret_qd;
}

int TAO_Incoming_Message_Queue::enqueue_tail ( TAO_Queued_Data nd  ) 

Definition at line 82 of file Incoming_Message_Queue.cpp.

{
  if (this->size_ == 0)
    {
      this->last_added_ = nd;
      this->last_added_->next (this->last_added_);
    }
  else
    {
      nd->next (this->last_added_->next ());
      this->last_added_->next (nd);
      this->last_added_ = nd;
    }

  ++this->size_;
  return 0;
}

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.

{
  return this->size_;
}


Friends And Related Function Documentation

friend class TAO_Transport [friend]

Definition at line 74 of file Incoming_Message_Queue.h.


Member Data Documentation

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.

Copy of our ORB Core.

Definition at line 90 of file Incoming_Message_Queue.h.

The size of the queue.

Definition at line 87 of file Incoming_Message_Queue.h.


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