OpenDDS  Snapshot(2023/04/28-20:55)
BuildChainVisitor.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 "BuildChainVisitor.h"
10 #include "TransportQueueElement.h"
11 
12 #if !defined (__ACE_INLINE__)
13 #include "BuildChainVisitor.inl"
14 #endif /* __ACE_INLINE__ */
15 
17 {
18  DBG_ENTRY_LVL("BuildChainVisitor", "~BuildChainVisitor", 6);
19 }
20 
21 int
23 {
24  DBG_ENTRY_LVL("BuildChainVisitor", "visit_element", 6);
25 
26  if (head_ == 0) {
27  // This is the first element that we have visited.
28  head_ = element->msg()->duplicate();
29  tail_ = head_;
30 
31  while (tail_->cont() != 0) {
32  tail_ = tail_->cont();
33  }
34 
35  } else {
36  // This is not the first element that we have visited.
37  tail_->cont(element->msg()->duplicate());
38 
39  while (tail_->cont() != 0) {
40  tail_ = tail_->cont();
41  }
42  }
43 
44  // Visit entire queue.
45  return 1;
46 }
virtual int visit_element(TransportQueueElement *element)
ACE_Message_Block * cont(void) const
virtual ACE_Message_Block * duplicate(void) const
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68
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)