OpenDDS  Snapshot(2023/04/28-20:55)
DPMonitorImpl.cpp
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 #include "DPMonitorImpl.h"
9 #include "monitorC.h"
10 #include "monitorTypeSupportImpl.h"
12 #include <dds/DdsDcpsInfrastructureC.h>
13 
15 
16 namespace OpenDDS {
17 namespace DCPS {
18 
20  OpenDDS::DCPS::DomainParticipantReportDataWriter_ptr dp_writer)
21  : dp_(dp)
22  , dp_writer_(DomainParticipantReportDataWriter::_duplicate(dp_writer))
23 {
24  char host[256];
25  ACE_OS::hostname(host, 256);
26  hostname_ = host;
27  pid_ = ACE_OS::getpid();
28 }
29 
31 {
32 }
33 
34 void
36  if (!CORBA::is_nil(dp_writer_.in())) {
38  report.host = hostname_.c_str();
39  report.pid = pid_;
40  report.dp_id = dp_->get_id();
41  report.domain_id = dp_->get_domain_id();
42  DomainParticipantImpl::TopicIdVec topics;
43  dp_->get_topic_ids(topics);
44  CORBA::ULong length = 0;
45  report.topics.length(static_cast<CORBA::ULong>(topics.size()));
46  for (DomainParticipantImpl::TopicIdVec::iterator iter = topics.begin();
47  iter != topics.end();
48  ++iter) {
49  report.topics[length++] = *iter;
50  }
51  dp_writer_->write(report, DDS::HANDLE_NIL);
52  }
53 }
54 
55 } // namespace DCPS
56 } // namespace OpenDDS
57 
Implements the OpenDDS::DCPS::DomainParticipant interfaces.
const InstanceHandle_t HANDLE_NIL
T * _duplicate(T *st)
ACE_CDR::ULong ULong
int hostname(char name[], size_t maxnamelen)
OpenDDS::DCPS::DomainParticipantReportDataWriter_var dp_writer_
Definition: DPMonitorImpl.h:33
key GUID_t dp_id
GUID of the Domain Participant.
Definition: monitor.idl:68
DomainParticipantImpl * dp_
Definition: DPMonitorImpl.h:32
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
DPMonitorImpl(DomainParticipantImpl *dp, OpenDDS::DCPS::DomainParticipantReportDataWriter_ptr dp_writer)
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28
pid_t getpid(void)
Boolean is_nil(T x)