2 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
4 ACE_INLINE ACE_Data_Block *
5 ACE_Message_Block::data_block () const
7 ACE_TRACE ("ACE_Message_Block::data_block");
8 return this->data_block_;
11 ACE_INLINE ACE_Message_Block::Message_Flags
12 ACE_Message_Block::set_self_flags (ACE_Message_Block::Message_Flags more_flags)
14 ACE_TRACE ("ACE_Message_Block::set_self_flags");
15 // Later we might mask more_glags so that user can't change internal
16 // ones: more_flags &= ~(USER_FLAGS -1).
17 return ACE_SET_BITS (this->flags_, more_flags);
20 ACE_INLINE ACE_Message_Block::Message_Flags
21 ACE_Message_Block::clr_self_flags (ACE_Message_Block::Message_Flags less_flags)
23 ACE_TRACE ("ACE_Message_Block::clr_self_flags");
24 // Later we might mask more_flags so that user can't change internal
25 // ones: less_flags &= ~(USER_FLAGS -1).
26 return ACE_CLR_BITS (this->flags_, less_flags);
29 ACE_INLINE ACE_Message_Block::Message_Flags
30 ACE_Message_Block::self_flags () const
32 ACE_TRACE ("ACE_Message_Block::self_flags");
37 ACE_Data_Block::reference_count_i () const
39 return reference_count_;
43 ACE_Message_Block::reference_count () const
45 return data_block () ? data_block ()->reference_count () : 0;
49 ACE_Data_Block::base () const
51 ACE_TRACE ("ACE_Data_Block::base");
56 ACE_Data_Block::size () const
58 ACE_TRACE ("ACE_Data_Block::size");
59 return this->cur_size_;
63 ACE_Data_Block::capacity () const
65 ACE_TRACE ("ACE_Data_Block::capacity");
66 return this->max_size_;
69 ACE_INLINE ACE_Message_Block::Message_Flags
70 ACE_Data_Block::set_flags (ACE_Message_Block::Message_Flags more_flags)
72 ACE_TRACE ("ACE_Data_Block::set_flags");
73 // Later we might mask more_glags so that user can't change internal
74 // ones: more_flags &= ~(USER_FLAGS -1).
75 return ACE_SET_BITS (this->flags_, more_flags);
78 ACE_INLINE ACE_Message_Block::Message_Flags
79 ACE_Data_Block::clr_flags (ACE_Message_Block::Message_Flags less_flags)
81 ACE_TRACE ("ACE_Data_Block::clr_flags");
82 // Later we might mask more_flags so that user can't change internal
83 // ones: less_flags &= ~(USER_FLAGS -1).
84 return ACE_CLR_BITS (this->flags_, less_flags);
87 ACE_INLINE ACE_Message_Block::Message_Flags
88 ACE_Data_Block::flags () const
90 ACE_TRACE ("ACE_Data_Block::flags");
94 ACE_INLINE ACE_Allocator*
95 ACE_Data_Block::data_block_allocator () const
97 ACE_TRACE ("ACE_Data_Block::data_block_allocator");
98 return this->data_block_allocator_;
101 ACE_INLINE ACE_Message_Block::Message_Flags
102 ACE_Message_Block::set_flags (ACE_Message_Block::Message_Flags more_flags)
104 ACE_TRACE ("ACE_Message_Block::set_flags");
105 return this->data_block ()->set_flags (more_flags);
108 ACE_INLINE ACE_Message_Block::Message_Flags
109 ACE_Message_Block::clr_flags (ACE_Message_Block::Message_Flags less_flags)
111 ACE_TRACE ("ACE_Message_Block::clr_flags");
112 return this->data_block ()->clr_flags (less_flags);
115 ACE_INLINE ACE_Message_Block::Message_Flags
116 ACE_Message_Block::flags () const
118 ACE_TRACE ("ACE_Message_Block::flags");
119 return this->data_block ()->flags ();
122 // Return the length of the "active" portion of the message.
125 ACE_Message_Block::length () const
127 ACE_TRACE ("ACE_Message_Block::length");
128 return this->wr_ptr_ - this->rd_ptr_;
131 // Sets the length of the "active" portion of the message. This is
132 // defined as the offset from RD_PTR to WR_PTR.
135 ACE_Message_Block::length (size_t len)
137 ACE_TRACE ("ACE_Message_Block::length");
138 this->wr_ptr_ = this->rd_ptr_ + len;
141 // Return the length of the potential size of the message.
144 ACE_Message_Block::size () const
146 ACE_TRACE ("ACE_Message_Block::size");
147 return this->data_block ()->size ();
151 ACE_Message_Block::capacity () const
153 ACE_TRACE ("ACE_Message_Block::capacity");
154 return this->data_block ()->capacity ();
157 ACE_INLINE ACE_Message_Block::ACE_Message_Type
158 ACE_Data_Block::msg_type () const
160 ACE_TRACE ("ACE_Data_Block::msg_type");
165 ACE_Data_Block::msg_type (ACE_Message_Block::ACE_Message_Type t)
167 ACE_TRACE ("ACE_Data_Block::msg_type");
171 ACE_INLINE ACE_Message_Block::ACE_Message_Type
172 ACE_Message_Block::msg_type () const
174 ACE_TRACE ("ACE_Message_Block::msg_type");
175 return this->data_block ()->msg_type ();
179 ACE_Message_Block::msg_type (ACE_Message_Block::ACE_Message_Type t)
181 ACE_TRACE ("ACE_Message_Block::msg_type");
182 this->data_block ()->msg_type (t);
185 ACE_INLINE ACE_Message_Block::ACE_Message_Type
186 ACE_Message_Block::msg_class () const
188 ACE_TRACE ("ACE_Message_Block::msg_class");
190 if (this->msg_type () < ACE_Message_Block::MB_PRIORITY)
191 return ACE_Message_Block::MB_NORMAL;
192 else if (this->msg_type () < ACE_Message_Block::MB_USER)
193 return ACE_Message_Block::MB_PRIORITY;
195 return ACE_Message_Block::MB_USER;
199 ACE_Message_Block::is_data_msg () const
201 ACE_TRACE ("ACE_Message_Block::is_data_msg");
202 ACE_Message_Type mt = this->msg_type ();
204 mt == ACE_Message_Block::MB_DATA
205 || mt == ACE_Message_Block::MB_PROTO
206 || mt == ACE_Message_Block::MB_PCPROTO;
209 ACE_INLINE unsigned long
210 ACE_Message_Block::msg_priority () const
212 ACE_TRACE ("ACE_Message_Block::msg_priority");
213 return this->priority_;
217 ACE_Message_Block::msg_priority (unsigned long pri)
219 ACE_TRACE ("ACE_Message_Block::msg_priority");
220 this->priority_ = pri;
223 ACE_INLINE const ACE_Time_Value &
224 ACE_Message_Block::msg_execution_time () const
226 ACE_TRACE ("ACE_Message_Block::msg_execution_time ()");
227 #if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS)
228 return this->execution_time_;
230 return ACE_Time_Value::zero;
231 #endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */
235 ACE_Message_Block::msg_execution_time (const ACE_Time_Value &et)
237 ACE_TRACE ("ACE_Message_Block::msg_execution_time (const ACE_Time_Value & et)");
238 #if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS)
239 this->execution_time_ = et;
242 #endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */
245 ACE_INLINE const ACE_Time_Value &
246 ACE_Message_Block::msg_deadline_time () const
248 ACE_TRACE ("ACE_Message_Block::msg_deadline_time ()");
250 #if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS)
251 return this->deadline_time_;
253 return ACE_Time_Value::max_time; // absolute time of deadline
254 #endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */
258 ACE_Message_Block::msg_deadline_time (const ACE_Time_Value &dt)
260 ACE_TRACE ("ACE_Message_Block::msg_deadline_time (const ACE_Time_Value & et)");
261 #if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS)
262 this->deadline_time_ = dt;
265 #endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */
269 ACE_Message_Block::access_allocators (ACE_Allocator *& allocator_strategy,
270 ACE_Allocator *& data_block_allocator,
271 ACE_Allocator *& message_block_allocator)
274 this->data_block_->allocator_strategy_;
275 data_block_allocator =
276 this->data_block_->data_block_allocator_;
277 message_block_allocator =
278 this->message_block_allocator_;
282 ACE_Message_Block::base () const
284 ACE_TRACE ("ACE_Message_Block::base");
285 return this->data_block ()->base ();
289 ACE_Message_Block::base (char *msg_data,
291 Message_Flags msg_flags)
293 ACE_TRACE ("ACE_Message_Block::base");
296 this->data_block ()->base (msg_data, msg_length, msg_flags);
300 ACE_Message_Block::rd_ptr () const
302 ACE_TRACE ("ACE_Message_Block::rd_ptr");
303 return this->base () + this->rd_ptr_;
307 ACE_Message_Block::wr_ptr (char *new_ptr)
309 ACE_TRACE ("ACE_Message_Block::wr_ptr");
310 this->wr_ptr_ = new_ptr - this->base ();
313 // Return a pointer to 1 past the end of the data buffer.
316 ACE_Data_Block::mark () const
318 ACE_TRACE ("ACE_Data_Block::mark");
319 return this->base_ + this->cur_size_;
323 ACE_Message_Block::mark () const
325 ACE_TRACE ("ACE_Message_Block::mark");
326 return this->data_block ()->mark ();
330 ACE_Data_Block::end () const
332 ACE_TRACE ("ACE_Data_Block::end");
333 return this->base_ + this->max_size_;
337 ACE_Message_Block::end () const
339 ACE_TRACE ("ACE_Message_Block::end");
340 return this->data_block ()->end ();
345 ACE_Message_Block::rd_ptr (char *new_ptr)
347 ACE_TRACE ("ACE_Message_Block::rd_ptr");
348 this->rd_ptr_ = new_ptr - this->base ();
352 ACE_Message_Block::rd_ptr (size_t n)
354 ACE_TRACE ("ACE_Message_Block::rd_ptr");
359 ACE_Message_Block::wr_ptr () const
361 ACE_TRACE ("ACE_Message_Block::wr_ptr");
362 return this->base () + this->wr_ptr_;
366 ACE_Message_Block::wr_ptr (size_t n)
368 ACE_TRACE ("ACE_Message_Block::wr_ptr");
373 ACE_Message_Block::reset ()
375 ACE_TRACE ("ACE_Message_Block::reset");
381 ACE_Message_Block::space () const
383 ACE_TRACE ("ACE_Message_Block::space");
384 return this->mark () - this->wr_ptr ();
387 ACE_INLINE ACE_Data_Block *
388 ACE_Message_Block::replace_data_block (ACE_Data_Block *db)
390 ACE_TRACE ("ACE_Message_Block::replace_data_block");
391 ACE_Data_Block *old = this->data_block_;
392 this->data_block_ = db;
396 // Set the read and write pointers in the <Message_Block> to point
397 // to the buffer in the ACE_Data_Block.
398 this->rd_ptr (this->data_block ()->base ());
399 this->wr_ptr (this->data_block ()->base ());
406 ACE_Message_Block::cont (ACE_Message_Block *cont_msg)
408 ACE_TRACE ("ACE_Message_Block::cont");
409 this->cont_ = cont_msg;
412 ACE_INLINE ACE_Message_Block *
413 ACE_Message_Block::cont () const
415 ACE_TRACE ("ACE_Message_Block::cont");
420 ACE_Message_Block::reset_allocators (ACE_Allocator *allocator_strategy,
421 ACE_Allocator *data_block_allocator,
422 ACE_Allocator *message_block_allocator)
424 this->data_block_->allocator_strategy_ =
426 this->data_block_->data_block_allocator_ =
427 data_block_allocator;
428 this->message_block_allocator_ =
429 message_block_allocator;
431 if (this->cont () != 0)
432 this->cont ()->reset_allocators (allocator_strategy,
433 data_block_allocator,
434 message_block_allocator);
438 ACE_Message_Block::next (ACE_Message_Block *next_msg)
440 ACE_TRACE ("ACE_Message_Block::next");
441 this->next_ = next_msg;
444 ACE_INLINE ACE_Message_Block *
445 ACE_Message_Block::next () const
447 ACE_TRACE ("ACE_Message_Block::next");
452 ACE_Message_Block::prev (ACE_Message_Block *next_msg)
454 ACE_TRACE ("ACE_Message_Block::prev");
455 this->prev_ = next_msg;
458 ACE_INLINE ACE_Message_Block *
459 ACE_Message_Block::prev () const
461 ACE_TRACE ("ACE_Message_Block::prev");
465 ACE_INLINE ACE_Allocator *
466 ACE_Data_Block::allocator_strategy () const
468 ACE_TRACE ("ACE_Data_Block::allocator_strategy");
469 return this->allocator_strategy_;
472 ACE_INLINE ACE_Lock *
473 ACE_Data_Block::locking_strategy ()
475 ACE_TRACE ("ACE_Data_Block::locking_strategy");
476 return this->locking_strategy_;
479 ACE_INLINE ACE_Lock *
480 ACE_Data_Block::locking_strategy (ACE_Lock *nls)
482 ACE_TRACE ("ACE_Data_Block::locking_strategy");
483 ACE_Lock *ols = this->locking_strategy_;
485 this->locking_strategy_ = nls;
489 ACE_INLINE ACE_Lock *
490 ACE_Message_Block::locking_strategy ()
492 ACE_TRACE ("ACE_Message_Block::locking_strategy");
493 return this->data_block ()->locking_strategy ();
496 ACE_INLINE ACE_Lock *
497 ACE_Message_Block::locking_strategy (ACE_Lock *nls)
499 ACE_TRACE ("ACE_Message_Block::locking_strategy");
500 ACE_Lock *ols = this->data_block ()->locking_strategy ();
501 this->data_block ()->locking_strategy (nls);
505 ACE_END_VERSIONED_NAMESPACE_DECL