OpenDDS  Snapshot(2023/04/07-19:43)
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
OpenDDS::DCPS::TransportSendControlElement Class Reference

#include <TransportSendControlElement.h>

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

Public Member Functions

 TransportSendControlElement (int initial_count, const GUID_t &publisher_id, TransportSendListener *listener, const DataSampleHeader &header, Message_Block_Ptr msg_block)
 
 TransportSendControlElement (int initial_count, const DataSampleElement *dcps_elem)
 
virtual ~TransportSendControlElement ()
 
virtual bool requires_exclusive_packet () const
 Overridden to always return true for Send Control elements. More...
 
virtual GUID_t publication_id () const
 Accessor for the publisher id. More...
 
virtual ACE_Message_Blockduplicate_msg () const
 A reference-incremented duplicate of the marshalled sample (sample header + sample data) More...
 
virtual const ACE_Message_Blockmsg () const
 Accessor for the ACE_Message_Block. More...
 
const DataSampleHeaderheader () const
 
const TransportSendListenerlistener () const
 
virtual const ACE_Message_Blockmsg_payload () const
 The marshalled payload only (sample data) More...
 
virtual SequenceNumber sequence () const
 
virtual bool is_control (GUID_t pub_id) const
 Is the element a "control" sample from the specified pub_id? More...
 
virtual bool owned_by_transport ()
 Is the sample created by the transport? More...
 
virtual bool is_request_ack () const
 
virtual bool is_last_fragment () const
 Is this QueueElement the last result of fragmentation? More...
 
- Public Member Functions inherited from OpenDDS::DCPS::TransportQueueElement
virtual ~TransportQueueElement ()
 
bool data_dropped (bool dropped_by_transport=false)
 
bool data_delivered ()
 
void increment_loan ()
 
virtual GUID_t subscription_id () const
 Accessor for the subscription id, if sent the sample is sent to 1 sub. More...
 
bool released () const
 Is the listener get called ? More...
 
void released (bool flag)
 
virtual TqePair fragment (size_t size)
 
virtual bool is_fragment () const
 Is this QueueElement the result of fragmentation? More...
 
virtual bool is_retained_replaced () const
 

Protected Member Functions

virtual void release_element (bool dropped_by_transport)
 Invoked when the counter reaches 0. More...
 
- Protected Member Functions inherited from OpenDDS::DCPS::TransportQueueElement
 TransportQueueElement (unsigned long initial_count)
 
bool was_dropped () const
 

Private Attributes

GUID_t publisher_id_
 The publisher of the control message. More...
 
TransportSendListenerlistener_
 The TransportSendListener object to call back upon. More...
 
DataSampleHeader header_
 The OpenDDS DCPS header for this control message. More...
 
Message_Block_Ptr msg_
 The control message. More...
 
const DataSampleElement *const dcps_elem_
 If constructed from a DataSampleElement, keep it around for release. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from OpenDDS::DCPS::TransportQueueElement
static ACE_Message_Blockclone_mb (const ACE_Message_Block *msg, MessageBlockAllocator *mb_allocator, DataBlockAllocator *db_allocator)
 

Detailed Description

Definition at line 34 of file TransportSendControlElement.h.

Constructor & Destructor Documentation

◆ TransportSendControlElement() [1/2]

OpenDDS::DCPS::TransportSendControlElement::TransportSendControlElement ( int  initial_count,
const GUID_t publisher_id,
TransportSendListener listener,
const DataSampleHeader header,
Message_Block_Ptr  msg_block 
)

Definition at line 26 of file TransportSendControlElement.cpp.

References DBG_ENTRY_LVL, and release().

