Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# ACE_Message_Block Class Reference

Stores messages for use throughout ACE (particularly ). More...

`#include <Message_Block.h>`

Collaboration diagram for ACE_Message_Block:

[legend]
List of all members.

## Public Types
typedef int | ACE_Message_Type
typedef u_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 Methods
| 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, u_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, u_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, u_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
| Find out what class of message this is (there are two classes, <normal> messages and <high-priority> messages).
Message_Flags | set_flags (Message_Flags more_flags)
| Bitwise-or the <more_flags> into the existing message flags and return the new value.
Message_Flags | clr_flags (Message_Flags less_flags)
| Clear the message flag bits specified in <less_flags> and return the new value.
Message_Flags | flags (void) const
| Get the current message flags.
Message_Flags | set_self_flags (ACE_Message_Block::Message_Flags more_flags)
| Bitwise-or the <more_flags> into the existing message flags and return the new value.
Message_Flags | clr_self_flags (ACE_Message_Block::Message_Flags less_flags)
| Clear the message flag bits specified in <less_flags> and return the new value.
Message_Flags | self_flags (void) const
| Get the current message flags.
u_long | msg_priority (void) const
| Get priority of the message.
void | msg_priority (u_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
| Return an exact "deep copy" of the message, i.e., create fresh new copies of all the Data_Blocks and continuations.
ACE_Message_Block* | duplicate (void) const
| Return a "shallow" copy that increments our reference count by 1.
ACE_Message_Block* | release (void)
int | copy (const char *buf, size_t n)
int | copy (const char *buf)
void | crunch (void)
| Normalizes data in the top-level <Message_Block> to align with the base, i.e., it "shifts" the data pointed to by <rd_ptr> down to the <base> and then readjusts <rt_ptr> to point to <base> and <wr_ptr> to point to <base> + the length of the moved data.
void | reset (void)
| Resets the Message Block data to contain nothing, i.e., sets the read and write pointers to align with the base.
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
void | rd_ptr (char *ptr)
void | rd_ptr (size_t n)
char* | wr_ptr (void) const
void | wr_ptr (char *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*)
| Set a new data block pointer. A pointer to the original is returned, and not released (as it is with <data_block>).
ACE_Message_Block* | cont (void) const
| Get the continuation field. Set the continuation field.
void | cont (ACE_Message_Block *)
ACE_Message_Block* | next (void) const
| Get link to next message. Set link to next message.
void | next (ACE_Message_Block *)
ACE_Message_Block* | prev (void) const
| Get link to prev message. Set link to prev message.
void | prev (ACE_Message_Block *)
ACE_Lock* | locking_strategy (void)
| Get the locking strategy. Set a new locking strategy and return the hold one.
ACE_Lock* | locking_strategy (ACE_Lock *)
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
| Get the length of the <Message_Block>s, including chained <Message_Block>s.
size_t | total_size (void) const
| Get the total number of bytes in all <Message_Block>s, including chained <Message_Block>s.
size_t | size (void) const
| Get the number of bytes in the top-level <Message_Block> (i.e., does not consider the bytes in chained <Message_Block>s).
int | size (size_t length)
size_t | total_capacity (void) const
| Get the number of allocated bytes in all <Message_Block>, including chained <Message_Block>s.
size_t | capacity (void) const
| Get the number of allocated bytes in the top-level <Message_Block>.
size_t | space (void) const
| Get the number of bytes available after the <wr_ptr_> in the top-level <Message_Block>.
## Public Attributes
| ACE_ALLOC_HOOK_DECLARE
| Declare the dynamic allocation hooks.
## Static Public Methods
ACE_Message_Block* | duplicate (const ACE_Message_Block *mb)
ACE_Message_Block* | release (ACE_Message_Block *mb)
## Protected Methods
| 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, u_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)
| Internal release implementation Returns 1 if the data block has to be destroyed.
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, u_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.
u_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_
| Pointer to the reference counted data structure that contains the actual memory buffer.
ACE_Allocator* | message_block_allocator_
| The allocator used to destroy ourselves when release is called and create new message blocks on duplicate.
## Private Methods
ACE_Message_Block& | operator= (const ACE_Message_Block &)
| ACE_Message_Block (const ACE_Message_Block &)
## Friends
class | ACE_Data_Block

