OpenDDS::DCPS::CopyChainVisitor Class Reference

#include <CopyChainVisitor.h>

Inheritance diagram for OpenDDS::DCPS::CopyChainVisitor:

Inheritance graph
[legend]
Collaboration diagram for OpenDDS::DCPS::CopyChainVisitor:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 CopyChainVisitor (BasicQueue< TransportQueueElement > &target, TransportRetainedElementAllocator *allocator, MessageBlockAllocator *mb_allocator, DataBlockAllocator *db_allocator)
virtual ~CopyChainVisitor ()
virtual int visit_element (TransportQueueElement *element)
int status () const
 Access the status.

Private Attributes

BasicQueue< TransportQueueElement > & target_
 Target queue to fill with copied elements.
TransportRetainedElementAllocatorallocator_
 Allocator to create copied elements.
MessageBlockAllocatormb_allocator_
DataBlockAllocatordb_allocator_
int status_
 Status of visitation.

Detailed Description

Definition at line 24 of file CopyChainVisitor.h.


Constructor & Destructor Documentation

ACE_INLINE OpenDDS::DCPS::CopyChainVisitor::CopyChainVisitor ( BasicQueue< TransportQueueElement > &  target,
TransportRetainedElementAllocator allocator,
MessageBlockAllocator mb_allocator,
DataBlockAllocator db_allocator 
)

Definition at line 11 of file CopyChainVisitor.inl.

References DBG_ENTRY_LVL.

00016   : target_( target)
00017   , allocator_( allocator)
00018   , mb_allocator_(mb_allocator)
00019   , db_allocator_(db_allocator)
00020   , status_( 0)
00021 {
00022   DBG_ENTRY_LVL("CopyChainVisitor","CopyChainVisitor",6);
00023 }

OpenDDS::DCPS::CopyChainVisitor::~CopyChainVisitor (  )  [virtual]

Definition at line 16 of file CopyChainVisitor.cpp.

References DBG_ENTRY_LVL.

00017 {
00018   DBG_ENTRY_LVL("CopyChainVisitor","~CopyChainVisitor",6);
00019 }


Member Function Documentation

ACE_INLINE int OpenDDS::DCPS::CopyChainVisitor::status (  )  const

Access the status.

Definition at line 27 of file CopyChainVisitor.inl.

References status_.

00028 {
00029   return this->status_;
00030 }

int OpenDDS::DCPS::CopyChainVisitor::visit_element ( TransportQueueElement element  )  [virtual]

Definition at line 22 of file CopyChainVisitor.cpp.

References allocator_, OpenDDS::DCPS::TransportRetainedElement::allocator_, db_allocator_, DBG_ENTRY_LVL, OpenDDS::DCPS::Cached_Allocator_With_Overflow< T, ACE_LOCK >::malloc(), mb_allocator_, OpenDDS::DCPS::TransportQueueElement::msg(), OpenDDS::DCPS::TransportQueueElement::publication_id(), status_, and target_.

00023 {
00024   DBG_ENTRY_LVL("CopyChainVisitor","visit_element",6);
00025 
00026   // Create a new copy of the current element.
00027   // fails.
00028   TransportRetainedElement* copiedElement = 0;
00029   ACE_NEW_MALLOC_NORETURN(
00030     copiedElement,
00031     (TransportRetainedElement*)this->allocator_->malloc(),
00032     TransportRetainedElement(
00033       element->msg(),
00034       element->publication_id(),
00035       this->allocator_,
00036       this->mb_allocator_,
00037       this->db_allocator_
00038     )
00039   );
00040   if( copiedElement) {
00041     // Add the copy to the target.
00042     this->target_.put( copiedElement);
00043 
00044     // Visit entire queue.
00045     return 1;
00046 
00047   } else {
00048     ACE_ERROR((LM_ERROR,
00049       ACE_TEXT("(%P|%t) ERROR: CopyChainVisitor::visit_element - ")
00050       ACE_TEXT("failed to allocate a new TransportRetainedElement.")
00051     ));
00052     this->status_ = -1;
00053 
00054     // Stop visitation.
00055     return 0;
00056   }
00057 
00058 
00059 }


Member Data Documentation

TransportRetainedElementAllocator* OpenDDS::DCPS::CopyChainVisitor::allocator_ [private]

Allocator to create copied elements.

Definition at line 46 of file CopyChainVisitor.h.

Referenced by visit_element().

DataBlockAllocator* OpenDDS::DCPS::CopyChainVisitor::db_allocator_ [private]

Definition at line 48 of file CopyChainVisitor.h.

Referenced by visit_element().

MessageBlockAllocator* OpenDDS::DCPS::CopyChainVisitor::mb_allocator_ [private]

Definition at line 47 of file CopyChainVisitor.h.

Referenced by visit_element().

int OpenDDS::DCPS::CopyChainVisitor::status_ [private]

Status of visitation.

Definition at line 51 of file CopyChainVisitor.h.

Referenced by status(), and visit_element().

BasicQueue<TransportQueueElement>& OpenDDS::DCPS::CopyChainVisitor::target_ [private]

Target queue to fill with copied elements.

Definition at line 43 of file CopyChainVisitor.h.

Referenced by visit_element().


The documentation for this class was generated from the following files:
Generated on Fri Feb 12 20:06:26 2016 for OpenDDS by  doxygen 1.4.7