31  : TransportQueueElement(initial_count),
32  publisher_id_(publisher_id),
34  header_(header),
35  msg_(msg_block.release()),
36  dcps_elem_(0)
37 {
38  DBG_ENTRY_LVL("TransportSendControlElement", "TransportSendControlElement", 6);
39 }
const TransportSendListener * listener() const
GUID_t publisher_id_
The publisher of the control message.
Message_Block_Ptr msg_
The control message.
TransportSendListener * listener_
The TransportSendListener object to call back upon.
TransportQueueElement(unsigned long initial_count)
DataSampleHeader header_
The OpenDDS DCPS header for this control message.
const DataSampleElement *const dcps_elem_
If constructed from a DataSampleElement, keep it around for release.
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68

◆ TransportSendControlElement() [2/2]

OpenDDS::DCPS::TransportSendControlElement::TransportSendControlElement ( int  initial_count,
const DataSampleElement dcps_elem 
)

Definition at line 42 of file TransportSendControlElement.cpp.

References DBG_ENTRY_LVL.

44  : TransportQueueElement(initial_count)
45  , publisher_id_(dcps_elem->get_pub_id())
46  , listener_(dcps_elem->get_send_listener())
47  , header_(dcps_elem->get_header())
48  , dcps_elem_(dcps_elem)
49 {
50  DBG_ENTRY_LVL("TransportSendControlElement", "TransportSendControlElement", 6);
51 }
GUID_t publisher_id_
The publisher of the control message.
TransportSendListener * listener_
The TransportSendListener object to call back upon.
TransportQueueElement(unsigned long initial_count)
DataSampleHeader header_
The OpenDDS DCPS header for this control message.
const DataSampleElement *const dcps_elem_
If constructed from a DataSampleElement, keep it around for release.
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68

◆ ~TransportSendControlElement()

OpenDDS::DCPS::TransportSendControlElement::~TransportSendControlElement ( )
virtual

Definition at line 53 of file TransportSendControlElement.cpp.

References DBG_ENTRY_LVL.

54 {
55  DBG_ENTRY_LVL("TransportSendControlElement", "~TransportSendControlElement", 6);
56 }
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68

Member Function Documentation

◆ duplicate_msg()

ACE_Message_Block * OpenDDS::DCPS::TransportSendControlElement::duplicate_msg ( ) const
virtual

A reference-incremented duplicate of the marshalled sample (sample header + sample data)

Implements OpenDDS::DCPS::TransportQueueElement.

Definition at line 127 of file TransportSendControlElement.cpp.

References DBG_ENTRY_LVL, dcps_elem_, ACE_Message_Block::duplicate(), and msg_.

128 {
129  DBG_ENTRY_LVL("TransportSendControlElement", "duplicate_msg", 6);
130  if (dcps_elem_) {
131  return const_cast<DataSampleElement*>(dcps_elem_)->get_sample()->duplicate();
132  }
133  return msg_->duplicate();
134 }
Message_Block_Ptr msg_
The control message.
virtual ACE_Message_Block * duplicate(void) const
const DataSampleElement *const dcps_elem_
If constructed from a DataSampleElement, keep it around for release.
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68

◆ header()

const DataSampleHeader& OpenDDS::DCPS::TransportSendControlElement::header ( void  ) const
inline

◆ is_control()

bool OpenDDS::DCPS::TransportSendControlElement::is_control ( GUID_t  pub_id) const
virtual

Is the element a "control" sample from the specified pub_id?

Reimplemented from OpenDDS::DCPS::TransportQueueElement.

Definition at line 154 of file TransportSendControlElement.cpp.

References OPENDDS_END_VERSIONED_NAMESPACE_DECL, and publisher_id_.

155 {
156  return (pub_id == publisher_id_);
157 }
GUID_t publisher_id_
The publisher of the control message.

◆ is_last_fragment()

virtual bool OpenDDS::DCPS::TransportSendControlElement::is_last_fragment ( ) const
inlinevirtual

Is this QueueElement the last result of fragmentation?

Reimplemented from OpenDDS::DCPS::TransportQueueElement.

Definition at line 76 of file TransportSendControlElement.h.

