OpenDDS  Snapshot(2023/04/28-20:55)
TransportSendControlElement.h
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 #ifndef OPENDDS_DCPS_TRANSPORT_FRAMEWORK_TRANSPORTSENDCONTROLELEMENT_H
9 #define OPENDDS_DCPS_TRANSPORT_FRAMEWORK_TRANSPORTSENDCONTROLELEMENT_H
10 
11 #include "dds/DCPS/dcps_export.h"
12 #include "dds/DCPS/GuidUtils.h"
14 #include "TransportDefs.h"
15 #include "TransportQueueElement.h"
16 #include "ace/Synch_Traits.h"
17 
19 class ACE_Message_Block;
21 
23 
24 namespace OpenDDS {
25 namespace DCPS {
26 
27 class TransportSendListener;
28 class TransportSendControlElement;
30 
33 
35 public:
36 
37  TransportSendControlElement(int initial_count,
38  const GUID_t& publisher_id,
39  TransportSendListener* listener,
40  const DataSampleHeader& header,
41  Message_Block_Ptr msg_block);
42 
43  TransportSendControlElement(int initial_count,
44  const DataSampleElement* dcps_elem);
45 
46  virtual ~TransportSendControlElement();
47 
48  /// Overridden to always return true for Send Control elements.
49  virtual bool requires_exclusive_packet() const;
50 
51  /// Accessor for the publisher id.
52  virtual GUID_t publication_id() const;
53 
54  virtual ACE_Message_Block* duplicate_msg() const;
55 
56  /// Accessor for the ACE_Message_Block
57  virtual const ACE_Message_Block* msg() const;
58 
59  const DataSampleHeader& header() const { return header_; }
60  // Only allow const access to the header. Modifying the header
61  // would require remarshaling.
62  //DataSampleHeader& header() { return header_; }
63 
64  const TransportSendListener* listener() const { return listener_; }
65 
66  virtual const ACE_Message_Block* msg_payload() const;
67 
68  virtual SequenceNumber sequence() const;
69 
70  /// Is the element a "control" sample from the specified pub_id?
71  virtual bool is_control(GUID_t pub_id) const;
72  virtual bool owned_by_transport ();
73 
74  virtual bool is_request_ack() const { return header_.message_id_ == REQUEST_ACK; }
75 
76  virtual bool is_last_fragment() const { return !header_.more_fragments(); }
77 
78 protected:
79 
80  virtual void release_element(bool dropped_by_transport);
81 
82 private:
83 
84  /// The publisher of the control message
86 
87  /// The TransportSendListener object to call back upon.
89 
90  /// The OpenDDS DCPS header for this control message
92 
93  /// The control message.
95 
96  /// If constructed from a DataSampleElement, keep it around for release
98 };
99 
100 } // namespace DCPS
101 } // namespace OpenDDS
102 
104 
105 #if defined (__ACE_INLINE__)
107 #endif /* __ACE_INLINE__ */
108 
109 #endif /* OPENDDS_DCPS_TRANSPORTSENDCONTROLELEMENT_H */
#define ACE_BEGIN_VERSIONED_NAMESPACE_DECL
virtual bool is_last_fragment() const
Is this QueueElement the last result of fragmentation?
#define OpenDDS_Dcps_Export
Definition: dcps_export.h:24
GUID_t publisher_id_
The publisher of the control message.
const TransportSendListener * listener() const
Message_Block_Ptr msg_
The control message.
Christopher Diggins *renamed files *fixing compilation errors *adding Visual C project file *removed make Max Lybbert *removed references to missing and unused header
Definition: CHANGELOG.txt:8
DataSampleHeader header_
The OpenDDS DCPS header for this control message.
A fixed-size allocator that caches items for quicker access but if the pool is exhausted it will use ...
#define ACE_END_VERSIONED_NAMESPACE_DECL
TransportSendListener * listener_
The TransportSendListener object to call back upon.
Cached_Allocator_With_Overflow< TransportSendControlElement, ACE_SYNCH_NULL_MUTEX > TransportSendControlElementAllocator
const DataSampleElement *const dcps_elem_
If constructed from a DataSampleElement, keep it around for release.
Sequence number abstraction. Only allows positive 64 bit values.
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28
Base wrapper class around a data/control sample to be sent.