CopyChainVisitor.cpp

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #include "DCPS/DdsDcps_pch.h" //Only the _pch include should start with DCPS/
00009 #include "CopyChainVisitor.h"
00010 #include "TransportQueueElement.h"
00011 
00012 #if !defined (__ACE_INLINE__)
00013 #include "CopyChainVisitor.inl"
00014 #endif /* __ACE_INLINE__ */
00015 
00016 OpenDDS::DCPS::CopyChainVisitor::~CopyChainVisitor()
00017 {
00018   DBG_ENTRY_LVL("CopyChainVisitor","~CopyChainVisitor",6);
00019 }
00020 
00021 int
00022 OpenDDS::DCPS::CopyChainVisitor::visit_element(TransportQueueElement* element)
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 }
00060 

Generated on Fri Feb 12 20:05:19 2016 for OpenDDS by  doxygen 1.4.7