76 { return !header_.more_fragments(); }
DataSampleHeader header_
The OpenDDS DCPS header for this control message.

◆ is_request_ack()

virtual bool OpenDDS::DCPS::TransportSendControlElement::is_request_ack ( ) const
inlinevirtual

Reimplemented from OpenDDS::DCPS::TransportQueueElement.

Definition at line 74 of file TransportSendControlElement.h.

References OpenDDS::DCPS::REQUEST_ACK.

74 { return header_.message_id_ == REQUEST_ACK; }
char message_id_
The enum MessageId.
DataSampleHeader header_
The OpenDDS DCPS header for this control message.

◆ listener()

const TransportSendListener* OpenDDS::DCPS::TransportSendControlElement::listener ( ) const
inline

Definition at line 64 of file TransportSendControlElement.h.

Referenced by OpenDDS::DCPS::RtpsSampleHeader::populate_data_control_submessages(), release_element(), and requires_exclusive_packet().

64 { return listener_; }
TransportSendListener * listener_
The TransportSendListener object to call back upon.

◆ msg()

const ACE_Message_Block * OpenDDS::DCPS::TransportSendControlElement::msg ( void  ) const
virtual

Accessor for the ACE_Message_Block.

Implements OpenDDS::DCPS::TransportQueueElement.

Definition at line 137 of file TransportSendControlElement.cpp.

References DBG_ENTRY_LVL, dcps_elem_, OpenDDS::DCPS::unique_ptr< T, Deleter >::get(), OpenDDS::DCPS::DataSampleElement::get_sample(), and msg_.

Referenced by msg_payload(), release_element(), and requires_exclusive_packet().

138 {
139  DBG_ENTRY_LVL("TransportSendControlElement", "msg", 6);
140  if (dcps_elem_) {
141  return dcps_elem_->get_sample();
142  }
143  return msg_.get();
144 }
Message_Block_Ptr msg_
The control message.
const DataSampleElement *const dcps_elem_
If constructed from a DataSampleElement, keep it around for release.
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68

◆ msg_payload()

const ACE_Message_Block * OpenDDS::DCPS::TransportSendControlElement::msg_payload ( ) const
virtual

The marshalled payload only (sample data)

Implements OpenDDS::DCPS::TransportQueueElement.

Definition at line 147 of file TransportSendControlElement.cpp.

References ACE_Message_Block::cont(), DBG_ENTRY_LVL, and msg().

Referenced by OpenDDS::DCPS::RtpsSampleHeader::populate_data_control_submessages().

148 {
149  DBG_ENTRY_LVL("TransportSendControlElement", "msg_payload", 6);
150  return msg()->cont();
151 }
virtual const ACE_Message_Block * msg() const
Accessor for the ACE_Message_Block.
ACE_Message_Block * cont(void) const
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68

◆ owned_by_transport()

ACE_INLINE bool OpenDDS::DCPS::TransportSendControlElement::owned_by_transport ( )
virtual

Is the sample created by the transport?

Implements OpenDDS::DCPS::TransportQueueElement.

Definition at line 15 of file TransportSendControlElement.inl.

References ACE_INLINE.

16 {
17  return false;
18 }

◆ publication_id()

GUID_t OpenDDS::DCPS::TransportSendControlElement::publication_id ( ) const
virtual

Accessor for the publisher id.

Implements OpenDDS::DCPS::TransportQueueElement.

Definition at line 120 of file TransportSendControlElement.cpp.

References DBG_ENTRY_LVL, and publisher_id_.

Referenced by OpenDDS::DCPS::RtpsUdpDataLink::send_heartbeats_manual_i().

121 {
122  DBG_ENTRY_LVL("TransportSendControlElement", "publication_id", 6);
123  return publisher_id_;
124 }
GUID_t publisher_id_
The publisher of the control message.
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68

◆ release_element()

void OpenDDS::DCPS::TransportSendControlElement::release_element ( bool  dropped_by_transport)
protectedvirtual

