blob: 727d2e299616d902d9081c2beac5a362aa09808b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
#include "Incoming_Message_Queue.h"
#include "ORB_Core.h"
#include "debug.h"
#include "Pluggable_Messaging_Utils.h"
#if !defined (__ACE_INLINE__)
# include "Incoming_Message_Queue.inl"
#endif /* __ACE_INLINE__ */
ACE_RCSID (tao, Incoming_Message_Queue, "$Id$")
TAO_Incoming_Message_Queue::TAO_Incoming_Message_Queue (TAO_ORB_Core *orb_core)
: queued_data_ (0),
size_ (0),
orb_core_ (orb_core)
{
}
TAO_Incoming_Message_Queue::~TAO_Incoming_Message_Queue (void)
{
// Need to delete all the unused data-blocks
}
size_t
TAO_Incoming_Message_Queue::copy_message (ACE_Message_Block &block)
{
size_t n = 0;
if (this->size_ > 0)
{
if ((CORBA::Long)block.length () <= this->queued_data_->missing_data_)
{
n = block.length ();
}
else
{
n = this->queued_data_->missing_data_;
}
this->queued_data_->msg_block_->copy (block.rd_ptr (),
n);
this->queued_data_->missing_data_ -= n;
}
return n;
}
TAO_Queued_Data *
TAO_Incoming_Message_Queue::dequeue_head (void)
{
// Get the node on the head of the queue...
TAO_Queued_Data *tmp =
this->queued_data_->next_;
// Reset the head node..
this->queued_data_->next_ = tmp->next_;
// Decrease the size
--this->size_;
return tmp;
}
TAO_Queued_Data *
TAO_Incoming_Message_Queue::dequeue_tail (void)
{
// This is a bit painful stuff...
if (this->size_ == 0)
return 0;
// Get the node on the head of the queue...
TAO_Queued_Data *tmp =
this->queued_data_->next_;
while (tmp->next_ != this->queued_data_)
{
tmp = tmp->next_;
}
// Put the head in tmp.
tmp->next_ = this->queued_data_->next_;
TAO_Queued_Data *ret_qd = this->queued_data_;
this->queued_data_ = tmp;
// Decrease the size
--this->size_;
return ret_qd;
}
int
TAO_Incoming_Message_Queue::enqueue_tail (TAO_Queued_Data *nd)
{
if (this->size_ == 0)
{
this->queued_data_ = nd;
this->queued_data_->next_ = this->queued_data_;
}
else
{
nd->next_ = this->queued_data_->next_;
this->queued_data_->next_ = nd;
this->queued_data_ = nd;
}
++ this->size_;
return 0;
}
/************************************************************************/
TAO_Queued_Data::TAO_Queued_Data (void)
: msg_block_ (0),
missing_data_ (0),
byte_order_ (0),
major_version_ (0),
minor_version_ (0),
msg_type_ (TAO_PLUGGABLE_MESSAGE_MESSAGERROR),
next_ (0)
{
}
|