OpenDDS
Snapshot(2023/04/07-19:43)
|
Base wrapper class around a data/control sample to be sent. More...
#include <TransportQueueElement.h>
Classes | |
class | MatchCriteria |
class | MatchOnDataPayload |
class | MatchOnElement |
class | MatchOnPubId |
struct | OrderBySequenceNumber |
Public Member Functions | |
virtual | ~TransportQueueElement () |
bool | data_dropped (bool dropped_by_transport=false) |
bool | data_delivered () |
void | increment_loan () |
virtual bool | requires_exclusive_packet () const |
Does the sample require an exclusive transport packet? More... | |
virtual GUID_t | publication_id () const =0 |
Accessor for the publication id that sent the sample. More... | |
virtual GUID_t | subscription_id () const |
Accessor for the subscription id, if sent the sample is sent to 1 sub. More... | |
virtual SequenceNumber | sequence () const |
virtual ACE_Message_Block * | duplicate_msg () const =0 |
A reference-incremented duplicate of the marshalled sample (sample header + sample data) More... | |
virtual const ACE_Message_Block * | msg () const =0 |
The marshalled sample (sample header + sample data) More... | |
virtual const ACE_Message_Block * | msg_payload () const =0 |
The marshalled payload only (sample data) More... | |
virtual bool | is_control (GUID_t pub_id) const |
Is the element a "control" sample from the specified pub_id? More... | |
bool | released () const |
Is the listener get called ? More... | |
void | released (bool flag) |
virtual bool | owned_by_transport ()=0 |
Is the sample created by the transport? More... | |
virtual TqePair | fragment (size_t size) |
virtual bool | is_fragment () const |
Is this QueueElement the result of fragmentation? More... | |
virtual bool | is_last_fragment () const |
Is this QueueElement the last result of fragmentation? More... | |
virtual bool | is_request_ack () const |
virtual bool | is_retained_replaced () const |
Static Public Member Functions | |
static ACE_Message_Block * | clone_mb (const ACE_Message_Block *msg, MessageBlockAllocator *mb_allocator, DataBlockAllocator *db_allocator) |
Protected Member Functions | |
TransportQueueElement (unsigned long initial_count) | |
virtual void | release_element (bool dropped_by_transport)=0 |
Invoked when the counter reaches 0. More... | |
bool | was_dropped () const |
Private Member Functions | |
bool | decision_made (bool dropped_by_transport) |
Common logic for data_dropped() and data_delivered(). More... | |
Private Attributes | |
Atomic< unsigned long > | sub_loan_count_ |
Counts the number of outstanding sub-loans. More... | |
bool | dropped_ |
Flag flipped to true if any DataLink dropped the sample. More... | |
bool | released_ |
If the callback to DW is made. More... | |
Friends | |
class | TransportCustomizedElement |
Base wrapper class around a data/control sample to be sent.
This class serves as the base class for different types of samples that can be sent. For example, there are data samples and control samples. A subclass of TransportQueueElement exists for each of these types of samples.
This class maintains a counter that, when decremented to 0, will trigger some logic (defined in the subclass) that will "return the loan" of the sample. The sample is "loaned" to the transport via a send() or send_control() call on the TransportClient. This wrapper object will "return the loan" when all DataLinks have "returned" their sub-loans.
Definition at line 53 of file TransportQueueElement.h.
|
virtual |
|
explicitprotected |
Ctor. The initial_count is the number of DataLinks to which this TransportQueueElement will be sent.
Definition at line 17 of file TransportQueueElement.inl.
References ACE_INLINE, and DBG_ENTRY_LVL.
|
static |
Clone method with provided message block allocator and data block allocators.
Definition at line 62 of file TransportQueueElement.cpp.
References ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY, ACE_NEW_MALLOC_RETURN, ACE_Message_Block::base(), ACE_Message_Block::capacity(), ACE_Message_Block::cont(), ACE_Message_Block::copy(), OpenDDS::DCPS::Cached_Allocator_With_Overflow< T, ACE_LOCK >::malloc(), ACE_Time_Value::max_time, ACE_Message_Block::MB_DATA, msg(), ACE_Message_Block::rd_ptr(), ACE_Message_Block::size(), ACE_Message_Block::wr_ptr(), and ACE_Time_Value::zero.
Referenced by OpenDDS::DCPS::SingleSendBuffer::retain_buffer().
ACE_INLINE bool OpenDDS::DCPS::TransportQueueElement::data_delivered | ( | ) |
Invoked when the sample has been sent by a DataLink. The return value indicates if this element is released.
Definition at line 36 of file TransportQueueElement.inl.
References ACE_INLINE, DBG_ENTRY_LVL, decision_made(), and dropped_.
Referenced by OpenDDS::DCPS::RtpsUdpDataLink::customize_queue_element(), OpenDDS::DCPS::RtpsUdpDataLink::RtpsWriter::customize_queue_element_helper(), OpenDDS::DCPS::TransportSendStrategy::deliver_ack_request(), OpenDDS::DCPS::DataLink::handle_send_request_ack(), and OpenDDS::DCPS::TransportSendStrategy::send_delayed_notifications().
ACE_INLINE bool OpenDDS::DCPS::TransportQueueElement::data_dropped | ( | bool | dropped_by_transport = false | ) |
Invoked when the sample is dropped from a DataLink due to a remove_sample() call. The dropped_by_transport flag true indicates the data dropping is initiated by transport when the transport send strategy is in a MODE_TERMINATED. The dropped_by_transport flag false indicates the dropping is initiated by the remove_sample and data_dropped() is a result of remove_sample(). The return value indicates if this element is released.
Definition at line 27 of file TransportQueueElement.inl.
References ACE_INLINE, DBG_ENTRY_LVL, decision_made(), and dropped_.
Referenced by OpenDDS::DCPS::RtpsUdpDataLink::RtpsWriter::customize_queue_element_helper(), OpenDDS::DCPS::RtpsUdpDataLink::customize_queue_element_non_reliable_i(), OpenDDS::DCPS::TcpDataLink::handle_send_request_ack(), OpenDDS::DCPS::RtpsUdpDataLink::RtpsWriter::remove_sample(), OpenDDS::DCPS::TransportSendStrategy::send(), OpenDDS::DCPS::DataLink::send(), OpenDDS::DCPS::TransportSendStrategy::send_delayed_notifications(), OpenDDS::DCPS::TcpDataLink::send_i(), OpenDDS::DCPS::DataLink::send_i(), OpenDDS::DCPS::PacketRemoveVisitor::visit_element_ref(), OpenDDS::DCPS::RemoveAllVisitor::visit_element_remove(), OpenDDS::DCPS::QueueRemoveVisitor::visit_element_remove(), and OpenDDS::DCPS::ThreadPerConRemoveVisitor::visit_element_remove().
|
private |
Common logic for data_dropped() and data_delivered().
Definition at line 47 of file TransportQueueElement.inl.
References ACE_INLINE, DBG_ENTRY_LVL, OPENDDS_ASSERT, release_element(), and sub_loan_count_.
Referenced by data_delivered(), data_dropped(), and OpenDDS::DCPS::TransportCustomizedElement::release_element().
|
pure virtual |
A reference-incremented duplicate of the marshalled sample (sample header + sample data)
Implemented in OpenDDS::DCPS::TransportSendControlElement, OpenDDS::DCPS::TransportRetainedElement, OpenDDS::DCPS::TransportControlElement, OpenDDS::DCPS::TransportCustomizedElement, OpenDDS::DCPS::TransportReplacedElement, and OpenDDS::DCPS::TransportSendElement.
Referenced by OpenDDS::DCPS::CopyChainVisitor::visit_element().
|
virtual |
Create two TransportQueueElements representing the same data payload as the current TransportQueueElement, with the first one (including its DataSampleHeader) fitting in "size" bytes. This method leaves the current TransportQueueElement alone (but can't be made const because the newly-created elements will need to invoke non-const methods on it). Each element in the pair will contain its own serialized modified DataSampleHeader.
If the fragmentation fails, a copy of null_tqe_pair is returned.
Reimplemented in OpenDDS::DCPS::RtpsCustomizedElement.
Definition at line 44 of file TransportQueueElement.cpp.
References OpenDDS::DCPS::move(), msg(), OpenDDS::DCPS::TransportCustomizedElement::set_fragment(), OpenDDS::DCPS::TransportCustomizedElement::set_msg(), OpenDDS::DCPS::DataSampleHeader::split(), and TransportCustomizedElement.
Referenced by OpenDDS::DCPS::TransportSendStrategy::send().
|
inline |
Delay releasing the element by one decision (either a data_dropped or data_delivered).
Definition at line 115 of file TransportQueueElement.h.
Referenced by OpenDDS::DCPS::TransportSendStrategy::fragmentation_helper().
|
virtual |
Is the element a "control" sample from the specified pub_id?
Reimplemented in OpenDDS::DCPS::TransportSendControlElement.
Definition at line 38 of file TransportQueueElement.cpp.
References DBG_ENTRY_LVL.
|
inlinevirtual |
Is this QueueElement the result of fragmentation?
Reimplemented in OpenDDS::DCPS::TransportCustomizedElement.
Definition at line 169 of file TransportQueueElement.h.
Referenced by OpenDDS::DCPS::RtpsUdpDataLink::RtpsWriter::customize_queue_element_helper(), OpenDDS::DCPS::RtpsUdpDataLink::include_fragment(), and OpenDDS::DCPS::RtpsUdpDataLink::MultiSendBuffer::insert().
|
inlinevirtual |
Is this QueueElement the last result of fragmentation?
Reimplemented in OpenDDS::DCPS::TransportSendControlElement, OpenDDS::DCPS::TransportCustomizedElement, and OpenDDS::DCPS::TransportSendElement.
Definition at line 172 of file TransportQueueElement.h.
Referenced by OpenDDS::DCPS::RtpsUdpDataLink::RtpsWriter::customize_queue_element_helper().
|
inlinevirtual |
Reimplemented in OpenDDS::DCPS::TransportSendControlElement.
Definition at line 174 of file TransportQueueElement.h.
Referenced by OpenDDS::DCPS::TcpSendStrategy::add_delayed_notification(), and OpenDDS::DCPS::DataLink::send().
|
inlinevirtual |
Reimplemented in OpenDDS::DCPS::TransportRetainedElement, and OpenDDS::DCPS::TransportReplacedElement.
Definition at line 176 of file TransportQueueElement.h.
Referenced by OpenDDS::DCPS::PacketRemoveVisitor::visit_element_ref().
|
pure virtual |
The marshalled sample (sample header + sample data)
Implemented in OpenDDS::DCPS::TransportSendControlElement, OpenDDS::DCPS::TransportRetainedElement, OpenDDS::DCPS::TransportControlElement, OpenDDS::DCPS::TransportCustomizedElement, OpenDDS::DCPS::TransportReplacedElement, and OpenDDS::DCPS::TransportSendElement.
Referenced by OpenDDS::DCPS::TransportSendStrategy::adjust_packet_after_send(), clone_mb(), OpenDDS::DCPS::RtpsUdpDataLink::customize_queue_element(), OpenDDS::DCPS::RtpsUdpDataLink::RtpsWriter::customize_queue_element_helper(), OpenDDS::DCPS::RtpsUdpDataLink::customize_queue_element_non_reliable_i(), fragment(), OpenDDS::DCPS::SingleSendBuffer::insert(), OpenDDS::DCPS::TransportSendStrategy::send(), OpenDDS::DCPS::TransportReplacedElement::TransportReplacedElement(), OpenDDS::DCPS::BuildChainVisitor::visit_element(), OpenDDS::DCPS::CopyChainVisitor::visit_element(), OpenDDS::DCPS::PacketRemoveVisitor::visit_element_ref(), OpenDDS::DCPS::RemoveAllVisitor::visit_element_remove(), and OpenDDS::DCPS::QueueRemoveVisitor::visit_element_remove().
|
pure virtual |
The marshalled payload only (sample data)
Implemented in OpenDDS::DCPS::TransportSendControlElement, OpenDDS::DCPS::TransportRetainedElement, OpenDDS::DCPS::TransportControlElement, OpenDDS::DCPS::TransportCustomizedElement, OpenDDS::DCPS::TransportReplacedElement, OpenDDS::DCPS::TransportSendElement, and OpenDDS::DCPS::RtpsCustomizedElement.
Referenced by OpenDDS::DCPS::TransportQueueElement::MatchOnDataPayload::matches(), and OpenDDS::DCPS::TransportCustomizedElement::msg_payload().
|
pure virtual |
Is the sample created by the transport?
Implemented in OpenDDS::DCPS::TransportSendControlElement, OpenDDS::DCPS::TransportRetainedElement, OpenDDS::DCPS::TransportCustomizedElement, OpenDDS::DCPS::TransportSendElement, OpenDDS::DCPS::TransportReplacedElement, and OpenDDS::DCPS::TransportControlElement.
Referenced by OpenDDS::DCPS::TransportSendStrategy::send_delayed_notifications().
|
pure virtual |
Accessor for the publication id that sent the sample.
Implemented in OpenDDS::DCPS::TransportSendControlElement, OpenDDS::DCPS::TransportRetainedElement, OpenDDS::DCPS::TransportControlElement, OpenDDS::DCPS::TransportReplacedElement, OpenDDS::DCPS::TransportCustomizedElement, and OpenDDS::DCPS::TransportSendElement.
Referenced by OpenDDS::DCPS::RtpsUdpDataLink::add_delayed_notification(), OpenDDS::DCPS::RtpsUdpDataLink::customize_queue_element(), OpenDDS::DCPS::RtpsUdpDataLink::RtpsWriter::customize_queue_element_helper(), OpenDDS::DCPS::RtpsUdpDataLink::customize_queue_element_non_reliable_i(), OpenDDS::DCPS::RtpsUdpDataLink::durability_resend(), OpenDDS::DCPS::TcpDataLink::handle_send_request_ack(), OpenDDS::DCPS::RtpsUdpDataLink::MultiSendBuffer::insert(), OpenDDS::DCPS::TransportQueueElement::MatchOnPubId::matches(), OpenDDS::DCPS::RtpsUdpSendStrategy::send_bytes_i_helper(), OpenDDS::DCPS::TcpDataLink::send_i(), OpenDDS::DCPS::TransportCustomizedElement::set_fragment(), OpenDDS::DCPS::TransportReplacedElement::TransportReplacedElement(), and OpenDDS::DCPS::CopyChainVisitor::visit_element().
|
protectedpure virtual |
Invoked when the counter reaches 0.
Implemented in OpenDDS::DCPS::TransportSendControlElement, OpenDDS::DCPS::TransportRetainedElement, OpenDDS::DCPS::TransportCustomizedElement, OpenDDS::DCPS::TransportControlElement, OpenDDS::DCPS::TransportSendElement, and OpenDDS::DCPS::TransportReplacedElement.
Referenced by decision_made().
ACE_INLINE bool OpenDDS::DCPS::TransportQueueElement::released | ( | ) | const |
Is the listener get called ?
Definition at line 80 of file TransportQueueElement.inl.
References ACE_INLINE, and released_.
ACE_INLINE void OpenDDS::DCPS::TransportQueueElement::released | ( | bool | flag | ) |
Definition at line 87 of file TransportQueueElement.inl.
References ACE_INLINE, and released_.
|
virtual |
Does the sample require an exclusive transport packet?
Reimplemented in OpenDDS::DCPS::TransportCustomizedElement, OpenDDS::DCPS::TransportSendControlElement, and OpenDDS::DCPS::TransportControlElement.
Definition at line 31 of file TransportQueueElement.cpp.
References DBG_ENTRY_LVL.
Referenced by OpenDDS::DCPS::TransportSendStrategy::send().
|
inlinevirtual |
Reimplemented in OpenDDS::DCPS::TransportSendControlElement, OpenDDS::DCPS::TransportSendElement, and OpenDDS::DCPS::TransportCustomizedElement.
Definition at line 128 of file TransportQueueElement.h.
References OpenDDS::DCPS::SequenceNumber::SEQUENCENUMBER_UNKNOWN().
Referenced by OpenDDS::DCPS::RtpsUdpDataLink::RtpsWriter::add_elem_awaiting_ack(), OpenDDS::DCPS::RtpsUdpDataLink::RtpsWriter::customize_queue_element_helper(), OpenDDS::DCPS::RtpsUdpDataLink::durability_resend(), OpenDDS::DCPS::TcpDataLink::handle_send_request_ack(), OpenDDS::DCPS::RtpsUdpDataLink::MultiSendBuffer::insert(), OpenDDS::DCPS::TransportQueueElement::OrderBySequenceNumber::operator()(), OpenDDS::DCPS::TransportCustomizedElement::sequence(), and OpenDDS::DCPS::TransportCustomizedElement::set_fragment().
|
inlinevirtual |
Accessor for the subscription id, if sent the sample is sent to 1 sub.
Reimplemented in OpenDDS::DCPS::TransportCustomizedElement, and OpenDDS::DCPS::TransportSendElement.
Definition at line 124 of file TransportQueueElement.h.
References OpenDDS::DCPS::GUID_UNKNOWN.
Referenced by OpenDDS::DCPS::RtpsUdpDataLink::RtpsWriter::customize_queue_element_helper(), OpenDDS::DCPS::RtpsUdpDataLink::durability_resend(), OpenDDS::DCPS::SingleSendBuffer::insert(), OpenDDS::DCPS::RtpsUdpSendStrategy::send_bytes_i_helper(), and OpenDDS::DCPS::TransportCustomizedElement::set_fragment().
|
protected |
May be used by subclass' implementation of release_element() to determine if any DataLinks dropped the data instead of delivering it.
Definition at line 73 of file TransportQueueElement.inl.
References ACE_INLINE, and dropped_.
Referenced by OpenDDS::DCPS::TransportSendElement::release_element(), and OpenDDS::DCPS::TransportSendControlElement::release_element().
|
friend |
Definition at line 203 of file TransportQueueElement.h.
Referenced by fragment().
|
private |
Flag flipped to true if any DataLink dropped the sample.
Definition at line 209 of file TransportQueueElement.h.
Referenced by data_delivered(), data_dropped(), and was_dropped().
|
private |
If the callback to DW is made.
Definition at line 212 of file TransportQueueElement.h.
Referenced by released().
|
private |
Counts the number of outstanding sub-loans.
Definition at line 206 of file TransportQueueElement.h.
Referenced by decision_made().