## Detailed Description

Stores messages for use throughout ACE (particularly ).

An 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 : 1. Contains a pointer to a reference-counted , which in turn points to the actual data buffer. This allows very flexible and efficient sharing of data by multiple s. 2. One or more can be linked to form a ``fragment chain.'' 3. can be linked together by <prev_> and <next_> pointers to form a queue of messages (e.g., this is how works).

## Member Typedef Documentation

typedef int ACE_Message_Block::ACE_Message_Type

typedef u_long ACE_Message_Block::Message_Flags

## Member Enumeration Documentation

anonymous enum

  | Enumeration values:
  MB_DATA | regular datacol messages (regular and priority).
  MB_PROTO | protocol control.
  MB_BREAK | line breakes (regular and priority).
  MB_PASSFP | pass file pointer.
  MB_EVENT | post an event to an event queue.
  MB_SIG | generate process signal.
  MB_IOCTL | ioctl; set/get params.
  MB_SETOPTS | set various stream head options.
  MB_IOCACK | acknowledge ioctles (high priority; go to head of queue).
  MB_IOCNAK | negative ioctl acknowledge.
  MB_PCPROTO | priority proto message.
  MB_PCSIG | generate process signal.
  MB_READ | generate read notification.
  MB_FLUSH | flush your queues.
  MB_STOP | stop transmission immediately.
  MB_START | restart transmission after stop.
  MB_HANGUP | line disconnect.
  MB_ERROR | fatal error used to set u.u_error.
  MB_PCEVENT | post an event to an event queue.
  MB_NORMAL | Normal priority messagessks.
  MB_PRIORITY | High priority control messages.
  MB_USER | User-defined control messages.

anonymous enum

  | Enumeration values:
  DONT_DELETE | Don't delete the data on exit since we don't own it.
  USER_FLAGS | user defined flags start here.

## Constructor & Destructor Documentation

ACE_Message_Block::ACE_Message_Block ( | ACE_Allocator * message_block_allocator = 0 )

| Create an empty message.

ACE_Message_Block::ACE_Message_Block ( | ACE_Data_Block * data_block,
| ACE_Message_Block::Message_Flags flags = 0,
| ACE_Allocator * message_block_allocator = 0 )

| Create an that owns the without copying it. If the <flags> is set to DONT_DELETE we don't delete the ACE_Data_Block. It is left to the client's responsibility to take care of the memory allocated for the data_block

ACE_Message_Block::ACE_Message_Block ( | const char * data,
| size_t size = 0,
| u_long priority = ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY )

| Create a Message Block that assumes ownership of <data> without copying it (i.e., we don't delete it since we don't malloc it!). Note that the <size> of the <Message_Block> will be <size>, but the <length> will be 0 until <wr_ptr> is set.

ACE_Message_Block::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,
| u_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 )

| Create an initialized message of type <type> containing <size> bytes. The <cont> argument initializes the continuation field in the <Message_Block>. If <data> == 0 then we create and own the <data>, using to get the data if it's non-0. If <data> != 0 we assume that we have ownership of the <data> till this object seizes 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 <Message_Block> will be <size>, but the <length> will be 0 until <wr_ptr> is set. The <data_block_allocator> is use to allocate the data blocks while the is used to allocate the buffers contained by those. The <message_block_allocator> is used to allocate new <Message_Block> objects when a duplicate method is called. If a <message_block_allocator> is given, this <Message_Block> and future <Message_Block> objects created by duplicate will be free'ed into this allocator when they are released. Note: if you use this allocator, the <Message_Block> you created should have been created using this allocator because it will be released to the same allocator.

ACE_Message_Block::ACE_Message_Block ( | const ACE_Message_Block & mb,
| size_t align )

| 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>.

ACE_Message_Block::~ACE_Message_Block ( | void )`[virtual]`

