ACE 7.1.4
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
ACE_Data_Block Class Reference

Stores the data payload that is accessed via one or more ACE_Message_Block's. More...

#include <Message_Block.h>

Inheritance diagram for ACE_Data_Block:
Inheritance graph
[legend]
Collaboration diagram for ACE_Data_Block:
Collaboration graph
[legend]

Public Member Functions

 ACE_Data_Block ()
 Default "do-nothing" constructor.
 
 ACE_Data_Block (size_t size, ACE_Message_Block::ACE_Message_Type msg_type, const char *msg_data, ACE_Allocator *allocator_strategy, ACE_Lock *locking_strategy, ACE_Message_Block::Message_Flags flags, ACE_Allocator *data_block_allocator)
 Initialize.
 
virtual ~ACE_Data_Block ()
 Delete all the resources held in the message.
 
ACE_Message_Block::ACE_Message_Type msg_type () const
 Get type of the message.
 
void msg_type (ACE_Message_Block::ACE_Message_Type type)
 Set type of the message.
 
charbase () const
 Get message data pointer.
 
void base (char *data, size_t size, ACE_Message_Block::Message_Flags mflags=ACE_Message_Block::DONT_DELETE)
 Set message data pointer (doesn't reallocate).
 
charend () const
 Return a pointer to 1 past the end of the allocated data in a message.
 
charmark () const
 
size_t size () const
 
int size (size_t length)
 
size_t capacity () const
 Get the total amount of allocated space.
 
virtual ACE_Data_Blockclone (ACE_Message_Block::Message_Flags mask=0) const
 
virtual ACE_Data_Blockclone_nocopy (ACE_Message_Block::Message_Flags mask=0, size_t max_size=0) const
 
ACE_Data_Blockduplicate ()
 Return a "shallow" copy that increments our reference count by 1.
 
ACE_Data_Blockrelease (ACE_Lock *lock=0)
 
ACE_Message_Block::Message_Flags set_flags (ACE_Message_Block::Message_Flags more_flags)
 
ACE_Message_Block::Message_Flags clr_flags (ACE_Message_Block::Message_Flags less_flags)
 
ACE_Message_Block::Message_Flags flags () const
 Get the current message flags.
 
ACE_Allocatorallocator_strategy () const
 Obtain the allocator strategy.
 
ACE_Locklocking_strategy ()
 Get the locking strategy.
 
ACE_Locklocking_strategy (ACE_Lock *)
 Set a new locking strategy and return the hold one.
 
void dump () const
 Dump the state of an object.
 
int reference_count () const
 Get the current reference count.
 
ACE_Allocatordata_block_allocator () const
 Get the allocator used to create this object.
 

Protected Member Functions

virtual ACE_Data_Blockrelease_i ()
 Internal release implementation.
 
int reference_count_i () const
 Internal get the current reference count.
 
ACE_Data_Blockrelease_no_delete (ACE_Lock *lock)
 

Protected Attributes

ACE_Message_Block::ACE_Message_Type type_
 Type of message.
 
size_t cur_size_
 Current size of message block.
 
size_t max_size_
 Total size of buffer.
 
ACE_Message_Block::Message_Flags flags_
 Misc flags (e.g., DONT_DELETE and USER_FLAGS).
 
charbase_
 Pointer To beginning of message payload.
 
ACE_Allocatorallocator_strategy_
 
ACE_Locklocking_strategy_
 
int reference_count_
 
ACE_Allocatordata_block_allocator_
 The allocator use to destroy ourselves.
 

Private Member Functions

ACE_Data_Blockoperator= (const ACE_Data_Block &)
 
 ACE_Data_Block (const ACE_Data_Block &)
 

Friends

class ACE_Message_Block
 

Detailed Description

Stores the data payload that is accessed via one or more ACE_Message_Block's.

This data structure is reference counted to maximize sharing. It also contains the <locking_strategy_> (which protects the reference count from race conditions in concurrent programs) and the <allocation_strategy_> (which determines what memory pool is used to allocate the memory).

Constructor & Destructor Documentation

◆ ACE_Data_Block() [1/3]

ACE_Data_Block::ACE_Data_Block ( )

Default "do-nothing" constructor.

◆ ACE_Data_Block() [2/3]

ACE_Data_Block::ACE_Data_Block ( size_t size,
ACE_Message_Block::ACE_Message_Type msg_type,
const char * msg_data,
ACE_Allocator * allocator_strategy,
ACE_Lock * locking_strategy,
ACE_Message_Block::Message_Flags flags,
ACE_Allocator * data_block_allocator )

Initialize.

◆ ~ACE_Data_Block()

ACE_Data_Block::~ACE_Data_Block ( )
virtual

Delete all the resources held in the message.

◆ ACE_Data_Block() [3/3]

ACE_Data_Block::ACE_Data_Block ( const ACE_Data_Block & )
private

Member Function Documentation

◆ allocator_strategy()

ACE_Allocator * ACE_Data_Block::allocator_strategy ( ) const
inline

Obtain the allocator strategy.

◆ base() [1/2]

char * ACE_Data_Block::base ( ) const
inline

Get message data pointer.

◆ base() [2/2]

void ACE_Data_Block::base ( char * data,
size_t size,
ACE_Message_Block::Message_Flags mflags = ACE_Message_Block::DONT_DELETE )

Set message data pointer (doesn't reallocate).

◆ capacity()

size_t ACE_Data_Block::capacity ( ) const
inline

Get the total amount of allocated space.

◆ clone()

ACE_Data_Block * ACE_Data_Block::clone ( ACE_Message_Block::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. Notice that Data_Blocks can act as "Prototypes", i.e. derived classes can override this method and create instances of themselves.

◆ clone_nocopy()

ACE_Data_Block * ACE_Data_Block::clone_nocopy ( ACE_Message_Block::Message_Flags mask = 0,
size_t max_size = 0 ) const
virtual

As clone above, but it does not copy the contents of the buffer, i.e., create a new Data_Block of the same dynamic type, with the same allocator, locking_strategy, and with the same amount of storage available (if max_size is zero) but the buffer is unitialized. If max_size is specified other than zero, it will be used when creating the new data block.

Reimplemented in ACE_Locked_Data_Block< ACE_LOCK >.

◆ clr_flags()

ACE_Message_Block::Message_Flags ACE_Data_Block::clr_flags ( ACE_Message_Block::Message_Flags less_flags)
inline

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

◆ data_block_allocator()

ACE_Allocator * ACE_Data_Block::data_block_allocator ( ) const
inline

Get the allocator used to create this object.

◆ dump()

void ACE_Data_Block::dump ( ) const

Dump the state of an object.

◆ duplicate()

ACE_Data_Block * ACE_Data_Block::duplicate ( )

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

◆ end()

char * ACE_Data_Block::end ( ) const
inline

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

◆ flags()

ACE_Message_Block::Message_Flags ACE_Data_Block::flags ( ) const
inline

Get the current message flags.

◆ locking_strategy() [1/2]

ACE_Lock * ACE_Data_Block::locking_strategy ( )
inline

Get the locking strategy.

◆ locking_strategy() [2/2]

ACE_Lock * ACE_Data_Block::locking_strategy ( ACE_Lock * nls)
inline

Set a new locking strategy and return the hold one.

◆ mark()

char * ACE_Data_Block::mark ( ) const
inline

Return a pointer to 1 past the end of the allotted data in a message. The allotted data may be less than allocated data if <size()> is passed an argument less than <capacity()>.

◆ msg_type() [1/2]

ACE_Message_Block::ACE_Message_Type ACE_Data_Block::msg_type ( ) const
inline

Get type of the message.

◆ msg_type() [2/2]

void ACE_Data_Block::msg_type ( ACE_Message_Block::ACE_Message_Type type)
inline

Set type of the message.

◆ operator=()

ACE_Data_Block & ACE_Data_Block::operator= ( const ACE_Data_Block & )
private

◆ reference_count()

int ACE_Data_Block::reference_count ( ) const

Get the current reference count.

◆ reference_count_i()

int ACE_Data_Block::reference_count_i ( ) const
inlineprotected

Internal get the current reference count.

◆ release()

ACE_Data_Block * ACE_Data_Block::release ( ACE_Lock * lock = 0)

Decrease the shared reference count by 1. If the reference count is > 0 then return this; else if reference count == 0 then delete this and mb and return 0. Behavior is undefined if reference count < 0.

◆ release_i()

ACE_Data_Block * ACE_Data_Block::release_i ( )
protectedvirtual

Internal release implementation.

◆ release_no_delete()

ACE_Data_Block * ACE_Data_Block::release_no_delete ( ACE_Lock * lock)
protected

◆ set_flags()

ACE_Message_Block::Message_Flags ACE_Data_Block::set_flags ( ACE_Message_Block::Message_Flags more_flags)
inline

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

◆ size() [1/2]

size_t ACE_Data_Block::size ( ) const
inline

Get the total amount of allotted space in the message. The amount of allotted space may be less than allocated space.

◆ size() [2/2]

int ACE_Data_Block::size ( size_t length)

Set the total amount of space in the message. Returns 0 if successful, else -1.

Friends And Related Symbol Documentation

◆ ACE_Message_Block

Decrease the reference count, but don't delete the object. Returns 0 if the object should be removed. If lock is equal to the locking strategy then we assume that the lock is being held by the current thread; this is used to release all the data blocks in a chain while holding a single lock.

Member Data Documentation

◆ allocator_strategy_

ACE_Allocator* ACE_Data_Block::allocator_strategy_
protected

Pointer to the allocator defined for this ACE_Data_Block. Note that this pointer is shared by all owners of this ACE_Data_Block.

◆ base_

char* ACE_Data_Block::base_
protected

Pointer To beginning of message payload.

◆ cur_size_

size_t ACE_Data_Block::cur_size_
protected

Current size of message block.

◆ data_block_allocator_

ACE_Allocator* ACE_Data_Block::data_block_allocator_
protected

The allocator use to destroy ourselves.

◆ flags_

ACE_Message_Block::Message_Flags ACE_Data_Block::flags_
protected

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

◆ locking_strategy_

ACE_Lock* ACE_Data_Block::locking_strategy_
protected

Pointer to the locking strategy defined for this ACE_Data_Block. This is used to protect regions of code that access shared ACE_Data_Block state. Note that this lock is shared by all owners of the ACE_Data_Block's data.

◆ max_size_

size_t ACE_Data_Block::max_size_
protected

Total size of buffer.

◆ reference_count_

int ACE_Data_Block::reference_count_
protected

Reference count for this ACE_Data_Block, which is used to avoid deep copies (i.e., clone()). Note that this pointer value is shared by all owners of the <Data_Block>'s data, i.e., all the ACE_Message_Blocks.

◆ type_

ACE_Message_Block::ACE_Message_Type ACE_Data_Block::type_
protected

Type of message.


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