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

#include <TransactionalRtpsSendQueue.h>

Collaboration diagram for OpenDDS::DCPS::TransactionalRtpsSendQueue:
Collaboration graph
[legend]

Public Member Functions

 TransactionalRtpsSendQueue ()
 
bool enqueue (const MetaSubmessage &ms)
 
bool enqueue (const MetaSubmessageVec &vec)
 
void begin_transaction ()
 Signal that a thread is beginning to send a sequence of submessages. More...
 
void ready_to_send ()
 Indicate that the queue is ready to send after all pending transactions are complete. More...
 
void end_transaction (MetaSubmessageVec &vec)
 
void ignore (const GUID_t &local, const GUID_t &remote)
 Mark all queued submessage with the given source and destination as ignored. More...
 
void ignore_remote (const GUID_t &id)
 Mark all queued submessage with the given destination (dst_guid_) as ignored. More...
 
void ignore_local (const GUID_t &id)
 Mark all queued submessage with the given source (src_guid_) as ignored. More...
 

Private Attributes

ACE_Thread_Mutex mutex_
 
MetaSubmessageVec queue_
 
bool ready_to_send_
 
size_t active_transaction_count_
 

Detailed Description

A Transactional Send Queue Class For MetaSubmessages

This class is designed to collect submessages from various threads in a transactional way so they can be more efficiently bundled.

Definition at line 25 of file TransactionalRtpsSendQueue.h.

Constructor & Destructor Documentation

◆ TransactionalRtpsSendQueue()

OpenDDS::DCPS::TransactionalRtpsSendQueue::TransactionalRtpsSendQueue ( )

Member Function Documentation

◆ begin_transaction()

void OpenDDS::DCPS::TransactionalRtpsSendQueue::begin_transaction ( )

◆ end_transaction()

void OpenDDS::DCPS::TransactionalRtpsSendQueue::end_transaction ( MetaSubmessageVec &  vec)

Signal that a thread is ending a sequence of submessages. This method will swap the provided vec with the pending queue if the queue is ready to send.

Definition at line 50 of file TransactionalRtpsSendQueue.cpp.

References active_transaction_count_, mutex_, queue_, and ready_to_send_.

Referenced by OpenDDS::DCPS::RtpsUdpDataLink::disable_response_queue().

◆ enqueue() [1/2]

bool OpenDDS::DCPS::TransactionalRtpsSendQueue::enqueue ( const MetaSubmessage ms)

Add a single submessage to the queue Returns true if the queue was empty.

Definition at line 19 of file TransactionalRtpsSendQueue.cpp.

References mutex_, and queue_.

Referenced by OpenDDS::DCPS::RtpsUdpDataLink::queue_submessages().

20 {
22  const bool empty_before = queue_.empty();
23  queue_.push_back(ms);
24  return empty_before;
25 }

◆ enqueue() [2/2]

bool OpenDDS::DCPS::TransactionalRtpsSendQueue::enqueue ( const MetaSubmessageVec &  vec)

Add a vector of submessages to the queue Returns true if the queue was empty and now not empty.

Definition at line 27 of file TransactionalRtpsSendQueue.cpp.

References mutex_, and queue_.

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 }

◆ ignore()

void OpenDDS::DCPS::TransactionalRtpsSendQueue::ignore ( const GUID_t local,
const GUID_t remote 
)

Mark all queued submessage with the given source and destination as ignored.

Definition at line 62 of file TransactionalRtpsSendQueue.cpp.

References mutex_, and queue_.

Referenced by OpenDDS::DCPS::RtpsUdpDataLink::associated().

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 }

◆ ignore_local()

void OpenDDS::DCPS::TransactionalRtpsSendQueue::ignore_local ( const GUID_t id)

Mark all queued submessage with the given source (src_guid_) as ignored.

Definition at line 82 of file TransactionalRtpsSendQueue.cpp.

References mutex_, OPENDDS_END_VERSIONED_NAMESPACE_DECL, and queue_.

Referenced by OpenDDS::DCPS::RtpsUdpDataLink::client_stop().

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 }

◆ ignore_remote()

void OpenDDS::DCPS::TransactionalRtpsSendQueue::ignore_remote ( const GUID_t id)

Mark all queued submessage with the given destination (dst_guid_) as ignored.

Definition at line 72 of file TransactionalRtpsSendQueue.cpp.

References mutex_, and queue_.

Referenced by OpenDDS::DCPS::RtpsUdpDataLink::disassociated().

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 }

◆ ready_to_send()

void OpenDDS::DCPS::TransactionalRtpsSendQueue::ready_to_send ( )

Indicate that the queue is ready to send after all pending transactions are complete.

Definition at line 43 of file TransactionalRtpsSendQueue.cpp.

References mutex_, and ready_to_send_.

Referenced by OpenDDS::DCPS::RtpsUdpDataLink::harvest_send_queue().

Member Data Documentation

◆ active_transaction_count_

size_t OpenDDS::DCPS::TransactionalRtpsSendQueue::active_transaction_count_
private

Definition at line 62 of file TransactionalRtpsSendQueue.h.

Referenced by begin_transaction(), and end_transaction().

◆ mutex_

ACE_Thread_Mutex OpenDDS::DCPS::TransactionalRtpsSendQueue::mutex_
mutableprivate

◆ queue_

MetaSubmessageVec OpenDDS::DCPS::TransactionalRtpsSendQueue::queue_
private

◆ ready_to_send_

bool OpenDDS::DCPS::TransactionalRtpsSendQueue::ready_to_send_
private

Definition at line 61 of file TransactionalRtpsSendQueue.h.

Referenced by end_transaction(), and ready_to_send().


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