#include <Message_Block.h>
Collaboration diagram for ACE_Message_Block:

| Public Types | |
| typedef int | ACE_Message_Type | 
| typedef unsigned long | Message_Flags | 
| enum | { MB_DATA = 0x01, MB_PROTO = 0x02, MB_BREAK = 0x03, MB_PASSFP = 0x04, MB_EVENT = 0x05, MB_SIG = 0x06, MB_IOCTL = 0x07, MB_SETOPTS = 0x08, MB_IOCACK = 0x81, MB_IOCNAK = 0x82, MB_PCPROTO = 0x83, MB_PCSIG = 0x84, MB_READ = 0x85, MB_FLUSH = 0x86, MB_STOP = 0x87, MB_START = 0x88, MB_HANGUP = 0x89, MB_ERROR = 0x8a, MB_PCEVENT = 0x8b, MB_NORMAL = 0x00, MB_PRIORITY = 0x80, MB_USER = 0x200 } | 
| enum | { DONT_DELETE = 01, USER_FLAGS = 0x1000 } | 
| Public Member Functions | |
| ACE_Message_Block (ACE_Allocator *message_block_allocator=0) | |
| Create an empty message. | |
| ACE_Message_Block (ACE_Data_Block *, Message_Flags flags=0, ACE_Allocator *message_block_allocator=0) | |
| ACE_Message_Block (const char *data, size_t size=0, unsigned long priority=ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY) | |
| ACE_Message_Block (size_t size, ACE_Message_Type type=MB_DATA, ACE_Message_Block *cont=0, const char *data=0, ACE_Allocator *allocator_strategy=0, ACE_Lock *locking_strategy=0, unsigned long priority=ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY, const ACE_Time_Value &execution_time=ACE_Time_Value::zero, const ACE_Time_Value &deadline_time=ACE_Time_Value::max_time, ACE_Allocator *data_block_allocator=0, ACE_Allocator *message_block_allocator=0) | |
| ACE_Message_Block (const ACE_Message_Block &mb, size_t align) | |
| int | init (const char *data, size_t size=0) | 
| int | init (size_t size, ACE_Message_Type type=MB_DATA, ACE_Message_Block *cont=0, const char *data=0, ACE_Allocator *allocator_strategy=0, ACE_Lock *locking_strategy=0, unsigned long priority=ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY, const ACE_Time_Value &execution_time=ACE_Time_Value::zero, const ACE_Time_Value &deadline_time=ACE_Time_Value::max_time, ACE_Allocator *data_block_allocator=0, ACE_Allocator *message_block_allocator=0) | 
| virtual | ~ACE_Message_Block (void) | 
| ACE_Message_Type | msg_type (void) const | 
| Get type of the message. | |
| void | msg_type (ACE_Message_Type type) | 
| Set type of the message. | |
| int | is_data_msg (void) const | 
| Find out what type of message this is. | |
| ACE_Message_Type | msg_class (void) const | 
| Message_Flags | set_flags (Message_Flags more_flags) | 
| Message_Flags | clr_flags (Message_Flags less_flags) | 
| Message_Flags | flags (void) const | 
| Get the current message flags. | |
| Message_Flags | set_self_flags (ACE_Message_Block::Message_Flags more_flags) | 
| Message_Flags | clr_self_flags (ACE_Message_Block::Message_Flags less_flags) | 
| Message_Flags | self_flags (void) const | 
| Get the current message flags. | |
| unsigned long | msg_priority (void) const | 
| Get priority of the message. | |
| void | msg_priority (unsigned long priority) | 
| Set priority of the message. | |
| const ACE_Time_Value & | msg_execution_time (void) const | 
| Get execution time associated with the message. | |
| void | msg_execution_time (const ACE_Time_Value &et) | 
| Set execution time associated with the message. | |
| const ACE_Time_Value & | msg_deadline_time (void) const | 
| Get absolute time of deadline associated with the message. | |
| void | msg_deadline_time (const ACE_Time_Value &dt) | 
| Set absolute time of deadline associated with the message. | |
| virtual ACE_Message_Block * | clone (Message_Flags mask=0) const | 
| virtual ACE_Message_Block * | duplicate (void) const | 
| Return a "shallow" copy that increments our reference count by 1. | |
| virtual ACE_Message_Block * | release (void) | 
| int | copy (const char *buf, size_t n) | 
| int | copy (const char *buf) | 
| int | crunch (void) | 
| void | reset (void) | 
| void | access_allocators (ACE_Allocator *&allocator_strategy, ACE_Allocator *&data_block_allocator, ACE_Allocator *&message_block_allocator) | 
| void | reset_allocators (ACE_Allocator *allocator_strategy=0, ACE_Allocator *data_block_allocator=0, ACE_Allocator *message_block_allocator=0) | 
| char * | base (void) const | 
| Get message data. | |
| void | base (char *data, size_t size, Message_Flags=DONT_DELETE) | 
| Set message data (doesn't reallocate). | |
| char * | end (void) const | 
| Return a pointer to 1 past the end of the allocated data in a message. | |
| char * | mark (void) const | 
| char * | rd_ptr (void) const | 
| Get the read pointer. | |
| void | rd_ptr (char *ptr) | 
| Set the read pointer to ptr. | |
| void | rd_ptr (size_t n) | 
| Set the read pointer ahead n bytes. | |
| char * | wr_ptr (void) const | 
| Get the write pointer. | |
| void | wr_ptr (char *ptr) | 
| Set the write pointer to ptr. | |
| void | wr_ptr (size_t n) | 
| ACE_Data_Block * | data_block (void) const | 
| void | data_block (ACE_Data_Block *) | 
| ACE_Data_Block * | replace_data_block (ACE_Data_Block *) | 
| ACE_Message_Block * | cont (void) const | 
| Get the continuation field. | |
| void | cont (ACE_Message_Block *) | 
| Set the continuation field. | |
| ACE_Message_Block * | next (void) const | 
| Get link to next message. | |
| void | next (ACE_Message_Block *) | 
| Set link to next message. | |
| ACE_Message_Block * | prev (void) const | 
| Get link to prev message. | |
| void | prev (ACE_Message_Block *) | 
| Set link to prev message. | |
| ACE_Lock * | locking_strategy (void) | 
| Get the locking strategy. | |
| ACE_Lock * | locking_strategy (ACE_Lock *) | 
| Set a new locking strategy and return the hold one. | |
| int | reference_count (void) const | 
| Get the current reference count. | |
| void | dump (void) const | 
| Dump the state of an object. | |
| Message length and size operations | |
| Message length is (wr_ptr - rd_ptr). 
Message size is capacity of the message, including data outside the [rd_ptr,wr_ptr] range.  | |
| size_t | length (void) const | 
| Get the length of the message. | |
| void | length (size_t n) | 
| Set the length of the message. | |
| size_t | total_length (void) const | 
| size_t | total_size (void) const | 
| void | total_size_and_length (size_t &mb_size, size_t &mb_length) const | 
| size_t | size (void) const | 
| int | size (size_t length) | 
| size_t | total_capacity (void) const | 
| size_t | capacity (void) const | 
| Get the number of allocated bytes in the top-level . | |
| size_t | space (void) const | 
| Static Public Member Functions | |
| ACE_Message_Block * | duplicate (const ACE_Message_Block *mb) | 
| ACE_Message_Block * | release (ACE_Message_Block *mb) | 
| Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. | |
| Protected Member Functions | |
| ACE_Message_Block (size_t size, ACE_Message_Type type, ACE_Message_Block *cont, const char *data, ACE_Allocator *allocator_strategy, ACE_Lock *locking_strategy, Message_Flags flags, unsigned long priority, const ACE_Time_Value &execution_time, const ACE_Time_Value &deadline_time, ACE_Data_Block *db, ACE_Allocator *data_block_allocator, ACE_Allocator *message_block_allocator) | |
| Perform the actual initialization. | |
| int | release_i (ACE_Lock *lock) | 
| int | init_i (size_t size, ACE_Message_Type type, ACE_Message_Block *cont, const char *data, ACE_Allocator *allocator_strategy, ACE_Lock *locking_strategy, Message_Flags flags, unsigned long priority, const ACE_Time_Value &execution_time, const ACE_Time_Value &deadline_time, ACE_Data_Block *db, ACE_Allocator *data_block_allocator, ACE_Allocator *message_block_allocator) | 
| Perform the actual initialization. | |
| Protected Attributes | |
| size_t | rd_ptr_ | 
| Pointer to beginning of next read. | |
| size_t | wr_ptr_ | 
| Pointer to beginning of next write. | |
| unsigned long | priority_ | 
| Priority of message. | |
| ACE_Message_Block * | cont_ | 
| Pointer to next message block in the chain. | |
| ACE_Message_Block * | next_ | 
| Pointer to next message in the list. | |
| ACE_Message_Block * | prev_ | 
| Pointer to previous message in the list. | |
| ACE_Message_Block::Message_Flags | flags_ | 
| Misc flags (e.g., DONT_DELETE and USER_FLAGS). | |
| ACE_Data_Block * | data_block_ | 
| ACE_Allocator * | message_block_allocator_ | 
| Private Member Functions | |
| ACE_Message_Block & | operator= (const ACE_Message_Block &) | 
| ACE_Message_Block (const ACE_Message_Block &) | |
| Friends | |
| class | ACE_Data_Block | 
An ACE_Message_Block is modeled after the message data structures used in System V STREAMS. Its purpose is to enable efficient manipulation of arbitrarily large messages without incurring much memory copying overhead. Here are the main characteristics of an ACE_Message_Block:
Definition at line 59 of file Message_Block.h.
| 
 | 
| 
 Definition at line 119 of file Message_Block.h. Referenced by ACE_Data_Block::ACE_Data_Block(), ACE_Locked_Data_Block< ACE_LOCK >::ACE_Locked_Data_Block(), ACE_Message_Block(), clone(), duplicate(), init(), init_i(), is_data_msg(), msg_type(), and ACE_Data_Block::msg_type(). | 
| 
 | 
| 
 | 
| 
 
 Definition at line 64 of file Message_Block.h. 
 00065   {
00066     // = Data and proto
00067     /// Undifferentiated data message
00068     MB_DATA     = 0x01,
00069     /// Undifferentiated protocol control
00070     MB_PROTO    = 0x02,
00071 
00072     // = Control messages
00073     /// Line break (regular and priority)
00074     MB_BREAK    = 0x03,
00075     /// Pass file pointer
00076     MB_PASSFP   = 0x04,
00077     /// Post an event to an event queue
00078     MB_EVENT    = 0x05,
00079     /// Generate process signal
00080     MB_SIG      = 0x06,
00081     /// ioctl; set/get params
00082     MB_IOCTL    = 0x07,
00083     /// Set various stream head options
00084     MB_SETOPTS  = 0x08,
00085 
00086     // = Control messages
00087     /// Acknowledge ioctl (high priority; go to head of queue)
00088     MB_IOCACK   = 0x81,
00089     /// Negative ioctl acknowledge
00090     MB_IOCNAK   = 0x82,
00091     /// Priority proto message
00092     MB_PCPROTO  = 0x83,
00093     /// Generate process signal
00094     MB_PCSIG    = 0x84,
00095     /// Generate read notification
00096     MB_READ     = 0x85,
00097     /// Flush your queues
00098     MB_FLUSH    = 0x86,
00099     /// Stop transmission immediately
00100     MB_STOP     = 0x87,
00101     /// Restart transmission after stop
00102     MB_START    = 0x88,
00103     /// Line disconnect
00104     MB_HANGUP   = 0x89,
00105     /// Fatal error used to set u.u_error
00106     MB_ERROR    = 0x8a,
00107     /// Post an event to an event queue
00108     MB_PCEVENT  = 0x8b,
00109 
00110     // = Message class masks
00111     /// Normal priority message mask
00112     MB_NORMAL   = 0x00,
00113     /// High priority control message mask
00114     MB_PRIORITY = 0x80,
00115     /// User-defined message mask
00116     MB_USER     = 0x200
00117   };
 | 
| 
 | 
| 
 
 Definition at line 122 of file Message_Block.h. 
 00123   {
00124     /// Don't delete the data on exit since we don't own it.
00125     DONT_DELETE = 01,
00126     /// user defined flags start here
00127     USER_FLAGS = 0x1000
00128   };
 | 
| 
 | 
| Create an empty message. 
 Definition at line 414 of file Message_Block.cpp. References ACE_ERROR, ACE_TEXT, ACE_TRACE, DONT_DELETE, init_i(), LM_ERROR, and MB_DATA. Referenced by clone(), and duplicate(). 
 00415 : flags_ (0), 00416 data_block_ (0) 00417 { 00418 ACE_TRACE ("ACE_Message_Block::ACE_Message_Block"); 00419 00420 if (this->init_i (0, // size 00421 MB_DATA, // type 00422 0, // cont 00423 0, // data 00424 0, // allocator 00425 0, // locking strategy 00426 ACE_Message_Block::DONT_DELETE, // flags 00427 0, // priority 00428 ACE_Time_Value::zero, // execution time 00429 ACE_Time_Value::max_time, // absolute time of deadline 00430 0, // data block 00431 0, // data_block allocator 00432 message_block_allocator) == -1) // message_block allocator 00433 ACE_ERROR ((LM_ERROR, 00434 ACE_TEXT ("ACE_Message_Block"))); 00435 } | 
| 
 | ||||||||||||||||
| 
Create an ACE_Message_Block that owns the specified ACE_Data_Block without copying it. If the flags is set to  Definition at line 557 of file Message_Block.cpp. References ACE_ERROR, ACE_TEXT, ACE_TRACE, ACE_Data_Block::data_block_allocator(), init_i(), LM_ERROR, MB_NORMAL, and Message_Flags. 
 00560 : flags_ (flags), 00561 data_block_ (0) 00562 { 00563 ACE_TRACE ("ACE_Message_Block::ACE_Message_Block"); 00564 00565 if (this->init_i (0, // size 00566 MB_NORMAL, // type 00567 0, // cont 00568 0, // data 00569 0, // allocator 00570 0, // locking strategy 00571 0, // flags 00572 0, // priority 00573 ACE_Time_Value::zero, // execution time 00574 ACE_Time_Value::max_time, // absolute time of deadline 00575 data_block, // data block 00576 data_block->data_block_allocator (), 00577 message_block_allocator) == -1) 00578 ACE_ERROR ((LM_ERROR, 00579 ACE_TEXT ("ACE_Message_Block"))); 00580 } | 
| 
 | ||||||||||||||||
| 
Create an ACE_Message_Block that refers to data without copying it. The data memory will not be freed when this block is destroyed; memory management of data is left to the caller. Note that the  Definition at line 389 of file Message_Block.cpp. References ACE_ERROR, ACE_TEXT, ACE_TRACE, DONT_DELETE, init_i(), LM_ERROR, and MB_DATA. 
 00392 : flags_ (0), 00393 data_block_ (0) 00394 { 00395 ACE_TRACE ("ACE_Message_Block::ACE_Message_Block"); 00396 00397 if (this->init_i (size, // size 00398 MB_DATA, // type 00399 0, // cont 00400 data, // data 00401 0, // allocator 00402 0, // locking strategy 00403 ACE_Message_Block::DONT_DELETE, // flags 00404 priority, // priority 00405 ACE_Time_Value::zero, // execution time 00406 ACE_Time_Value::max_time, // absolute time of deadline 00407 0, // data block 00408 0, // data_block allocator 00409 0) == -1) // message_block allocator 00410 ACE_ERROR ((LM_ERROR, 00411 ACE_TEXT ("ACE_Message_Block"))); 00412 } | 
| 
 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 
Create an initialized message of type type containing size bytes. The cont argument initializes the continuation field in the ACE_Message_Block. If data == 0 then this block allocates and owns the block's memory, using allocator to get the data if it's non-0. If data != 0 then this block refers to that memory until this this block ceases to exist; this object will not free data on destruction. If locking_strategy is non-0 then this is used to protect regions of code that access shared state (e.g., reference counting) from race conditions. Note that the  
 Definition at line 437 of file Message_Block.cpp. References ACE_ERROR, ACE_Message_Type, ACE_TEXT, ACE_TRACE, DONT_DELETE, init_i(), and LM_ERROR. 
 00448 :flags_ (0), 00449 data_block_ (0) 00450 { 00451 ACE_TRACE ("ACE_Message_Block::ACE_Message_Block"); 00452 00453 if (this->init_i (size, 00454 msg_type, 00455 msg_cont, 00456 msg_data, 00457 allocator_strategy, 00458 locking_strategy, 00459 msg_data ? ACE_Message_Block::DONT_DELETE : 0, 00460 priority, 00461 execution_time, 00462 deadline_time, 00463 0, // data block 00464 data_block_allocator, 00465 message_block_allocator) == -1) 00466 ACE_ERROR ((LM_ERROR, 00467 ACE_TEXT ("ACE_Message_Block"))); 00468 } | 
| 
 | ||||||||||||
| A copy constructor. This constructor is a bit different. If the incoming Message Block has a data block from the stack this constructor does a deep copy ie. allocates a new data block on the heap and does a copy of the data from the incoming message block. As a final note, the alignment information is used to align the data block if it is created afresh. If the incoming mb has a data block has a data block allocated from the heap, then this constructor just duplicates (ie. a shallow copy) the data block of the incoming mb. Definition at line 582 of file Message_Block.cpp. References ACE_BIT_DISABLED, ACE_ERROR, ACE_ptr_align_binary(), ACE_TEXT, ACE_TRACE, base(), ACE_Data_Block::clone_nocopy(), data_block(), ACE_Data_Block::data_block_allocator(), DONT_DELETE, ACE_Data_Block::duplicate(), flags_, init_i(), LM_ERROR, MB_NORMAL, ACE_OS::memcpy(), message_block_allocator_, rd_ptr(), wr_ptr(), and wr_ptr_. 
 00584 :flags_ (0), 00585 data_block_ (0) 00586 { 00587 ACE_TRACE ("ACE_Message_Block::ACE_Message_Block"); 00588 00589 if (ACE_BIT_DISABLED (mb.flags_, 00590 ACE_Message_Block::DONT_DELETE)) 00591 { 00592 if (this->init_i (0, // size 00593 MB_NORMAL, // type 00594 0, // cont 00595 0, // data 00596 0, // allocator 00597 0, // locking strategy 00598 0, // flags 00599 0, // priority 00600 ACE_Time_Value::zero, // execution time 00601 ACE_Time_Value::max_time, // absolute time of deadline 00602 mb.data_block ()->duplicate (), // data block 00603 mb.data_block ()->data_block_allocator (), 00604 mb.message_block_allocator_) == -1) 00605 ACE_ERROR ((LM_ERROR, 00606 ACE_TEXT ("ACE_Message_Block"))); 00607 #if !defined (ACE_LACKS_CDR_ALIGNMENT) 00608 // Align ourselves 00609 char *start = ACE_ptr_align_binary (this->base (), 00610 align); 00611 #else 00612 char *start = this->base (); 00613 #endif /* ACE_LACKS_CDR_ALIGNMENT */ 00614 00615 // Set our rd & wr pointers 00616 this->rd_ptr (start); 00617 this->wr_ptr (start); 00618 00619 } 00620 else 00621 { 00622 if (this->init_i (0, // size 00623 MB_NORMAL, // type 00624 0, // cont 00625 0, // data 00626 0, // allocator 00627 0, // locking strategy 00628 0, // flags 00629 0, // priority 00630 ACE_Time_Value::zero, // execution time 00631 ACE_Time_Value::max_time, // absolute time of deadline 00632 mb.data_block ()->clone_nocopy (),// data block 00633 mb.data_block ()->data_block_allocator (), 00634 mb.message_block_allocator_) == -1) 00635 ACE_ERROR ((LM_ERROR, 00636 ACE_TEXT ("ACE_Message_Block"))); 00637 00638 #if !defined (ACE_LACKS_CDR_ALIGNMENT) 00639 // Align ourselves 00640 char *start = ACE_ptr_align_binary (this->base (), 00641 align); 00642 #else 00643 char *start = this->base (); 00644 #endif /* ACE_LACKS_CDR_ALIGNMENT */ 00645 00646 // Set our rd & wr pointers 00647 this->rd_ptr (start); 00648 this->wr_ptr (start); 00649 00650 #if !defined (ACE_LACKS_CDR_ALIGNMENT) 00651 // Get the alignment offset of the incoming ACE_Message_Block 00652 start = ACE_ptr_align_binary (mb.base (), 00653 align); 00654 #else 00655 start = mb.base (); 00656 #endif /* ACE_LACKS_CDR_ALIGNMENT */ 00657 00658 // Actual offset for the incoming message block assuming that it 00659 // is also aligned to the same "align" byte 00660 size_t const wr_offset = mb.wr_ptr_ - (start - mb.base ()); 00661 00662 // Copy wr_offset amount of data in to <this->data_block> 00663 (void) ACE_OS::memcpy (this->wr_ptr (), 00664 start, 00665 wr_offset); 00666 00667 // Dont move the write pointer, just leave it to the application 00668 // to do what it wants 00669 00670 } 00671 #if defined (ACE_LACKS_CDR_ALIGNMENT) 00672 ACE_UNUSED_ARG (align); 00673 #endif /* ACE_LACKS_CDR_ALIGNMENT */ 00674 } | 
| 
 | 
| Delete all the resources held in the message. Note that <release()> is designed to release the continuation chain; the destructor is not. See <release()> for details. Definition at line 972 of file Message_Block.cpp. References ACE_BIT_DISABLED, ACE_TRACE, data_block(), DONT_DELETE, and ACE_Data_Block::release(). 
 00973 {
00974   ACE_TRACE ("ACE_Message_Block::~ACE_Message_Block");
00975 
00976   if (ACE_BIT_DISABLED (this->flags_,
00977                         ACE_Message_Block::DONT_DELETE)&&
00978       this->data_block ())
00979     this->data_block ()->release ();
00980 
00981   this->prev_ = 0;
00982   this->next_ = 0;
00983 }
 | 
| 
 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Perform the actual initialization. 
 Definition at line 522 of file Message_Block.cpp. References ACE_ERROR, ACE_Message_Type, ACE_TEXT, ACE_TRACE, init_i(), LM_ERROR, and Message_Flags. 
 00535 : flags_ (0), 00536 data_block_ (0) 00537 { 00538 ACE_TRACE ("ACE_Message_Block::ACE_Message_Block"); 00539 00540 if (this->init_i (size, 00541 msg_type, 00542 msg_cont, 00543 msg_data, 00544 allocator_strategy, 00545 locking_strategy, 00546 flags, 00547 priority, 00548 execution_time, 00549 deadline_time, 00550 db, 00551 data_block_allocator, 00552 message_block_allocator) == -1) 00553 ACE_ERROR ((LM_ERROR, 00554 ACE_TEXT ("ACE_Message_Block"))); 00555 } | 
| 
 | 
| 
 | 
| 
 | ||||||||||||||||
| This method returns the allocators only from the first message block in the chain. 
 
 Definition at line 272 of file Message_Block.inl. References ACE_Data_Block::allocator_strategy_, data_block_, ACE_Data_Block::data_block_allocator_, and message_block_allocator_. 
 00275 {
00276   allocator_strategy =
00277     this->data_block_->allocator_strategy_;
00278   data_block_allocator =
00279     this->data_block_->data_block_allocator_;
00280   message_block_allocator =
00281     this->message_block_allocator_;
00282 }
 | 
| 
 | ||||||||||||||||
| Set message data (doesn't reallocate). 
 Definition at line 292 of file Message_Block.inl. References ACE_TRACE, ACE_Data_Block::base(), data_block(), Message_Flags, rd_ptr_, and wr_ptr_. 
 00295 {
00296   ACE_TRACE ("ACE_Message_Block::base");
00297   this->rd_ptr_ = 0;
00298   this->wr_ptr_ = 0;
00299   this->data_block ()->base (msg_data, msg_length, msg_flags);
00300 }
 | 
| 
 | 
| Get message data. 
 Definition at line 285 of file Message_Block.inl. References ACE_TRACE, ACE_Data_Block::base(), and data_block(). Referenced by ACE_InputCDR::ACE_InputCDR(), ACE_Message_Block(), ACE_Activation_Queue::dequeue(), ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_USE >::dequeue_deadline(), ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_USE >::dequeue_head(), ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_USE >::dequeue_prio(), ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_USE >::dequeue_tail(), ACE_InputCDR::exchange_data_blocks(), ACE_CDR::mb_align(), ACE_Future_Set< T >::next_readable(), ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_USE >::peek_dequeue_head(), rd_ptr(), and wr_ptr(). 
 00286 {
00287   ACE_TRACE ("ACE_Message_Block::base");
00288   return this->data_block ()->base ();
00289 }
 | 
| 
 | 
| Get the number of allocated bytes in the top-level . 
 Definition at line 154 of file Message_Block.inl. References ACE_TRACE, ACE_Data_Block::capacity(), and data_block(). Referenced by total_capacity(). 
 00155 {
00156   ACE_TRACE ("ACE_Message_Block::capacity");
00157   return this->data_block ()->capacity ();
00158 }
 | 
| 
 | 
| Return an exact "deep copy" of the message, i.e., create fresh new copies of all the Data_Blocks and continuations. Definition at line 1170 of file Message_Block.cpp. References ACE_DEADLINE_TIME, ACE_EXECUTION_TIME, ACE_Message_Block(), ACE_Message_Type, ACE_NEW_RETURN, ACE_TRACE, ACE_Data_Block::clone(), cont(), cont_, data_block(), ACE_Data_Block::data_block_allocator(), ACE_Allocator::malloc(), message_block_allocator_, Message_Flags, rd_ptr(), release(), ACE_Data_Block::release(), and wr_ptr(). Referenced by ACE_InputCDR::steal_contents(). 
 01171 {
01172   ACE_TRACE ("ACE_Message_Block::clone");
01173 
01174   // Get a pointer to a "cloned" <ACE_Data_Block> (will copy the
01175   // values rather than increment the reference count).
01176   ACE_Data_Block *db = this->data_block ()->clone (mask);
01177 
01178   if (db == 0)
01179     return 0;
01180 
01181   ACE_Message_Block *nb = 0;
01182 
01183   if(message_block_allocator_ == 0)
01184     {
01185       ACE_NEW_RETURN (nb,
01186                       ACE_Message_Block (0, // size
01187                                          ACE_Message_Type (0), // type
01188                                          0, // cont
01189                                          0, // data
01190                                          0, // allocator
01191                                          0, // locking strategy
01192                                          0, // flags
01193                                          this->priority_, // priority
01194                                          ACE_EXECUTION_TIME, // execution time
01195                                          ACE_DEADLINE_TIME, // absolute time to deadline
01196                                          // Get a pointer to a
01197                                          // "duplicated" <ACE_Data_Block>
01198                                          // (will simply increment the
01199                                          // reference count).
01200                                          db,
01201                                          db->data_block_allocator (),
01202                                          this->message_block_allocator_),
01203                       0);
01204     }
01205   else
01206     {
01207       // This is the ACE_NEW_MALLOC macro with the return check removed.
01208       // We need to do it this way because if it fails we need to release
01209       // the cloned data block that was created above.  If we used
01210       // ACE_NEW_MALLOC_RETURN, there would be a memory leak because the
01211       // above db pointer would be left dangling.
01212       nb = static_cast<ACE_Message_Block*> (message_block_allocator_->malloc (sizeof (ACE_Message_Block)));
01213       if(nb != 0)
01214         new (nb) ACE_Message_Block (0, // size
01215                                     ACE_Message_Type (0), // type
01216                                     0, // cont
01217                                     0, // data
01218                                     0, // allocator
01219                                     0, // locking strategy
01220                                     0, // flags
01221                                     this->priority_, // priority
01222                                     ACE_EXECUTION_TIME, // execution time
01223                                     ACE_DEADLINE_TIME, // absolute time to deadline
01224                                     db,
01225                                     db->data_block_allocator (),
01226                                     this->message_block_allocator_);
01227     }
01228 
01229   if (nb == 0)
01230     {
01231       db->release ();
01232       return 0;
01233     }
01234 
01235   // Set the read and write pointers in the new <Message_Block> to the
01236   // same relative offset as in the existing <Message_Block>.
01237   nb->rd_ptr (this->rd_ptr_);
01238   nb->wr_ptr (this->wr_ptr_);
01239 
01240   // Clone all the continuation messages if necessary.
01241   if (this->cont () != 0
01242       && (nb->cont_ = this->cont ()->clone (mask)) == 0)
01243     {
01244       nb->release ();
01245       return 0;
01246     }
01247   return nb;
01248 }
 | 
| 
 | 
| Clear the message flag bits specified in less_flags and return the new value. Definition at line 112 of file Message_Block.inl. References ACE_TRACE, ACE_Data_Block::clr_flags(), data_block(), and Message_Flags. 
 00113 {
00114   ACE_TRACE ("ACE_Message_Block::clr_flags");
00115   return this->data_block ()->clr_flags (less_flags);
00116 }
 | 
| 
 | 
| Clear the message flag bits specified in less_flags and return the new value. Definition at line 24 of file Message_Block.inl. References ACE_CLR_BITS, ACE_TRACE, and Message_Flags. Referenced by ACE_InputCDR::clone_from(), ACE_InputCDR::exchange_data_blocks(), ACE_CDR::grow(), ACE_InputCDR::reset_contents(), ACE_InputCDR::steal_contents(), and ACE_InputCDR::steal_from(). 
 00025 {
00026   ACE_TRACE ("ACE_Message_Block::clr_self_flags");
00027   // Later we might mask more_flags so that user can't change internal
00028   // ones: less_flags &= ~(USER_FLAGS -1).
00029   return ACE_CLR_BITS (this->flags_, less_flags);
00030 }
 | 
| 
 | 
| Set the continuation field. 
 Definition at line 409 of file Message_Block.inl. References ACE_TRACE, and cont_. 
 | 
| 
 | 
| Get the continuation field. 
 Definition at line 416 of file Message_Block.inl. References ACE_TRACE, and cont_. Referenced by ACE_InputCDR::ACE_InputCDR(), clone(), ACE_OutputCDR::consolidate(), ACE_CDR::consolidate(), ACE_Stream_Tail<>::control(), ACE_Stream_Head<>::control(), ACE_OutputCDR::end(), ACE_OutputCDR::find(), ACE_OutputCDR::grow_and_adjust(), ACE::recv_n(), reset_allocators(), ACE::send_n(), total_capacity(), total_length(), ACE_CDR::total_length(), total_size(), total_size_and_length(), ACE::write_n(), ACE_OutputCDR::write_octet_array_mb(), and ACE_OutputCDR::~ACE_OutputCDR(). 
 | 
| 
 | 
| Copies a 0-terminated character string into this ACE_Message_Block. The string is copied into the block starting at the current write pointer. The 0-terminator is included in the copied data. 
 
 
 Definition at line 102 of file Message_Block.cpp. References ACE_TRACE, ACE_OS::memcpy(), space(), ACE_OS::strlen(), and wr_ptr(). 
 00103 {
00104   ACE_TRACE ("ACE_Message_Block::copy");
00105 
00106   /* size_t len = static_cast<size_t> (this->end () - this->wr_ptr ()); */
00107   // Note that for this to work correct, end() *must* be >= wr_ptr().
00108   size_t len = this->space ();
00109 
00110   size_t buflen = ACE_OS::strlen (buf) + 1;
00111 
00112   if (len < buflen)
00113     {
00114       errno = ENOSPC;
00115       return -1;
00116     }
00117   else
00118     {
00119       (void) ACE_OS::memcpy (this->wr_ptr (),
00120                              buf,
00121                              buflen);
00122       this->wr_ptr (buflen);
00123       return 0;
00124     }
00125 }
 | 
| 
 | ||||||||||||
| Copies data into this ACE_Message_Block. Data is copied into the block starting at the current write pointer. 
 
 
 Definition at line 78 of file Message_Block.cpp. References ACE_TRACE, ACE_OS::memcpy(), space(), and wr_ptr(). Referenced by ACE_InputCDR::ACE_InputCDR(), ACE_OutputCDR::consolidate(), ACE_CDR::consolidate(), and ACE_UPIPE_Stream::send(). 
 00079 {
00080   ACE_TRACE ("ACE_Message_Block::copy");
00081 
00082   /*size_t len = static_cast<size_t> (this->end () - this->wr_ptr ());*/
00083   // Note that for this to work correct, end () *must* be >= mark ().
00084   size_t len = this->space ();
00085 
00086   if (len < n)
00087     {
00088       errno = ENOSPC;
00089       return -1;
00090     }
00091   else
00092     {
00093       (void) ACE_OS::memcpy (this->wr_ptr (),
00094                              buf,
00095                              n);
00096       this->wr_ptr (n);
00097       return 0;
00098     }
00099 }
 | 
| 
 | 
| Normalizes data in the top-level to align with the base, i.e., it "shifts" the data pointed to by down to the and then readjusts to point to and to point to + the length of the moved data. Returns -1 and does nothing if the is > , else 0 on success. Definition at line 128 of file Message_Block.cpp. References length(), ACE_OS::memmove(), rd_ptr(), rd_ptr_, wr_ptr(), and wr_ptr_. 
 00129 {
00130   if (this->rd_ptr_ != 0)
00131     {
00132       if (this->rd_ptr_ > this->wr_ptr_)
00133         return -1;
00134 
00135       size_t const len = this->length ();
00136       (void) ACE_OS::memmove (this->base (),
00137                               this->rd_ptr (),
00138                               len);
00139       this->rd_ptr (this->base ());
00140       this->wr_ptr (this->base () + len);
00141     }
00142   return 0;
00143 }
 | 
| 
 | 
| Set a new data block pointer. The original ACE_Data_Block is released as a result of this call. If you need to keep the original block, call instead. Upon return, this ACE_Message_Block holds a pointer to the new ACE_Data_Block, taking over the reference you held on it prior to the call. Definition at line 61 of file Message_Block.cpp. References ACE_BIT_DISABLED, ACE_TRACE, data_block_, DONT_DELETE, rd_ptr(), ACE_Data_Block::release(), and wr_ptr(). 
 00062 {
00063   ACE_TRACE ("ACE_Message_Block::data_block");
00064   if (ACE_BIT_DISABLED (this->flags_,
00065                         ACE_Message_Block::DONT_DELETE)
00066       && this->data_block_ != 0)
00067     this->data_block_->release ();
00068 
00069   this->data_block_ = db;
00070 
00071   // Set the read and write pointers in the <Message_Block> to point
00072   // to the buffer in the <ACE_Data_Block>.
00073   this->rd_ptr (this->data_block ()->base ());
00074   this->wr_ptr (this->data_block ()->base ());
00075 }
 | 
| 
 | 
| Get a pointer to the data block. Note that the ACE_Message_Block still references the block; this call does not change the reference count. Definition at line 8 of file Message_Block.inl. References ACE_TRACE, and data_block_. Referenced by ACE_InputCDR::ACE_InputCDR(), ACE_Message_Block(), base(), capacity(), clone(), ACE_InputCDR::clone_from(), clr_flags(), dump(), duplicate(), end(), ACE_InputCDR::exchange_data_blocks(), flags(), ACE_CDR::grow(), ACE_OutputCDR::grow_and_adjust(), init_i(), locking_strategy(), mark(), msg_type(), ACE_InputCDR::operator=(), reference_count(), release(), release_i(), ACE_InputCDR::reset_contents(), set_flags(), size(), ACE_InputCDR::steal_contents(), ACE_InputCDR::steal_from(), ACE_OutputCDR::write_octet_array_mb(), and ~ACE_Message_Block(). 
 00009 {
00010   ACE_TRACE ("ACE_Message_Block::data_block");
00011   return this->data_block_;
00012 }
 | 
| 
 | 
| Dump the state of an object. 
 Definition at line 174 of file Message_Block.cpp. References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_TEXT, ACE_TRACE, data_block(), ACE_Data_Block::dump(), and LM_DEBUG. 
 00175 {
00176 #if defined (ACE_HAS_DUMP)
00177   ACE_TRACE ("ACE_Message_Block::dump");
00178   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00179   ACE_DEBUG ((LM_DEBUG,
00180               ACE_TEXT ("-----( Message Block )-----\n")
00181               ACE_TEXT ("priority_ = %d\n")
00182               ACE_TEXT ("next_ = %u\n")
00183               ACE_TEXT ("prev_ = %u\n")
00184               ACE_TEXT ("cont_ = %u\n")
00185               ACE_TEXT ("rd_ptr_ = %u\n")
00186               ACE_TEXT ("wr_ptr_ = %u\n")
00187               ACE_TEXT ("---------------------------\n"),
00188               this->priority_,
00189               this->next_,
00190               this->prev_,
00191               this->cont_,
00192               this->rd_ptr_,
00193               this->wr_ptr_));
00194   this->data_block ()->dump ();
00195   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00196 #endif /* ACE_HAS_DUMP */
00197 }
 | 
| 
 | 
| Return a "shallow" copy that increments our reference count by 1. This is similar to CORBA's method, which is useful if you want to eliminate lots of checks for NULL mb pointers before calling on them. Definition at line 1092 of file Message_Block.cpp. References ACE_TRACE, and duplicate(). 
 | 
| 
 | 
| Return a "shallow" copy that increments our reference count by 1. 
 Definition at line 1013 of file Message_Block.cpp. References ACE_DEADLINE_TIME, ACE_EXECUTION_TIME, ACE_Message_Block(), ACE_Message_Type, ACE_NEW_MALLOC_RETURN, ACE_NEW_RETURN, ACE_TRACE, cont_, data_block(), ACE_Data_Block::data_block_allocator(), ACE_Allocator::malloc(), message_block_allocator_, rd_ptr(), release(), and wr_ptr(). Referenced by duplicate(). 
 01014 {
01015   ACE_TRACE ("ACE_Message_Block::duplicate");
01016 
01017   ACE_Message_Block *nb = 0;
01018 
01019   // Create a new <ACE_Message_Block> that contains unique copies of
01020   // the message block fields, but a reference counted duplicate of
01021   // the <ACE_Data_Block>.
01022 
01023   // If there is no allocator, use the standard new and delete calls.
01024   if (this->message_block_allocator_ == 0)
01025     ACE_NEW_RETURN (nb,
01026                     ACE_Message_Block (0, // size
01027                                        ACE_Message_Type (0), // type
01028                                        0, // cont
01029                                        0, // data
01030                                        0, // allocator
01031                                        0, // locking strategy
01032                                        0, // flags
01033                                        this->priority_, // priority
01034                                        ACE_EXECUTION_TIME,
01035                                        ACE_DEADLINE_TIME,
01036                                        // Get a pointer to a
01037                                        // "duplicated" <ACE_Data_Block>
01038                                        // (will simply increment the
01039                                        // reference count).
01040                                        this->data_block ()->duplicate  (),
01041                                        this->data_block ()->data_block_allocator (),
01042                                        this->message_block_allocator_),
01043                   0);
01044   else // Otherwise, use the message_block_allocator passed in.
01045     ACE_NEW_MALLOC_RETURN (nb,
01046                            static_cast<ACE_Message_Block*> (
01047                              message_block_allocator_->malloc (sizeof (ACE_Message_Block))),
01048                            ACE_Message_Block (0, // size
01049                                               ACE_Message_Type (0), // type
01050                                               0, // cont
01051                                               0, // data
01052                                               0, // allocator
01053                                               0, // locking strategy
01054                                               0, // flags
01055                                               this->priority_, // priority
01056                                               ACE_EXECUTION_TIME,
01057                                               ACE_DEADLINE_TIME,
01058                                               // Get a pointer to a
01059                                               // "duplicated" <ACE_Data_Block>
01060                                               // (will simply increment the
01061                                               // reference count).
01062                                               this->data_block ()->duplicate  (),
01063                                               this->data_block ()->data_block_allocator (),
01064                                               this->message_block_allocator_),
01065                            0);
01066 
01067   // Set the read and write pointers in the new <Message_Block> to the
01068   // same relative offset as in the existing <Message_Block>.  Note
01069   // that we are assuming that the data_block()->base() pointer
01070   // doesn't change when it's duplicated.
01071   nb->rd_ptr (this->rd_ptr_);
01072   nb->wr_ptr (this->wr_ptr_);
01073 
01074   // Increment the reference counts of all the continuation messages.
01075   if (this->cont_)
01076     {
01077       nb->cont_ = this->cont_->duplicate ();
01078 
01079       // If things go wrong, release all of our resources and return
01080       // 0.
01081       if (nb->cont_ == 0)
01082         {
01083           nb->release ();
01084           nb = 0;
01085         }
01086     }
01087 
01088   return nb;
01089 }
 | 
| 
 | 
| Return a pointer to 1 past the end of the allocated data in a message. 
 Definition at line 340 of file Message_Block.inl. References ACE_TRACE, data_block(), and ACE_Data_Block::end(). Referenced by ACE_InputCDR::ACE_InputCDR(), ACE_OutputCDR::adjust(), ACE_InputCDR::end(), and ACE_OutputCDR::write_octet_array_mb(). 
 00341 {
00342   ACE_TRACE ("ACE_Message_Block::end");
00343   return this->data_block ()->end ();
00344 }
 | 
| 
 | 
| Get the current message flags. 
 Definition at line 119 of file Message_Block.inl. References ACE_TRACE, data_block(), and ACE_Data_Block::flags(). Referenced by ACE_OutputCDR::write_octet_array_mb(). 
 00120 {
00121   ACE_TRACE ("ACE_Message_Block::flags");
00122    return this->data_block ()->flags ();
00123 }
 | 
| 
 | ||||||||||||||||||||||||||||||||||||||||||||||||
| Create an initialized message of type type containing size bytes. The cont argument initializes the continuation field in the . If data == 0 then we create and own the data, using allocator_strategy to get the data if it's non-0. If data != 0 we assume that we have ownership of the data till this object ceases to exist (and don't delete it during destruction). If locking_strategy is non-0 then this is used to protect regions of code that access shared state (e.g., reference counting) from race conditions. Note that the size of the will be size, but the length will be 0 until is set. The data_block_allocator is use to allocate the data blocks while the allocator_strategy is used to allocate the buffers contained by those. Definition at line 471 of file Message_Block.cpp. References ACE_Message_Type, ACE_TRACE, DONT_DELETE, and init_i(). 
 00482 {
00483   ACE_TRACE ("ACE_Message_Block::init");
00484 
00485   return this->init_i (size,
00486                        msg_type,
00487                        msg_cont,
00488                        msg_data,
00489                        allocator_strategy,
00490                        locking_strategy,
00491                        msg_data ? ACE_Message_Block::DONT_DELETE : 0,
00492                        priority,
00493                        execution_time,
00494                        deadline_time,
00495                        0,  // data block
00496                        data_block_allocator,
00497                        message_block_allocator);
00498 }
 | 
| 
 | ||||||||||||
| 
Create a Message Block that assumes it has ownership of data, but in reality it doesnt (i.e., cannot delete it since it didn't malloc it!). Note that the  Definition at line 501 of file Message_Block.cpp. References ACE_TRACE, DONT_DELETE, init_i(), and MB_DATA. 
 00503 {
00504   ACE_TRACE ("ACE_Message_Block::init");
00505   // Should we also initialize all the other fields, as well?
00506 
00507   return this->init_i (size,    // size
00508                        MB_DATA, // type
00509                        0,       // cont
00510                        data,    // data
00511                        0,       // allocator
00512                        0,       // locking strategy
00513                        ACE_Message_Block::DONT_DELETE,  // flags
00514                        0,  // priority
00515                        ACE_Time_Value::zero,     // execution time
00516                        ACE_Time_Value::max_time, // absolute time of deadline
00517                        0,  // data block
00518                        0,  // data_block allocator
00519                        0); // message_block allocator
00520 }
 | 
| 
 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Perform the actual initialization. 
 Definition at line 677 of file Message_Block.cpp. References ACE_ALLOCATOR_RETURN, ACE_Data_Block, ACE_FUNCTION_TIMEPROBE, ACE_Message_Type, ACE_NEW_MALLOC_RETURN, ACE_TIMEPROBE, ACE_TRACE, cont_, data_block(), data_block_, ACE_Allocator::free(), ACE_Allocator::malloc(), message_block_allocator_, Message_Flags, rd_ptr_, ACE_Data_Block::release(), ACE_Data_Block::size(), and wr_ptr_. Referenced by ACE_Message_Block(), and init(). 
 00690 {
00691   ACE_TRACE ("ACE_Message_Block::init_i");
00692   ACE_FUNCTION_TIMEPROBE (ACE_MESSAGE_BLOCK_INIT_I_ENTER);
00693 
00694   this->rd_ptr_ = 0;
00695   this->wr_ptr_ = 0;
00696   this->priority_ = priority;
00697 #if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS)
00698   this->execution_time_ = execution_time;
00699   this->deadline_time_ = deadline_time;
00700 #else
00701   ACE_UNUSED_ARG (execution_time);
00702   ACE_UNUSED_ARG (deadline_time);
00703 #endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */
00704   this->cont_ = msg_cont;
00705   this->next_ = 0;
00706   this->prev_ = 0;
00707 
00708   this->message_block_allocator_ = message_block_allocator;
00709 
00710   if (this->data_block_ != 0)
00711     {
00712       this->data_block_->release ();
00713       this->data_block_ = 0;
00714     }
00715 
00716   if (db == 0)
00717     {
00718       if (data_block_allocator == 0)
00719         ACE_ALLOCATOR_RETURN (data_block_allocator,
00720                               ACE_Allocator::instance (),
00721                               -1);
00722 
00723       ACE_TIMEPROBE (ACE_MESSAGE_BLOCK_INIT_I_DB_ALLOC);
00724 
00725       // Allocate the <ACE_Data_Block> portion, which is reference
00726       // counted.
00727       ACE_NEW_MALLOC_RETURN (db,
00728                              static_cast<ACE_Data_Block *> (
00729                                data_block_allocator->malloc (sizeof (ACE_Data_Block))),
00730                              ACE_Data_Block (size,
00731                                              msg_type,
00732                                              msg_data,
00733                                              allocator_strategy,
00734                                              locking_strategy,
00735                                              flags,
00736                                              data_block_allocator),
00737                              -1);
00738       ACE_TIMEPROBE (ACE_MESSAGE_BLOCK_INIT_I_DB_CTOR);
00739 
00740       // Message block initialization may fail, while the construction
00741       // succeds.  Since ACE may throw no exceptions, we have to do a
00742       // separate check and clean up, like this:
00743       if (db != 0 && db->size () < size)
00744         {
00745           db->ACE_Data_Block::~ACE_Data_Block();  // placement destructor ...
00746           data_block_allocator->free (db); // free ...
00747           errno = ENOMEM;
00748           return -1;
00749         }
00750     }
00751 
00752   // Reset the data_block_ pointer.
00753   this->data_block (db);
00754 
00755   return 0;
00756 }
 | 
| 
 | 
| Find out what type of message this is. 
 Definition at line 202 of file Message_Block.inl. References ACE_Message_Type, ACE_TRACE, MB_DATA, MB_PCPROTO, MB_PROTO, and msg_type(). 
 00203 {
00204   ACE_TRACE ("ACE_Message_Block::is_data_msg");
00205   ACE_Message_Type mt = this->msg_type ();
00206   return
00207     mt == ACE_Message_Block::MB_DATA
00208     || mt == ACE_Message_Block::MB_PROTO
00209     || mt == ACE_Message_Block::MB_PCPROTO;
00210 }
 | 
| 
 | 
| Set the length of the message. 
 Definition at line 138 of file Message_Block.inl. References ACE_TRACE, rd_ptr_, and wr_ptr_. 
 | 
| 
 | 
| Get the length of the message. 
 Definition at line 128 of file Message_Block.inl. References ACE_TRACE, rd_ptr_, and wr_ptr_. Referenced by ACE_InputCDR::ACE_InputCDR(), ACE_OutputCDR::consolidate(), ACE_CDR::consolidate(), crunch(), ACE_CDR::grow(), ACE_InputCDR::length(), ACE_OutputCDR::length(), ACE_UPIPE_Stream::recv(), ACE::recv_n(), ACE::send_n(), total_length(), ACE_CDR::total_length(), total_size_and_length(), ACE::write_n(), and ACE_OutputCDR::write_octet_array_mb(). 
 | 
| 
 | 
| Set a new locking strategy and return the hold one. 
 Definition at line 500 of file Message_Block.inl. References ACE_TRACE, data_block(), and ACE_Data_Block::locking_strategy(). 
 00501 {
00502   ACE_TRACE ("ACE_Message_Block::locking_strategy");
00503   ACE_Lock *ols = this->data_block ()->locking_strategy ();
00504   this->data_block ()->locking_strategy (nls);
00505   return ols;
00506 }
 | 
| 
 | 
| Get the locking strategy. 
 Definition at line 493 of file Message_Block.inl. References ACE_TRACE, data_block(), and ACE_Data_Block::locking_strategy(). 
 00494 {
00495   ACE_TRACE ("ACE_Message_Block::locking_strategy");
00496   return this->data_block ()->locking_strategy ();
00497 }
 | 
| 
 | 
| Return a pointer to 1 past the end of the allotted data in a message. Allotted data may be less than allocated data if a value smaller than capacity() to is passed to size(). Definition at line 326 of file Message_Block.inl. References ACE_TRACE, data_block(), and ACE_Data_Block::mark(). Referenced by space(). 
 00327 {
00328   ACE_TRACE ("ACE_Message_Block::mark");
00329   return this->data_block ()->mark ();
00330 }
 | 
| 
 | 
| 
Find out what class of message this is (there are two classes,  Definition at line 189 of file Message_Block.inl. References ACE_TRACE, MB_NORMAL, MB_PRIORITY, MB_USER, and msg_type(). 
 00190 {
00191   ACE_TRACE ("ACE_Message_Block::msg_class");
00192 
00193   if (this->msg_type () < ACE_Message_Block::MB_PRIORITY)
00194     return ACE_Message_Block::MB_NORMAL;
00195   else if (this->msg_type () < ACE_Message_Block::MB_USER)
00196     return ACE_Message_Block::MB_PRIORITY;
00197   else
00198     return ACE_Message_Block::MB_USER;
00199 }
 | 
| 
 | 
| Set absolute time of deadline associated with the message. 
 Definition at line 261 of file Message_Block.inl. References ACE_TRACE. 
 00262 {
00263   ACE_TRACE ("ACE_Message_Block::msg_deadline_time (const ACE_Time_Value & et)");
00264 #if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS)
00265   this->deadline_time_ = dt;
00266 #else
00267   ACE_UNUSED_ARG (dt);
00268 #endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */
00269 }
 | 
| 
 | 
| Get absolute time of deadline associated with the message. 
 Definition at line 249 of file Message_Block.inl. References ACE_TRACE. Referenced by ACE_Laxity_Message_Strategy::convert_priority(), ACE_Deadline_Message_Strategy::convert_priority(), ACE_Message_Queue< ACE_SYNCH_USE >::dequeue_deadline_i(), and ACE_Message_Queue< ACE_SYNCH_USE >::enqueue_deadline_i(). 
 00250 {
00251   ACE_TRACE ("ACE_Message_Block::msg_deadline_time (void)");
00252 
00253 #if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS)
00254   return this->deadline_time_;
00255 #else
00256   return ACE_Time_Value::max_time; // absolute time of deadline
00257 #endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */
00258 }
 | 
| 
 | 
| Set execution time associated with the message. 
 Definition at line 238 of file Message_Block.inl. References ACE_TRACE. 
 00239 {
00240   ACE_TRACE ("ACE_Message_Block::msg_execution_time (const ACE_Time_Value & et)");
00241 #if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS)
00242   this->execution_time_ = et;
00243 #else
00244   ACE_UNUSED_ARG (et);
00245 #endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */
00246 }
 | 
| 
 | 
| Get execution time associated with the message. 
 Definition at line 227 of file Message_Block.inl. References ACE_TRACE. Referenced by ACE_Laxity_Message_Strategy::convert_priority(). 
 00228 {
00229   ACE_TRACE ("ACE_Message_Block::msg_execution_time (void)");
00230 #if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS)
00231   return this->execution_time_;
00232 #else
00233   return ACE_Time_Value::zero;
00234 #endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */
00235 }
 | 
| 
 | 
| Set priority of the message. 
 Definition at line 220 of file Message_Block.inl. References ACE_TRACE. 
 | 
| 
 | 
| Get priority of the message. 
 Definition at line 213 of file Message_Block.inl. References ACE_TRACE. Referenced by ACE_Message_Queue< ACE_SYNCH_USE >::dequeue_prio_i(), ACE_Message_Queue< ACE_SYNCH_USE >::enqueue_i(), ACE_Dynamic_Message_Strategy::priority_status(), and ACE_Dynamic_Message_Queue<>::sublist_enqueue_i(). 
 | 
| 
 | 
| Set type of the message. 
 Definition at line 182 of file Message_Block.inl. References ACE_Message_Type, ACE_TRACE, data_block(), and ACE_Data_Block::msg_type(). 
 00183 {
00184   ACE_TRACE ("ACE_Message_Block::msg_type");
00185   this->data_block ()->msg_type (t);
00186 }
 | 
| 
 | 
| Get type of the message. 
 Definition at line 175 of file Message_Block.inl. References ACE_TRACE, data_block(), and ACE_Data_Block::msg_type(). Referenced by ACE_Stream_Tail<>::control(), is_data_msg(), msg_class(), ACE_Stream_Tail<>::put(), and ACE_Stream_Head<>::put(). 
 00176 {
00177   ACE_TRACE ("ACE_Message_Block::msg_type");
00178   return this->data_block ()->msg_type ();
00179 }
 | 
| 
 | 
| Set link to next message. 
 Definition at line 441 of file Message_Block.inl. References ACE_TRACE. 
 | 
| 
 | 
| 
 | 
| 
 Definition at line 1252 of file Message_Block.cpp. References ACE_TRACE. 
 01253 {
01254   ACE_TRACE ("ACE_Message_Block::operator=");
01255   return *this;
01256 }
 | 
| 
 | 
| Set link to prev message. 
 Definition at line 455 of file Message_Block.inl. References ACE_TRACE. 
 | 
| 
 | 
| 
 | 
| Set the read pointer ahead n bytes. 
 Definition at line 355 of file Message_Block.inl. References ACE_TRACE, and rd_ptr_. 
 | 
| 
 | 
| Set the read pointer to ptr. 
 Definition at line 348 of file Message_Block.inl. References ACE_TRACE, base(), and rd_ptr_. 
 | 
| 
 | 
| 
 | 
| Get the current reference count. 
 Definition at line 46 of file Message_Block.inl. References data_block(), and ACE_Data_Block::reference_count(). 
 00047 {
00048   return data_block () ? data_block ()->reference_count () : 0;
00049 }
 | 
| 
 | 
| This behaves like the non-static method , except that it checks if mb is 0. This is similar to <CORBA::release>, which is useful if you want to eliminate lots of checks for NULL pointers before calling on them. Returns mb. Definition at line 962 of file Message_Block.cpp. References ACE_TRACE, and release(). 
 | 
| 
 | 
| Decrease the shared ACE_Data_Block's reference count by 1. If the ACE_Data_Block's reference count goes to 0, it is deleted. In all cases, this ACE_Message_Block is deleted - it must have come from the heap, or there will be trouble. release() is designed to release the continuation chain; the destructor is not. If we make the destructor release the continuation chain by calling release() or delete on the message blocks in the continuation chain, the following code will not work since the message block in the continuation chain is not off the heap: ACE_Message_Block mb1 (1024); ACE_Message_Block mb2 (1024); mb1.cont (&mb2); And hence, call release() on a dynamically allocated message block. This will release all the message blocks in the continuation chain. If you call delete or let the message block fall off the stack, cleanup of the message blocks in the continuation chain becomes the responsibility of the user. 
 
 Definition at line 855 of file Message_Block.cpp. References ACE_DES_FREE, ACE_GUARD_RETURN, ACE_TRACE, data_block(), ACE_Data_Block::data_block_allocator(), ACE_Allocator::free(), ACE_Data_Block::locking_strategy(), and release_i(). Referenced by ACE_Stream_Tail<>::canonical_flush(), ACE_Stream_Head<>::canonical_flush(), clone(), ACE_OutputCDR::consolidate(), ACE_Stream<>::control(), ACE_Activation_Queue::dequeue(), ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_USE >::dequeue_deadline(), ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_USE >::dequeue_head(), ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_USE >::dequeue_prio(), ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_USE >::dequeue_tail(), duplicate(), ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_USE >::enqueue_deadline(), ACE_Message_Queue_Ex_N< ACE_MESSAGE_TYPE, >::enqueue_head(), ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_USE >::enqueue_head(), ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_USE >::enqueue_prio(), ACE_Message_Queue_Ex_N< ACE_MESSAGE_TYPE, >::enqueue_tail(), ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_USE >::enqueue_tail(), ACE_Message_Queue< ACE_SYNCH_USE >::flush_i(), ACE_Future_Set< T >::next_readable(), ACE_Stream_Tail<>::put(), ACE_UPIPE_Stream::recv(), release(), ACE_OutputCDR::reset(), ACE_Message_Queue_Ex_N< ACE_MESSAGE_TYPE, >::wrap_with_mbs_i(), ACE_OutputCDR::write_octet_array_mb(), ACE_OutputCDR::~ACE_OutputCDR(), and ACE_UPIPE_Stream::~ACE_UPIPE_Stream(). 
 00856 {
00857   ACE_TRACE ("ACE_Message_Block::release");
00858 
00859   // We want to hold the data block in a temporary variable because we
00860   // invoked "delete this;" at some point, so using this->data_block_
00861   // could be a bad idea.
00862   ACE_Data_Block *tmp = this->data_block ();
00863 
00864   // This flag is set to 1 when we have to destroy the data_block
00865   int destroy_dblock = 0;
00866 
00867   ACE_Lock *lock = 0;
00868 
00869   // Do we have a valid data block
00870   if (this->data_block ())
00871     {
00872       // Grab the lock that belongs to my data block
00873       lock = this->data_block ()->locking_strategy ();
00874 
00875       // if we have a lock
00876       if (lock != 0)
00877         {
00878           // One guard for all
00879           ACE_GUARD_RETURN (ACE_Lock, ace_mon, *lock, 0);
00880 
00881           // Call non-guarded release with <lock>
00882           destroy_dblock = this->release_i (lock);
00883         }
00884       // This is the case when we have a valid data block but no lock
00885       else
00886         // Call non-guarded release with no lock
00887         destroy_dblock = this->release_i (0);
00888     }
00889   else
00890     // This is the case when we don't even have a valid data block
00891     destroy_dblock = this->release_i (0);
00892 
00893   if (destroy_dblock != 0)
00894     {
00895       ACE_Allocator *allocator = tmp->data_block_allocator ();
00896       ACE_DES_FREE (tmp,
00897                     allocator->free,
00898                     ACE_Data_Block);
00899     }
00900 
00901   return 0;
00902 }
 | 
| 
 | 
| Internal release implementation Returns 1 if the data block has to be destroyed. Definition at line 905 of file Message_Block.cpp. References ACE_BIT_DISABLED, ACE_DES_FREE, ACE_TRACE, cont_, data_block(), data_block_, ACE_Data_Block::data_block_allocator(), DONT_DELETE, ACE_Allocator::free(), message_block_allocator_, and ACE_Data_Block::release_no_delete(). Referenced by release(). 
 00906 {
00907   ACE_TRACE ("ACE_Message_Block::release_i");
00908 
00909   // Free up all the continuation messages.
00910   if (this->cont_)
00911     {
00912       ACE_Message_Block *mb = this->cont_;
00913       ACE_Message_Block *tmp = 0;
00914 
00915       do
00916         {
00917           tmp = mb;
00918           mb = mb->cont_;
00919           tmp->cont_ = 0;
00920 
00921           ACE_Data_Block *db = tmp->data_block ();
00922           if (tmp->release_i (lock) != 0)
00923             {
00924               ACE_Allocator *allocator = db->data_block_allocator ();
00925               ACE_DES_FREE (db,
00926                             allocator->free,
00927                             ACE_Data_Block);
00928             }
00929         }
00930       while (mb);
00931 
00932       this->cont_ = 0;
00933     }
00934 
00935   int result = 0;
00936 
00937   if (ACE_BIT_DISABLED (this->flags_,
00938                         ACE_Message_Block::DONT_DELETE) &&
00939       this->data_block ())
00940     {
00941       if (this->data_block ()->release_no_delete (lock) == 0)
00942         result = 1;
00943       this->data_block_ = 0;
00944     }
00945 
00946   // We will now commit suicide: this object *must* have come from the
00947   // allocator given.
00948   if (this->message_block_allocator_ == 0)
00949     delete this;
00950   else
00951     {
00952       ACE_Allocator *allocator = this->message_block_allocator_;
00953       ACE_DES_FREE (this,
00954                     allocator->free,
00955                     ACE_Message_Block);
00956     }
00957 
00958   return result;
00959 }
 | 
| 
 | 
| Set a new data block pointer. A pointer to the original ACE_Data_Block is returned, and not released (as it is with ). Definition at line 391 of file Message_Block.inl. References ACE_TRACE, data_block_, rd_ptr(), and wr_ptr(). Referenced by ACE_InputCDR::ACE_InputCDR(), ACE_InputCDR::clone_from(), and ACE_InputCDR::exchange_data_blocks(). 
 00392 {
00393   ACE_TRACE ("ACE_Message_Block::replace_data_block");
00394   ACE_Data_Block *old = this->data_block_;
00395   this->data_block_ = db;
00396 
00397   if (db != 0)
00398     {
00399       // Set the read and write pointers in the <Message_Block> to point
00400       // to the buffer in the <ACE_Data_Block>.
00401       this->rd_ptr (this->data_block ()->base ());
00402       this->wr_ptr (this->data_block ()->base ());
00403     }
00404 
00405   return old;
00406 }
 | 
| 
 | 
| Resets the Message Block data to contain nothing, i.e., sets the read and write pointers to align with the base. Definition at line 376 of file Message_Block.inl. References ACE_TRACE, rd_ptr_, and wr_ptr_. Referenced by ACE_InputCDR::clone_from(), and ACE_InputCDR::exchange_data_blocks(). 
 | 
| 
 | ||||||||||||||||
| This method resets the allocators in all the message blocks in the chain. Definition at line 423 of file Message_Block.inl. References ACE_Data_Block::allocator_strategy_, cont(), data_block_, ACE_Data_Block::data_block_allocator_, and message_block_allocator_. 
 00426 {
00427   this->data_block_->allocator_strategy_ =
00428     allocator_strategy;
00429   this->data_block_->data_block_allocator_ =
00430     data_block_allocator;
00431   this->message_block_allocator_ =
00432     message_block_allocator;
00433 
00434   if (this->cont () != 0)
00435     this->cont ()->reset_allocators (allocator_strategy,
00436                                      data_block_allocator,
00437                                      message_block_allocator);
00438 }
 | 
| 
 | 
| Get the current message flags. 
 Definition at line 33 of file Message_Block.inl. References ACE_TRACE. Referenced by ACE_InputCDR::exchange_data_blocks(). 
 | 
| 
 | 
| Bitwise-or the more_flags into the existing message flags and return the new value. Definition at line 105 of file Message_Block.inl. References ACE_TRACE, data_block(), Message_Flags, and ACE_Data_Block::set_flags(). 
 00106 {
00107   ACE_TRACE ("ACE_Message_Block::set_flags");
00108   return this->data_block ()->set_flags (more_flags);
00109 }
 | 
| 
 | 
| Bitwise-or the into the existing message flags and return the new value. Definition at line 15 of file Message_Block.inl. References ACE_SET_BITS, ACE_TRACE, and Message_Flags. Referenced by ACE_InputCDR::exchange_data_blocks(). 
 00016 {
00017   ACE_TRACE ("ACE_Message_Block::set_self_flags");
00018   // Later we might mask more_glags so that user can't change internal
00019   // ones: more_flags &= ~(USER_FLAGS -1).
00020   return ACE_SET_BITS (this->flags_, more_flags);
00021 }
 | 
| 
 | 
| Set the number of bytes in the top-level , reallocating space if necessary. However, the and remain at the original offsets into the buffer, even if it is reallocated. Returns 0 if successful, else -1. Definition at line 246 of file Message_Block.cpp. References ACE_TRACE, data_block(), and ACE_Data_Block::size(). 
 00247 {
00248   ACE_TRACE ("ACE_Message_Block::size");
00249 
00250   // Resize the underlying <ACE_Data_Block>.
00251   if (this->data_block ()->size (length) == -1)
00252     return -1;
00253 
00254   return 0;
00255 }
 | 
| 
 | 
| Get the number of bytes in the top-level (i.e., does not consider the bytes in chained s). Definition at line 147 of file Message_Block.inl. References ACE_TRACE, data_block(), and ACE_Data_Block::size(). Referenced by ACE_InputCDR::clone_from(), ACE_OutputCDR::consolidate(), ACE_CDR::consolidate(), ACE_InputCDR::exchange_data_blocks(), ACE_CDR::grow(), ACE_OutputCDR::grow_and_adjust(), total_size(), and total_size_and_length(). 
 00148 {
00149   ACE_TRACE ("ACE_Message_Block::size");
00150   return this->data_block ()->size ();
00151 }
 | 
| 
 | 
| Get the number of bytes available after the in the top-level . Definition at line 384 of file Message_Block.inl. References ACE_TRACE, mark(), and wr_ptr(). Referenced by ACE_InputCDR::ACE_InputCDR(), and copy(). 
 | 
| 
 | 
| Get the number of allocated bytes in all , including chained s. Definition at line 301 of file Message_Block.cpp. References ACE_TRACE, capacity(), and cont(). 
 00302 {
00303   ACE_TRACE ("ACE_Message_Block::total_capacity");
00304 
00305   size_t size = 0;
00306 
00307   for (const ACE_Message_Block *i = this;
00308        i != 0;
00309        i = i->cont ())
00310     size += i->capacity ();
00311 
00312   return size;
00313 }
 | 
| 
 | 
| Get the length of the s, including chained s. Definition at line 287 of file Message_Block.cpp. References ACE_TRACE, cont(), and length(). 
 00288 {
00289   ACE_TRACE ("ACE_Message_Block::total_length");
00290 
00291   size_t length = 0;
00292   for (const ACE_Message_Block *i = this;
00293        i != 0;
00294        i = i->cont ())
00295     length += i->length ();
00296 
00297   return length;
00298 }
 | 
| 
 | 
| Get the total number of bytes in all s, including chained s. Definition at line 273 of file Message_Block.cpp. References ACE_TRACE, cont(), and size(). Referenced by ACE_Buffered_Svc_Handler<, >::put(). 
 00274 {
00275   ACE_TRACE ("ACE_Message_Block::total_size");
00276 
00277   size_t size = 0;
00278   for (const ACE_Message_Block *i = this;
00279        i != 0;
00280        i = i->cont ())
00281     size += i->size ();
00282 
00283   return size;
00284 }
 | 
| 
 | ||||||||||||
| 
 | 
| Set the write pointer ahead n bytes. This is used to compute the of a message. Definition at line 369 of file Message_Block.inl. References ACE_TRACE, and wr_ptr_. 
 | 
| 
 | 
| Set the write pointer to ptr. 
 Definition at line 310 of file Message_Block.inl. References ACE_TRACE, base(), and wr_ptr_. 
 | 
| 
 | 
| Get the write pointer. 
 Definition at line 362 of file Message_Block.inl. References ACE_TRACE, base(), and wr_ptr_. Referenced by ACE_InputCDR::ACE_InputCDR(), ACE_Message_Block(), ACE_OutputCDR::adjust(), clone(), ACE_InputCDR::clone_from(), ACE_CDR::consolidate(), copy(), crunch(), data_block(), duplicate(), ACE_InputCDR::exchange_data_blocks(), ACE_OutputCDR::find(), ACE_InputCDR::grow(), ACE_CDR::grow(), ACE_OutputCDR::grow_and_adjust(), ACE_CDR::mb_align(), ACE_InputCDR::operator=(), replace_data_block(), space(), ACE_InputCDR::steal_from(), ACE_InputCDR::wr_ptr(), and ACE_OutputCDR::write_octet_array_mb(). 
 | 
| 
 | 
| 
 Definition at line 62 of file Message_Block.h. Referenced by init_i(). | 
| 
 | 
| Declare the dynamic allocation hooks. 
 Definition at line 583 of file Message_Block.h. | 
| 
 | 
| Pointer to next message block in the chain. 
 Definition at line 640 of file Message_Block.h. Referenced by clone(), cont(), duplicate(), init_i(), and release_i(). | 
| 
 | 
| Pointer to the reference counted data structure that contains the actual memory buffer. Definition at line 653 of file Message_Block.h. Referenced by access_allocators(), data_block(), init_i(), release_i(), replace_data_block(), and reset_allocators(). | 
| 
 | 
| Misc flags (e.g., DONT_DELETE and USER_FLAGS). 
 Definition at line 649 of file Message_Block.h. Referenced by ACE_Message_Block(). | 
| 
 | 
| The allocator used to destroy ourselves when release is called and create new message blocks on duplicate. Definition at line 657 of file Message_Block.h. Referenced by access_allocators(), ACE_Message_Block(), clone(), duplicate(), init_i(), release_i(), and reset_allocators(). | 
| 
 | 
| Pointer to next message in the list. 
 Definition at line 643 of file Message_Block.h. | 
| 
 | 
| Pointer to previous message in the list. 
 Definition at line 646 of file Message_Block.h. | 
| 
 | 
| Priority of message. 
 Definition at line 628 of file Message_Block.h. | 
| 
 | 
| Pointer to beginning of next read. 
 Definition at line 622 of file Message_Block.h. Referenced by base(), crunch(), init_i(), length(), rd_ptr(), and reset(). | 
| 
 | 
| Pointer to beginning of next write. 
 Definition at line 625 of file Message_Block.h. Referenced by ACE_Message_Block(), base(), crunch(), init_i(), length(), reset(), and wr_ptr(). | 
 1.3.6
 
1.3.6