ACE_MT_MEM_IO::Simple_Queue Class Reference

#include <MEM_IO.h>

Collaboration diagram for ACE_MT_MEM_IO::Simple_Queue:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Simple_Queue (void)
 Simple_Queue (MQ_Struct *mq)
int init (MQ_Struct *mq, ACE_MEM_SAP::MALLOC_TYPE *malloc)
int write (ACE_MEM_SAP_Node *new_msg)
ACE_MEM_SAP_Noderead (void)

Private Attributes

MQ_Structmq_
ACE_MEM_SAP::MALLOC_TYPEmalloc_

Constructor & Destructor Documentation

ACE_INLINE ACE_MT_MEM_IO::Simple_Queue::Simple_Queue void   ) 
 

Definition at line 15 of file MEM_IO.inl.

00016   : mq_ (0),
00017     malloc_ (0)
00018 {
00019 }

ACE_INLINE ACE_MT_MEM_IO::Simple_Queue::Simple_Queue MQ_Struct mq  ) 
 

Definition at line 31 of file MEM_IO.inl.

00032   : mq_ (mq),
00033     malloc_ (0)
00034 {
00035 }


Member Function Documentation

ACE_INLINE int ACE_MT_MEM_IO::Simple_Queue::init MQ_Struct mq,
ACE_MEM_SAP::MALLOC_TYPE malloc
 

Definition at line 38 of file MEM_IO.inl.

References ACE_MEM_SAP::MALLOC_TYPE, and mq_.

Referenced by ACE_MT_MEM_IO::init().

00040 {
00041   if (this->mq_ != 0)
00042     return -1;
00043 
00044   this->mq_ = mq;
00045   this->malloc_ = malloc;
00046   return 0;
00047 }

ACE_MEM_SAP_Node * ACE_MT_MEM_IO::Simple_Queue::read void   ) 
 

Definition at line 119 of file MEM_IO.cpp.

References ACE_SEH_EXCEPT, ACE_SEH_TRY, ACE_MT_MEM_IO::MQ_Struct::head_, mq_, ACE_MEM_SAP_Node::next_, and ACE_MT_MEM_IO::MQ_Struct::tail_.

Referenced by ACE_MT_MEM_IO::recv_buf().

00120 {
00121   if (this->mq_ == 0)
00122     return 0;
00123 
00124   ACE_MEM_SAP_Node *retv = 0;
00125 
00126   ACE_SEH_TRY
00127     {
00128       retv = this->mq_->head_;
00129       // Here, we assume we already have acquired the lock necessary
00130       // and there are soemthing in the queue.
00131       if (this->mq_->head_ == this->mq_->tail_)
00132         {
00133           // Last message in the queue.
00134           this->mq_->head_ = 0;
00135           this->mq_->tail_ = 0;
00136         }
00137       else
00138         this->mq_->head_ = retv->next_;
00139     }
00140   ACE_SEH_EXCEPT (this->malloc_->memory_pool ().seh_selector (GetExceptionInformation ()))
00141     {
00142     }
00143 
00144   return retv;
00145 }

int ACE_MT_MEM_IO::Simple_Queue::write ACE_MEM_SAP_Node new_msg  ) 
 

Definition at line 96 of file MEM_IO.cpp.

References ACE_Based_Pointer_Basic< CONCRETE >::addr(), ACE_MT_MEM_IO::MQ_Struct::head_, mq_, ACE_MEM_SAP_Node::next_, and ACE_MT_MEM_IO::MQ_Struct::tail_.

Referenced by ACE_MT_MEM_IO::send_buf().

00097 {
00098   if (this->mq_ == 0)
00099     return -1;
00100 
00101   // Here, we assume we already have acquired the lock necessary.
00102   // And we are allowed to write.
00103   if (this->mq_->tail_.addr () == 0)     // nothing in the queue.
00104     {
00105       this->mq_->head_ = new_node;
00106       this->mq_->tail_ = new_node;
00107       new_node->next_ = 0;
00108     }
00109   else
00110     {
00111       this->mq_->tail_->next_ = new_node;
00112       new_node->next_ = 0;
00113       this->mq_->tail_ = new_node;
00114     }
00115   return 0;
00116 }


Member Data Documentation

ACE_MEM_SAP::MALLOC_TYPE* ACE_MT_MEM_IO::Simple_Queue::malloc_ [private]
 

Definition at line 100 of file MEM_IO.h.

MQ_Struct* ACE_MT_MEM_IO::Simple_Queue::mq_ [private]
 

Definition at line 99 of file MEM_IO.h.

Referenced by init(), read(), and write().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:25:17 2006 for ACE by doxygen 1.3.6