| 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.

ACE_Message_Block::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,
| u_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 )`[protected]`

| Perform the actual initialization.

ACE_Message_Block::ACE_Message_Block ( | const ACE_Message_Block & )`[private]`

## Member Function Documentation

ACE_INLINE void ACE_Message_Block::base ( | char * msg_data,
| size_t msg_length,
| Message_Flags msg_flags = DONT_DELETE )

| Set message data (doesn't reallocate).

ACE_INLINE char * ACE_Message_Block::base ( | void ) const

| Get message data.

ACE_INLINE size_t ACE_Message_Block::capacity ( | void ) const

| Get the number of allocated bytes in the top-level <Message_Block>.

ACE_Message_Block * ACE_Message_Block::clone ( | Message_Flags mask = 0 ) const`[virtual]`

| Return an exact "deep copy" of the message, i.e., create fresh new copies of all the Data_Blocks and continuations.

ACE_INLINE ACE_Message_Block::Message_Flags ACE_Message_Block::clr_flags ( | ACE_Message_Block::Message_Flags less_flags )

| Clear the message flag bits specified in <less_flags> and return the new value.

ACE_INLINE ACE_Message_Block::Message_Flags ACE_Message_Block::clr_self_flags ( | ACE_Message_Block::Message_Flags less_flags )

| Clear the message flag bits specified in <less_flags> and return the new value.

ACE_INLINE void ACE_Message_Block::cont ( | ACE_Message_Block * cont_msg )

ACE_INLINE ACE_Message_Block * ACE_Message_Block::cont ( | void ) const

| Get the continuation field. Set the continuation field.

int ACE_Message_Block::copy ( | const char * buf )

| Copies <buf> into the Message_Block starting at the <wr_ptr> offset. This call assumes that <buf> is NUL-terminated. Return 0 and increment <wr_ptr> by if the method succeeds. Returns -1 if the size of the message is too small, i.e., for this to work correct, <end> must be >= <wr_ptr>.

int ACE_Message_Block::copy ( | const char * buf,
| size_t n )

| Copies <n> bytes from <buf> into the Message_Block starting at the <wr_ptr> offset. Return 0 and increment <wr_ptr> by <n> if the method succeeds. Returns -1 if the size of the message is too small, i.e., for this to work correct, <end> must be >= <wr_ptr>.

void ACE_Message_Block::crunch ( | void )

| Normalizes data in the top-level <Message_Block> to align with the base, i.e., it "shifts" the data pointed to by <rd_ptr> down to the <base> and then readjusts <rt_ptr> to point to <base> and <wr_ptr> to point to <base> + the length of the moved data.

void ACE_Message_Block::data_block ( | ACE_Data_Block * )

| Set a new data block pointer. The original is released as a result of this call. If you need to keep the original block, call <replace_data_block> instead. Upon return, this holds a pointer to the new , taking over the reference you held on it prior to the call.

ACE_INLINE ACE_Data_Block * ACE_Message_Block::data_block ( | void ) const

| Get a pointer to the data block. Note that the still references the block; this call does not change the reference count.

void ACE_Message_Block::dump ( | void ) const

| Dump the state of an object.

ACE_Message_Block * ACE_Message_Block::duplicate ( | const ACE_Message_Block * mb )`[static]`

| Return a "shallow" copy that increments our reference count by 1. This is similar to CORBA's <_duplicate> method, which is useful if you want to eliminate lots of checks for NULL <mb> pointers before calling <_duplicate> on them.

ACE_Message_Block * ACE_Message_Block::duplicate ( | void ) const

| Return a "shallow" copy that increments our reference count by 1.

ACE_INLINE char * ACE_Message_Block::end ( | void ) const

| Return a pointer to 1 past the end of the allocated data in a message.

ACE_INLINE ACE_Message_Block::Message_Flags ACE_Message_Block::flags ( | void ) const

| Get the current message flags.

int ACE_Message_Block::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,
| u_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 )