Invoked when the counter reaches 0.

Implements OpenDDS::DCPS::TransportQueueElement.

Definition at line 93 of file TransportSendControlElement.cpp.

References DBG_ENTRY_LVL, dcps_elem_, listener(), listener_, msg(), msg_, OpenDDS::DCPS::unique_ptr< T, Deleter >::release(), and OpenDDS::DCPS::TransportQueueElement::was_dropped().

94 {
95  ACE_UNUSED_ARG(dropped_by_transport);
96 
97  DBG_ENTRY_LVL("TransportSendControlElement", "release_element", 6);
98 
99  // store off local copies to use after "this" pointer deleted
100  const bool dropped = was_dropped();
101 
103 
104  TransportSendListener* const listener = listener_;
105  const DataSampleElement* dcps_elem = dcps_elem_;
106 
107 
108  delete this;
109 
110 
111  // reporting the message w/o using "this" pointer
112  if (dcps_elem) {
113  handle_message(dropped, dcps_elem, dropped_by_transport);
114  } else {
115  handle_message(dropped, msg, listener, dropped_by_transport);
116  }
117 }
virtual const ACE_Message_Block * msg() const
Accessor for the ACE_Message_Block.
const TransportSendListener * listener() const
Message_Block_Ptr msg_
The control message.
TransportSendListener * listener_
The TransportSendListener object to call back upon.
const DataSampleElement *const dcps_elem_
If constructed from a DataSampleElement, keep it around for release.
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68
unique_ptr< ACE_Message_Block, Message_Block_Deleter > Message_Block_Ptr

◆ requires_exclusive_packet()

bool OpenDDS::DCPS::TransportSendControlElement::requires_exclusive_packet ( ) const
virtual

Overridden to always return true for Send Control elements.

Reimplemented from OpenDDS::DCPS::TransportQueueElement.

Definition at line 59 of file TransportSendControlElement.cpp.

References OpenDDS::DCPS::TransportSendListener::control_delivered(), OpenDDS::DCPS::TransportSendListener::control_dropped(), OpenDDS::DCPS::TransportSendListener::data_delivered(), OpenDDS::DCPS::TransportSendListener::data_dropped(), DBG_ENTRY_LVL, OpenDDS::DCPS::DataSampleElement::get_send_listener(), listener(), and msg().

60 {
61  DBG_ENTRY_LVL("TransportSendControlElement", "requires_exclusive_packet", 6);
62  return true;
63 }
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68

◆ sequence()

ACE_INLINE SequenceNumber OpenDDS::DCPS::TransportSendControlElement::sequence ( ) const
virtual

Member Data Documentation

◆ dcps_elem_

const DataSampleElement* const OpenDDS::DCPS::TransportSendControlElement::dcps_elem_
private

If constructed from a DataSampleElement, keep it around for release.

Definition at line 97 of file TransportSendControlElement.h.

Referenced by duplicate_msg(), msg(), and release_element().

◆ header_

DataSampleHeader OpenDDS::DCPS::TransportSendControlElement::header_
private

The OpenDDS DCPS header for this control message.

Definition at line 91 of file TransportSendControlElement.h.

Referenced by sequence().

◆ listener_

TransportSendListener* OpenDDS::DCPS::TransportSendControlElement::listener_
private

The TransportSendListener object to call back upon.

Definition at line 88 of file TransportSendControlElement.h.

Referenced by release_element().

◆ msg_

Message_Block_Ptr OpenDDS::DCPS::TransportSendControlElement::msg_
private

The control message.

Definition at line 94 of file TransportSendControlElement.h.

Referenced by duplicate_msg(), msg(), and release_element().

◆ publisher_id_

GUID_t OpenDDS::DCPS::TransportSendControlElement::publisher_id_
private

The publisher of the control message.

Definition at line 85 of file TransportSendControlElement.h.

Referenced by is_control(), and publication_id().


The documentation for this class was generated from the following files: