summaryrefslogtreecommitdiff
path: root/TAO/tao/Queued_Data.inl
blob: c5cf403eafb65303ed268dd12b110df5efdcbc1a (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
128
129
130
131
132
133
134
135
// -*- C++ -*-
//
TAO_BEGIN_VERSIONED_NAMESPACE_DECL

/*static*/
ACE_INLINE void
TAO_Queued_Data::replace_data_block (ACE_Message_Block &mb)
{
  size_t const newsize =
    ACE_CDR::total_length (&mb, 0) + ACE_CDR::MAX_ALIGNMENT;

  ACE_Data_Block *db =
    mb.data_block ()->clone_nocopy ();

  if (db->size (newsize) == -1)
    return;

  ACE_Message_Block tmp (db);
  ACE_CDR::mb_align (&tmp);

  tmp.copy (mb.rd_ptr (), mb.length());
  mb.data_block (tmp.data_block ()->duplicate ());

  mb.rd_ptr (tmp.rd_ptr ());
  mb.wr_ptr (tmp.wr_ptr ());

  // Remove the DONT_DELETE flags from mb
  mb.clr_self_flags (ACE_Message_Block::DONT_DELETE);
}

ACE_INLINE
TAO_Queued_Data::TAO_Queued_Data (ACE_Allocator *alloc)
  : msg_block_ (0),
    missing_data_ (0),
    state_ (),
    next_ (0),
    allocator_ (alloc)
{
}

ACE_INLINE
TAO_Queued_Data::TAO_Queued_Data (ACE_Message_Block *mb,
                                  ACE_Allocator *alloc)
  : msg_block_ (mb),
    missing_data_ (0),
    state_ (),
    next_ (0),
    allocator_ (alloc)
{
}

ACE_INLINE
TAO_Queued_Data::TAO_Queued_Data (const TAO_Queued_Data &qd)
  : msg_block_ (qd.msg_block_->duplicate ()),
    missing_data_ (qd.missing_data_),
    state_ (qd.state_),
    next_ (0),
    allocator_ (qd.allocator_)
{
}


ACE_INLINE size_t
TAO_Queued_Data::missing_data (void) const
{
  return this->missing_data_;
}

ACE_INLINE void
TAO_Queued_Data::missing_data (size_t data)
{
  this->missing_data_ = data;
}

ACE_INLINE TAO_GIOP_Message_Version const &
TAO_Queued_Data::giop_version (void) const
{
  return this->state_.giop_version ();
}

ACE_INLINE CORBA::Octet
TAO_Queued_Data::byte_order (void) const
{
  return this->state_.byte_order ();
}

ACE_INLINE CORBA::Boolean
TAO_Queued_Data::more_fragments (void) const
{
  return this->state_.more_fragments ();
}

ACE_INLINE GIOP::MsgType
TAO_Queued_Data::msg_type (void) const
{
  return this->state_.message_type ();
}

ACE_INLINE TAO_Queued_Data *
TAO_Queued_Data::next (void) const
{
  return this->next_;
}

ACE_INLINE void
TAO_Queued_Data::next (TAO_Queued_Data* qd)
{
  this->next_ = qd;
}

ACE_INLINE ACE_Message_Block *
TAO_Queued_Data::msg_block (void) const
{
  return this->msg_block_;
}

ACE_INLINE void
TAO_Queued_Data::msg_block (ACE_Message_Block *mb)
{
  this->msg_block_ = mb;
}

ACE_INLINE void
TAO_Queued_Data::state (const TAO_GIOP_Message_State& state)
{
  this->state_ = state;
}

ACE_INLINE const TAO_GIOP_Message_State&
TAO_Queued_Data::state (void) const
{
  return this->state_;
}

TAO_END_VERSIONED_NAMESPACE_DECL