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

#include <RtpsCustomizedElement.h>

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

Public Member Functions

 RtpsCustomizedElement (TransportQueueElement *orig, Message_Block_Ptr msg)
 
SequenceNumber last_fragment () const
 
- Public Member Functions inherited from OpenDDS::DCPS::TransportCustomizedElement
 TransportCustomizedElement (TransportQueueElement *orig)
 
void set_fragment (TransportQueueElement *orig)
 
virtual GUID_t publication_id () const
 Accessor for the publication id that sent the sample. More...
 
void set_publication_id (const GUID_t &id)
 
GUID_t subscription_id () const
 Accessor for the subscription id, if sent the sample is sent to 1 sub. More...
 
void set_subscription_id (const GUID_t &id)
 
SequenceNumber sequence () const
 
void set_sequence (const SequenceNumber &value)
 
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
 The marshalled sample (sample header + sample data) More...
 
void set_msg (Message_Block_Ptr m)
 
virtual bool owned_by_transport ()
 Is the sample created by the transport? More...
 
virtual bool is_fragment () const
 Is this QueueElement the result of fragmentation? More...
 
const TransportSendElementoriginal_send_element () 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 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 is_request_ack () const
 
virtual bool is_retained_replaced () const
 

Private Member Functions

virtual ~RtpsCustomizedElement ()
 
TqePair fragment (size_t size)
 
const ACE_Message_Blockmsg_payload () const
 The marshalled payload only (sample data) More...
 

Private Attributes

SequenceNumber last_frag_
 

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)
 
- Protected Member Functions inherited from OpenDDS::DCPS::TransportCustomizedElement
virtual void release_element (bool dropped_by_transport)
 Invoked when the counter reaches 0. More...
 
virtual bool requires_exclusive_packet () const
 Does the sample require an exclusive transport packet? More...
 
void set_requires_exclusive ()
 
virtual ~TransportCustomizedElement ()
 
- Protected Member Functions inherited from OpenDDS::DCPS::TransportQueueElement
 TransportQueueElement (unsigned long initial_count)
 
bool was_dropped () const
 
- Static Protected Member Functions inherited from OpenDDS::DCPS::TransportCustomizedElement
static const TransportSendElementfind_original_send_element (TransportQueueElement *orig)
 

Detailed Description

Definition at line 22 of file RtpsCustomizedElement.h.

Constructor & Destructor Documentation

◆ RtpsCustomizedElement()

ACE_INLINE OpenDDS::DCPS::RtpsCustomizedElement::RtpsCustomizedElement ( TransportQueueElement orig,
Message_Block_Ptr  msg 
)

◆ ~RtpsCustomizedElement()

OpenDDS::DCPS::RtpsCustomizedElement::~RtpsCustomizedElement ( )
privatevirtual

Definition at line 20 of file RtpsCustomizedElement.cpp.

21 {}

Member Function Documentation

◆ fragment()

TqePair OpenDDS::DCPS::RtpsCustomizedElement::fragment ( size_t  size)
privatevirtual

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 from OpenDDS::DCPS::TransportQueueElement.

Definition at line 23 of file RtpsCustomizedElement.cpp.

References last_frag_, OpenDDS::DCPS::move(), OpenDDS::DCPS::TransportCustomizedElement::msg(), OpenDDS::DCPS::null_tqe_pair, RtpsCustomizedElement(), OpenDDS::DCPS::TransportCustomizedElement::set_fragment(), OpenDDS::DCPS::RtpsSampleHeader::split(), and OpenDDS::DCPS::unknown_sequence_range.

24 {
25  Message_Block_Ptr head;
26  Message_Block_Ptr tail;
27  const SequenceRange fragNumbers =
28  RtpsSampleHeader::split(*msg(), size, head, tail);
29  if (fragNumbers == unknown_sequence_range) {
30  return null_tqe_pair;
31  }
32 
33  RtpsCustomizedElement* frag = new RtpsCustomizedElement(0, move(head));
34  frag->set_fragment(this);
35  frag->last_frag_ = fragNumbers.first;
36 
37  RtpsCustomizedElement* rest = new RtpsCustomizedElement(this, move(tail));
38  rest->set_fragment(this);
39  rest->last_frag_ = fragNumbers.second;
40 
41  return TqePair(frag, rest);
42 }
OpenDDS_Dcps_Export const SequenceRange unknown_sequence_range
const TqePair null_tqe_pair
T::rv_reference move(T &p)
Definition: unique_ptr.h:141
std::pair< TransportQueueElement *, TransportQueueElement * > TqePair
virtual const ACE_Message_Block * msg() const
The marshalled sample (sample header + sample data)
RtpsCustomizedElement(TransportQueueElement *orig, Message_Block_Ptr msg)
static SequenceRange split(const ACE_Message_Block &orig, size_t size, Message_Block_Ptr &head, Message_Block_Ptr &tail)
unique_ptr< ACE_Message_Block, Message_Block_Deleter > Message_Block_Ptr
std::pair< SequenceNumber, SequenceNumber > SequenceRange

◆ last_fragment()

ACE_INLINE SequenceNumber OpenDDS::DCPS::RtpsCustomizedElement::last_fragment ( ) const

◆ msg_payload()

const ACE_Message_Block * OpenDDS::DCPS::RtpsCustomizedElement::msg_payload ( ) const
privatevirtual

The marshalled payload only (sample data)

Reimplemented from OpenDDS::DCPS::TransportCustomizedElement.

Definition at line 45 of file RtpsCustomizedElement.cpp.

References ACE_Message_Block::cont(), OpenDDS::DCPS::TransportCustomizedElement::msg(), and OPENDDS_END_VERSIONED_NAMESPACE_DECL.

46 {
47  const ACE_Message_Block* message = msg();
48  return message ? message->cont() : 0;
49 }
virtual const ACE_Message_Block * msg() const
The marshalled sample (sample header + sample data)
ACE_Message_Block * cont(void) const

Member Data Documentation

◆ last_frag_

SequenceNumber OpenDDS::DCPS::RtpsCustomizedElement::last_frag_
private

Definition at line 39 of file RtpsCustomizedElement.h.

Referenced by fragment(), and last_fragment().


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