| Create an initialized message of type <type> containing <size> bytes. The <cont> argument initializes the continuation field in the <Message_Block>. If <data> == 0 then we create and own the <data>, using to get the data if it's non-0. If <data> != 0 we assume that we have ownership of the <data> till this object seizes 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 <Message_Block> will be <size>, but the <length> will be 0 until <wr_ptr> is set. The <data_block_allocator> is use to allocate the data blocks while the is used to allocate the buffers contained by those.

int ACE_Message_Block::init ( | const char * data,
| size_t size = 0 )

| 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 <size> of the <Message_Block> will be <size>, but the <length> will be 0 until <wr_ptr> is set.

int ACE_Message_Block::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,
| u_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 )`[protected]`

| Perform the actual initialization.

ACE_INLINE int ACE_Message_Block::is_data_msg ( | void ) const

| Find out what type of message this is.

ACE_INLINE void ACE_Message_Block::length ( | size_t len )

| Set the length of the message.

ACE_INLINE size_t ACE_Message_Block::length ( | void ) const

| Get the length of the message.

ACE_INLINE ACE_Lock * ACE_Message_Block::locking_strategy ( | ACE_Lock * nls )

ACE_INLINE ACE_Lock * ACE_Message_Block::locking_strategy ( | void )

| Get the locking strategy. Set a new locking strategy and return the hold one.

ACE_INLINE char * ACE_Message_Block::mark ( | void ) const

| 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().

ACE_INLINE ACE_Message_Block::ACE_Message_Type ACE_Message_Block::msg_class ( | void ) const

| Find out what class of message this is (there are two classes, <normal> messages and <high-priority> messages).

ACE_INLINE void ACE_Message_Block::msg_deadline_time ( | const ACE_Time_Value & dt )

| Set absolute time of deadline associated with the message.

ACE_INLINE const ACE_Time_Value & ACE_Message_Block::msg_deadline_time ( | void ) const

| Get absolute time of deadline associated with the message.

ACE_INLINE void ACE_Message_Block::msg_execution_time ( | const ACE_Time_Value & et )

| Set execution time associated with the message.

ACE_INLINE const ACE_Time_Value & ACE_Message_Block::msg_execution_time ( | void ) const

| Get execution time associated with the message.

ACE_INLINE void ACE_Message_Block::msg_priority ( | u_long pri )

| Set priority of the message.

ACE_INLINE u_long ACE_Message_Block::msg_priority ( | void ) const

| Get priority of the message.

ACE_INLINE void ACE_Message_Block::msg_type ( | ACE_Message_Block::ACE_Message_Type t )

| Set type of the message.

ACE_INLINE ACE_Message_Block::ACE_Message_Type ACE_Message_Block::msg_type ( | void ) const

| Get type of the message.

ACE_INLINE void ACE_Message_Block::next ( | ACE_Message_Block * next_msg )

ACE_INLINE ACE_Message_Block * ACE_Message_Block::next ( | void ) const

| Get link to next message. Set link to next message.

ACE_Message_Block & ACE_Message_Block::operator= ( | const ACE_Message_Block & )`[private]`

ACE_INLINE void ACE_Message_Block::prev ( | ACE_Message_Block * next_msg )

ACE_INLINE ACE_Message_Block * ACE_Message_Block::prev ( | void ) const

| Get link to prev message. Set link to prev message.

ACE_INLINE void ACE_Message_Block::rd_ptr ( | size_t n )

ACE_INLINE void ACE_Message_Block::rd_ptr ( | char * new_ptr )

ACE_INLINE char * ACE_Message_Block::rd_ptr ( | void ) const

| Get the read pointer. Set the read pointer to <ptr>. Set the read pointer ahead <n> bytes.

ACE_INLINE int ACE_Message_Block::reference_count ( | void ) const

| Get the current reference count.

ACE_Message_Block * ACE_Message_Block::release ( | ACE_Message_Block * mb )`[static]`

| This behaves like the non-static method <release>, 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 <release> on them. Returns <mb>.

ACE_Message_Block * ACE_Message_Block::release ( | void )

| 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.

