OpenDDS  Snapshot(2023/04/28-20:55)
TransactionalRtpsSendQueue.cpp
Go to the documentation of this file.
1 /*
2  * Distributed under the OpenDDS License.
3  * See: http://www.opendds.org/license.html
4  */
5 
7 
9 
10 namespace OpenDDS {
11 namespace DCPS {
12 
14  : ready_to_send_(false)
15  , active_transaction_count_(0)
16 {
17 }
18 
20 {
22  const bool empty_before = queue_.empty();
23  queue_.push_back(ms);
24  return empty_before;
25 }
26 
27 bool TransactionalRtpsSendQueue::enqueue(const MetaSubmessageVec& vec)
28 {
30  const bool empty_before = queue_.empty();
31  for (MetaSubmessageVec::const_iterator it = vec.begin(), limit = vec.end(); it != limit; ++it) {
32  queue_.push_back(*it);
33  }
34  return empty_before && !queue_.empty();
35 }
36 
38 {
41 }
42 
44 {
46  ready_to_send_ = true;
47 }
48 
49 
50 void TransactionalRtpsSendQueue::end_transaction(MetaSubmessageVec& vec)
51 {
52  vec.clear();
53 
57  queue_.swap(vec);
58  ready_to_send_ = false;
59  }
60 }
61 
62 void TransactionalRtpsSendQueue::ignore(const GUID_t& local, const GUID_t& remote)
63 {
65  for (MetaSubmessageVec::iterator pos = queue_.begin(), limit = queue_.end(); pos != limit; ++pos) {
66  if (pos->src_guid_ == local && pos->dst_guid_ == remote) {
67  pos->ignore_ = true;
68  }
69  }
70 }
71 
73 {
75  for (MetaSubmessageVec::iterator pos = queue_.begin(), limit = queue_.end(); pos != limit; ++pos) {
76  if (pos->dst_guid_ == id) {
77  pos->ignore_ = true;
78  }
79  }
80 }
81 
83 {
85  for (MetaSubmessageVec::iterator pos = queue_.begin(), limit = queue_.end(); pos != limit; ++pos) {
86  if (pos->src_guid_ == id) {
87  pos->ignore_ = true;
88  }
89  }
90 }
91 
92 } // namespace DCPS
93 } // namespace OpenDDS
94 
void ready_to_send()
Indicate that the queue is ready to send after all pending transactions are complete.
void begin_transaction()
Signal that a thread is beginning to send a sequence of submessages.
void ignore(const GUID_t &local, const GUID_t &remote)
Mark all queued submessage with the given source and destination as ignored.
void ignore_remote(const GUID_t &id)
Mark all queued submessage with the given destination (dst_guid_) as ignored.
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28
void ignore_local(const GUID_t &id)
Mark all queued submessage with the given source (src_guid_) as ignored.