Incoming_Message_Queue.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file Incoming_Message_Queue.h
00006  *
00007  *  $Id: Incoming_Message_Queue.h 79008 2007-07-24 08:16:40Z johnnyw $
00008  *
00009  *  @author Balachandran Natarajan <bala@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef TAO_INCOMING_MESSAGE_QUEUE_H
00014 #define TAO_INCOMING_MESSAGE_QUEUE_H
00015 
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "tao/Pluggable_Messaging_Utils.h"
00019 #include "ace/Message_Block.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 # pragma once
00023 #endif /* ACE_LACKS_PRAGMA_ONCE */
00024 
00025 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00026 
00027 class TAO_ORB_Core;
00028 class TAO_Queued_Data;
00029 class TAO_Transport;
00030 
00031 /**
00032  * @class TAO_Incoming_Message_Queue
00033  *
00034  * @brief A queue of the messages in the incoming data path.
00035  *
00036  * Please read the documentation in the TAO_Transport class to find
00037  * out more about the design of the incoming data path.
00038  *
00039  * Under certain conditions TAO may have to maintain a queue
00040  * per-connection. This queue is drained by the pluggable
00041  * protocols framework, normally under control of the ACE_Reactor, but
00042  * other configurations are conceivable.
00043  *
00044  * The memory that is allocated for holding the messages comes from
00045  * the global pool for the following reasons
00046  *
00047  * - the thread that reads a part of the message would not be the same
00048  *   thread that reads and fills the rest of the message
00049  * - the thread that actually processes the message can be totally
00050  *   different.
00051  *
00052  */
00053 
00054 class TAO_Export TAO_Incoming_Message_Queue
00055 {
00056 public:
00057 
00058   /// Constructor.
00059   TAO_Incoming_Message_Queue (TAO_ORB_Core *orb_core);
00060 
00061   /// Destructor.
00062   ~TAO_Incoming_Message_Queue (void);
00063 
00064   /// Adding and deleting a node from the queue.
00065   TAO_Queued_Data *dequeue_head (void);
00066   TAO_Queued_Data *dequeue_tail (void);
00067   int enqueue_tail (TAO_Queued_Data *nd);
00068 
00069   /// Return the length of the queue..
00070   CORBA::ULong queue_length (void) const;
00071 
00072 private:
00073 
00074   friend class TAO_Transport;
00075 
00076 private:
00077   /*!
00078     \brief A circular linked list of messages awaiting processing.
00079 
00080     \a last_message_added_ points to the most recent message added to
00081     the list.  The earliest addition can be easily accessed via
00082     \a last_message_added_->next_.
00083    */
00084   TAO_Queued_Data *last_added_;
00085 
00086   /// The size of the queue
00087   CORBA::ULong size_;
00088 
00089   /// Copy of our ORB Core
00090   TAO_ORB_Core *orb_core_;
00091 };
00092 
00093 /// Constant value indicating that the correct value is unknown yet,
00094 /// probably parsing the header failed due to insufficient data in buffer.
00095 const size_t TAO_MISSING_DATA_UNDEFINED = ~((size_t) 0); // MAX_SIZE_T
00096 
00097 TAO_END_VERSIONED_NAMESPACE_DECL
00098 
00099 #if defined (__ACE_INLINE__)
00100 # include "tao/Incoming_Message_Queue.inl"
00101 #endif /* __ACE_INLINE__ */
00102 
00103 #include /**/ "ace/post.h"
00104 #endif /*TAO_INCOMING_MESSAGE_QUEUE_H*/

Generated on Tue Feb 2 17:37:52 2010 for TAO by  doxygen 1.4.7