int ACE_Message_Block::release_i ( | ACE_Lock * lock )`[protected]`

| Internal release implementation Returns 1 if the data block has to be destroyed.

ACE_INLINE ACE_Data_Block * ACE_Message_Block::replace_data_block ( | ACE_Data_Block * db )

| Set a new data block pointer. A pointer to the original is returned, and not released (as it is with <data_block>).

ACE_INLINE void ACE_Message_Block::reset ( | void )

| Resets the Message Block data to contain nothing, i.e., sets the read and write pointers to align with the base.

ACE_INLINE ACE_Message_Block::Message_Flags ACE_Message_Block::self_flags ( | void ) const

| Get the current message flags.

ACE_INLINE ACE_Message_Block::Message_Flags ACE_Message_Block::set_flags ( | ACE_Message_Block::Message_Flags more_flags )

| Bitwise-or the <more_flags> into the existing message flags and return the new value.

ACE_INLINE ACE_Message_Block::Message_Flags ACE_Message_Block::set_self_flags ( | ACE_Message_Block::Message_Flags more_flags )

| Bitwise-or the <more_flags> into the existing message flags and return the new value.

int ACE_Message_Block::size ( | size_t length )

| Set the number of bytes in the top-level <Message_Block>, reallocating space if necessary. However, the <rd_ptr_> and <wr_ptr_> remain at the original offsets into the buffer, even if it is reallocated. Returns 0 if successful, else -1.

ACE_INLINE size_t ACE_Message_Block::size ( | void ) const

| Get the number of bytes in the top-level <Message_Block> (i.e., does not consider the bytes in chained <Message_Block>s).

ACE_INLINE size_t ACE_Message_Block::space ( | void ) const

| Get the number of bytes available after the <wr_ptr_> in the top-level <Message_Block>.

size_t ACE_Message_Block::total_capacity ( | void ) const

| Get the number of allocated bytes in all <Message_Block>, including chained <Message_Block>s.

size_t ACE_Message_Block::total_length ( | void ) const

| Get the length of the <Message_Block>s, including chained <Message_Block>s.

size_t ACE_Message_Block::total_size ( | void ) const

| Get the total number of bytes in all <Message_Block>s, including chained <Message_Block>s.

ACE_INLINE void ACE_Message_Block::wr_ptr ( | size_t n )

ACE_INLINE void ACE_Message_Block::wr_ptr ( | char * new_ptr )

ACE_INLINE char * ACE_Message_Block::wr_ptr ( | void ) const

| Get the write pointer. Set the write pointer to <ptr>. Set the write pointer ahead <n> bytes. This is used to compute the <length> of a message.

## Friends And Related Function Documentation

class ACE_Data_Block`[friend]`

## Member Data Documentation

ACE_Message_Block::ACE_ALLOC_HOOK_DECLARE

| Declare the dynamic allocation hooks.

ACE_Message_Block * ACE_Message_Block::cont_`[protected]`

| Pointer to next message block in the chain.

ACE_Data_Block * ACE_Message_Block::data_block_`[protected]`

| Pointer to the reference counted data structure that contains the actual memory buffer.

ACE_Message_Block::Message_Flags ACE_Message_Block::flags_`[protected]`

| Misc flags (e.g., DONT_DELETE and USER_FLAGS).

ACE_Allocator * ACE_Message_Block::message_block_allocator_`[protected]`

| The allocator used to destroy ourselves when release is called and create new message blocks on duplicate.

ACE_Message_Block * ACE_Message_Block::next_`[protected]`

| Pointer to next message in the list.

ACE_Message_Block * ACE_Message_Block::prev_`[protected]`

| Pointer to previous message in the list.

u_long ACE_Message_Block::priority_`[protected]`

| Priority of message.

size_t ACE_Message_Block::rd_ptr_`[protected]`

| Pointer to beginning of next read.

size_t ACE_Message_Block::wr_ptr_`[protected]`

| Pointer to beginning of next write.

The documentation for this class was generated from the following files:

- Message_Block.h
- Message_Block.cpp
- Message_Block.i