Public Member Functions | Private Member Functions | Private Attributes

ACE_Locked_Data_Block< ACE_LOCK > Class Template Reference

A Data_Block with a concrete locking strategy. More...

#include <Message_Block_T.h>

Inheritance diagram for ACE_Locked_Data_Block< ACE_LOCK >:
Inheritance graph
[legend]
Collaboration diagram for ACE_Locked_Data_Block< ACE_LOCK >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ACE_Locked_Data_Block (void)
 Default "do-nothing" constructor.
 ACE_Locked_Data_Block (size_t size, ACE_Message_Block::ACE_Message_Type msg_type, const char *msg_data, ACE_Allocator *allocator_strategy, ACE_Message_Block::Message_Flags flags, ACE_Allocator *data_block_allocator)
 Initialize.
virtual ~ACE_Locked_Data_Block (void)
 Delete all the resources held in the message.
virtual ACE_Data_Blockclone_nocopy (ACE_Message_Block::Message_Flags mask=0, size_t max_size=0) const

Private Member Functions

ACE_Locked_Data_Block< ACE_LOCK > & operator= (const ACE_Locked_Data_Block< ACE_LOCK > &)
 ACE_Locked_Data_Block (const ACE_Locked_Data_Block< ACE_LOCK > &)

Private Attributes

ACE_LOCK lock_
 The lock.

Detailed Description

template<class ACE_LOCK>
class ACE_Locked_Data_Block< ACE_LOCK >

A Data_Block with a concrete locking strategy.

Data_Blocks can be parametric on the kind of lock they use; in many cases the lifetime of the lock is tied to the lifetime of the Data_Block itself. But since Data_Blocks are reference counted it is hard for users to control the lock lifetime. This class is parametric over the kind of lock used.

Definition at line 38 of file Message_Block_T.h.


Constructor & Destructor Documentation

template<class ACE_LOCK >
ACE_Locked_Data_Block< ACE_LOCK >::ACE_Locked_Data_Block ( void   )  [inline]

Default "do-nothing" constructor.

Definition at line 8 of file Message_Block_T.inl.

{
  this->locking_strategy_ = &this->lock_;
}

template<class ACE_LOCK >
ACE_Locked_Data_Block< ACE_LOCK >::ACE_Locked_Data_Block ( size_t  size,
ACE_Message_Block::ACE_Message_Type  msg_type,
const char *  msg_data,
ACE_Allocator allocator_strategy,
ACE_Message_Block::Message_Flags  flags,
ACE_Allocator data_block_allocator 
) [inline]

Initialize.

Definition at line 15 of file Message_Block_T.inl.

  : ACE_Data_Block (size,
                    msg_type,
                    msg_data,
                    allocator_strategy,
                    &lock_,
                    flags,
                    data_block_allocator)
{
}

template<class L >
ACE_Locked_Data_Block< L >::~ACE_Locked_Data_Block ( void   )  [virtual]

Delete all the resources held in the message.

Definition at line 17 of file Message_Block_T.cpp.

{
}

template<class ACE_LOCK>
ACE_Locked_Data_Block< ACE_LOCK >::ACE_Locked_Data_Block ( const ACE_Locked_Data_Block< ACE_LOCK > &   )  [private]

Member Function Documentation

template<class ACE_LOCK >
ACE_Data_Block * ACE_Locked_Data_Block< ACE_LOCK >::clone_nocopy ( ACE_Message_Block::Message_Flags  mask = 0,
size_t  max_size = 0 
) const [virtual]

Return an exact "deep copy" of the message, the dynamic type is ACE_Locked_Data_Block<> See the documentation in Message_Block.h for details.

Reimplemented from ACE_Data_Block.

Definition at line 22 of file Message_Block_T.cpp.

{
  ACE_TRACE ("ACE_Locked_Data_Block::clone_nocopy");

  // You always want to clear this one to prevent memory leaks but you
  // might add some others later.
  const ACE_Message_Block::Message_Flags always_clear =
    ACE_Message_Block::DONT_DELETE;

  ACE_Locked_Data_Block<ACE_LOCK> *nb = 0;

  ACE_NEW_MALLOC_RETURN (nb,
                         static_cast<ACE_Locked_Data_Block<ACE_LOCK>*> (
                                         this->data_block_allocator ()->malloc (sizeof (ACE_Locked_Data_Block<ACE_LOCK>))),
                         ACE_Locked_Data_Block<ACE_LOCK> (
                                                   max_size == 0 ?
                                                     this->size () : max_size,
                                                   this->msg_type (),
                                                   0,
                                                   this->allocator_strategy (),
                                                   this->flags (),
                                                   this->data_block_allocator ()),
                         0);

  // Set new flags minus the mask...
  nb->clr_flags (mask | always_clear);
  return nb;
}

template<class ACE_LOCK>
ACE_Locked_Data_Block<ACE_LOCK>& ACE_Locked_Data_Block< ACE_LOCK >::operator= ( const ACE_Locked_Data_Block< ACE_LOCK > &   )  [private]

Member Data Documentation

template<class ACE_LOCK>
ACE_LOCK ACE_Locked_Data_Block< ACE_LOCK >::lock_ [private]

The lock.

Definition at line 66 of file Message_Block_T.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines