Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

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 Methods

ACE_INLINE_FOR_GNUC 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

ASYS_INLINE ACE_MT_MEM_IO::Simple_Queue::Simple_Queue void   
 

Definition at line 13 of file MEM_IO.i.

00014   : mq_ (0),
00015     malloc_ (0)
00016 {
00017 }

ASYS_INLINE ACE_MT_MEM_IO::Simple_Queue::Simple_Queue MQ_Struct   mq
 

Definition at line 29 of file MEM_IO.i.

00030   : mq_ (mq),
00031     malloc_ (0)
00032 {
00033 }


Member Function Documentation

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

Definition at line 36 of file MEM_IO.i.

References malloc_, ACE_MEM_SAP::MALLOC_TYPE, and mq_.

Referenced by ACE_MT_MEM_IO::init.

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

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, mq_, and ACE_MEM_SAP_Node::next_.

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 mq_, and ACE_MEM_SAP_Node::next_.

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 93 of file MEM_IO.h.

Referenced by init.

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

Definition at line 92 of file MEM_IO.h.

Referenced by init, read, and write.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:50:48 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002