1 #include "tao/Incoming_Message_Queue.h"
2 #include "tao/Queued_Data.h"
5 #include "ace/Log_Msg.h"
6 #include "ace/Malloc_Base.h"
8 #if !defined (__ACE_INLINE__)
9 # include "tao/Incoming_Message_Queue.inl"
10 #endif /* __ACE_INLINE__ */
12 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
14 TAO_Incoming_Message_Queue::~TAO_Incoming_Message_Queue ()
16 CORBA::ULong
const sz
= this->size_
;
18 // Delete all the nodes left behind
19 for (CORBA::ULong i
= 0;
23 TAO_Queued_Data
*qd
= this->dequeue_head ();
24 TAO_Queued_Data::release (qd
);
30 TAO_Incoming_Message_Queue::dequeue_head ()
35 // Get the node on the head of the queue...
36 TAO_Queued_Data
* const head
= this->last_added_
->next ();
38 // Reset the head node..
39 this->last_added_
->next (head
->next ());
41 // Decrease the size and reset last_added_ if empty
42 if (--this->size_
== 0)
43 this->last_added_
= nullptr;
49 TAO_Incoming_Message_Queue::dequeue_tail ()
51 // This is a bit painful stuff...
55 // Get the node on the head of the queue...
56 TAO_Queued_Data
*head
= this->last_added_
->next ();
58 while (head
->next () != this->last_added_
)
63 // Put the head in tmp.
64 head
->next (this->last_added_
->next ());
66 TAO_Queued_Data
*ret_qd
= this->last_added_
;
68 this->last_added_
= head
;
71 if (--this->size_
== 0)
72 this->last_added_
= nullptr;
78 TAO_Incoming_Message_Queue::enqueue_tail (TAO_Queued_Data
*nd
)
82 this->last_added_
= nd
;
83 this->last_added_
->next (this->last_added_
);
87 nd
->next (this->last_added_
->next ());
88 this->last_added_
->next (nd
);
89 this->last_added_
= nd
;
96 TAO_END_VERSIONED_NAMESPACE_DECL