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

#include <TransportMonitorImpl.h>

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

Public Member Functions

 TransportMonitorImpl (TransportImpl *transport, OpenDDS::DCPS::TransportReportDataWriter_ptr transport_writer)
 
virtual ~TransportMonitorImpl ()
 
virtual void report ()
 
- Public Member Functions inherited from OpenDDS::DCPS::Monitor
 Monitor ()
 
virtual ~Monitor ()
 

Private Types

typedef std::vector< TransportReportTransportReportVec
 

Private Attributes

OpenDDS::DCPS::TransportReportDataWriter_var transport_writer_
 
std::string hostname_
 
pid_t pid_
 

Static Private Attributes

static ACE_Recursive_Thread_Mutex queue_lock_
 
static TransportReportVec queue_
 

Detailed Description

Definition at line 26 of file TransportMonitorImpl.h.

Member Typedef Documentation

◆ TransportReportVec

Definition at line 38 of file TransportMonitorImpl.h.

Constructor & Destructor Documentation

◆ TransportMonitorImpl()

OpenDDS::DCPS::TransportMonitorImpl::TransportMonitorImpl ( TransportImpl transport,
OpenDDS::DCPS::TransportReportDataWriter_ptr  transport_writer 
)

Definition at line 22 of file TransportMonitorImpl.cpp.

References _duplicate(), ACE_OS::getpid(), ACE_OS::hostname(), hostname_, and pid_.

24  : transport_writer_(TransportReportDataWriter::_duplicate(transport_writer))
25 {
26  char host[256];
27  ACE_OS::hostname(host, 256);
28  hostname_ = host;
29  pid_ = ACE_OS::getpid();
30 }
int hostname(char name[], size_t maxnamelen)
OpenDDS::DCPS::TransportReportDataWriter_var transport_writer_
pid_t getpid(void)

◆ ~TransportMonitorImpl()

OpenDDS::DCPS::TransportMonitorImpl::~TransportMonitorImpl ( )
virtual

Definition at line 32 of file TransportMonitorImpl.cpp.

33 {
34 }

Member Function Documentation

◆ report()

void OpenDDS::DCPS::TransportMonitorImpl::report ( )
virtual

Implements OpenDDS::DCPS::Monitor.

Definition at line 37 of file TransportMonitorImpl.cpp.

References DDS::HANDLE_NIL, OpenDDS::DCPS::TransportReport::host, hostname_, CORBA::is_nil(), OPENDDS_END_VERSIONED_NAMESPACE_DECL, OpenDDS::DCPS::TransportReport::pid, pid_, queue_, OpenDDS::DCPS::TransportReport::transport_id, OpenDDS::DCPS::TransportReport::transport_type, and transport_writer_.

37  {
38  // ACE_DEBUG((LM_DEBUG, "TransportMonitorImpl::report()\n"));
39  TransportReport report;
40  report.host = this->hostname_.c_str();
41  report.pid = this->pid_;
42  // TODO: remove/replace
43  report.transport_id = 0;
44  report.transport_type = "";
45  // ACE_GUARD(ACE_Recursive_Thread_Mutex, guard, queue_lock_);
46  if (!CORBA::is_nil(this->transport_writer_.in())) {
47  if (this->queue_.size()) {
48  // ACE_DEBUG((LM_DEBUG, "TransportMonitorImpl::report(): popping\n"));
49  for (unsigned int i = 0; i < this->queue_.size(); i++) {
50  // ACE_DEBUG((LM_DEBUG, "TransportMonitorImpl::report(): writing, id = %d\n",
51  // this->queue_[i].transport_id));
52  this->transport_writer_->write(this->queue_[i], DDS::HANDLE_NIL);
53  }
54  this->queue_.clear();
55  }
56  // ACE_DEBUG((LM_DEBUG, "TransportMonitorImpl::report(): writing, id = %d\n",
57  // report.transport_id));
58  this->transport_writer_->write(report, DDS::HANDLE_NIL);
59  } else {
60  // ACE_DEBUG((LM_DEBUG, "TransportMonitorImpl::report(): queueing, id = %d\n",
61  // report.transport_id));
62  queue_.push_back(report);
63  }
64 }
const InstanceHandle_t HANDLE_NIL
OpenDDS::DCPS::TransportReportDataWriter_var transport_writer_
Boolean is_nil(T x)

Member Data Documentation

◆ hostname_

std::string OpenDDS::DCPS::TransportMonitorImpl::hostname_
private

Definition at line 35 of file TransportMonitorImpl.h.

Referenced by report(), and TransportMonitorImpl().

◆ pid_

pid_t OpenDDS::DCPS::TransportMonitorImpl::pid_
private

Definition at line 36 of file TransportMonitorImpl.h.

Referenced by report(), and TransportMonitorImpl().

◆ queue_

TransportMonitorImpl::TransportReportVec OpenDDS::DCPS::TransportMonitorImpl::queue_
staticprivate

Definition at line 40 of file TransportMonitorImpl.h.

Referenced by report().

◆ queue_lock_

ACE_Recursive_Thread_Mutex OpenDDS::DCPS::TransportMonitorImpl::queue_lock_
staticprivate

Definition at line 39 of file TransportMonitorImpl.h.

◆ transport_writer_

OpenDDS::DCPS::TransportReportDataWriter_var OpenDDS::DCPS::TransportMonitorImpl::transport_writer_
private

Definition at line 34 of file TransportMonitorImpl.h.

Referenced by report().


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