OpenDDS  Snapshot(2023/04/28-20:55)
TransactionalRtpsSendQueue.h
Go to the documentation of this file.
1 /*
2  * Distributed under the OpenDDS License.
3  * See: http://www.opendds.org/license.html
4  */
5 
6 #ifndef OPENDDS_DCPS_TRANSPORT_RTPS_UDP_TRANSACTIONALRTPSSENDQUEUE_H
7 #define OPENDDS_DCPS_TRANSPORT_RTPS_UDP_TRANSACTIONALRTPSSENDQUEUE_H
8 
9 #include "Rtps_Udp_Export.h"
11 
12 #include "MetaSubmessage.h"
13 
15 
16 namespace OpenDDS {
17 namespace DCPS {
18 
19 /**
20 * A Transactional Send Queue Class For MetaSubmessages
21 *
22 * This class is designed to collect submessages from various threads
23 * in a transactional way so they can be more efficiently bundled.
24 */
26 public:
28 
29  /// Add a single submessage to the queue
30  /// Returns true if the queue was empty.
31  bool enqueue(const MetaSubmessage& ms);
32 
33  /// Add a vector of submessages to the queue
34  /// Returns true if the queue was empty and now not empty.
35  bool enqueue(const MetaSubmessageVec& vec);
36 
37  /// Signal that a thread is beginning to send a sequence of submessages.
38  void begin_transaction();
39 
40  /// Indicate that the queue is ready to send after all pending transactions are complete.
41  void ready_to_send();
42 
43  /// Signal that a thread is ending a sequence of submessages.
44  /// This method will swap the provided vec with the pending queue if the queue is ready to send.
45  void end_transaction(MetaSubmessageVec& vec);
46 
47  /// Mark all queued submessage with the given source and destination as ignored.
48  void ignore(const GUID_t& local, const GUID_t& remote);
49 
50  /// Mark all queued submessage with the given destination (dst_guid_) as ignored.
51  void ignore_remote(const GUID_t& id);
52 
53  /// Mark all queued submessage with the given source (src_guid_) as ignored.
54  void ignore_local(const GUID_t& id);
55 
56 private:
57 
59 
60  MetaSubmessageVec queue_;
63 };
64 
65 } // namespace DCPS
66 } // namespace OpenDDS
67 
69 
70 #endif /* OPENDDS_DCPS_TRANSPORT_RTPS_UDP_TRANSACTIONALRTPSSENDQUEUE_H */
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28
#define OpenDDS_Rtps_Udp_Export