OpenDDS  Snapshot(2023/04/28-20:55)
CopyChainVisitor.cpp
Go to the documentation of this file.
1 /*
2  *
3  *
4  * Distributed under the OpenDDS License.
5  * See: http://www.opendds.org/license.html
6  */
7 
8 #include "DCPS/DdsDcps_pch.h" //Only the _pch include should start with DCPS/
9 #include "CopyChainVisitor.h"
10 #include "TransportQueueElement.h"
11 
12 #if !defined (__ACE_INLINE__)
13 #include "CopyChainVisitor.inl"
14 #endif /* __ACE_INLINE__ */
15 
17 {
18  DBG_ENTRY_LVL("CopyChainVisitor", "~CopyChainVisitor", 6);
19 }
20 
21 int
23 {
24  DBG_ENTRY_LVL("CopyChainVisitor", "visit_element", 6);
25 
26  TransportRetainedElement* copiedElement = 0;
27  if (duplicate_) {
28  // Create a new copy of the current element.
29  copiedElement = new
31  element->duplicate_msg(),
32  element->publication_id()
33  );
34  } else {
35  // Create a new copy of the current element.
36  copiedElement = new
38  element->msg(),
39  element->publication_id(),
42  );
43  }
44 
45  // Add the copy to the target.
46  target_.put(copiedElement);
47 
48  // Visit entire queue.
49  return 1;
50 }
MessageBlockAllocator * mb_allocator_
Allocator to create copied elements.
virtual int visit_element(TransportQueueElement *element)
DataBlockAllocator * db_allocator_
virtual ACE_Message_Block * duplicate_msg() const =0
A reference-incremented duplicate of the marshalled sample (sample header + sample data) ...
BasicQueue< TransportQueueElement > & target_
Target queue to fill with copied elements.
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68
virtual GUID_t publication_id() const =0
Accessor for the publication id that sent the sample.
int put(T *elem)
Put a pointer to an element (T*) on to the queue.
Definition: BasicQueue_T.h:36
Base wrapper class around a data/control sample to be sent.
virtual const ACE_Message_Block * msg() const =0
The marshalled sample (sample header + sample data)