OpenDDS  Snapshot(2023/04/28-20:55)
TopicMonitorImpl.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 "TopicMonitorImpl.h"
9 #include "monitorC.h"
10 #include "monitorTypeSupportImpl.h"
11 #include "dds/DCPS/TopicImpl.h"
13 #include <dds/DdsDcpsInfrastructureC.h>
14 
16 
17 namespace OpenDDS {
18 namespace DCPS {
19 
20 
22  OpenDDS::DCPS::TopicReportDataWriter_ptr topic_writer)
23  : topic_(topic),
24  topic_writer_(TopicReportDataWriter::_duplicate(topic_writer))
25 {
26 }
27 
29 {
30 }
31 
32 void
34  if (!CORBA::is_nil(this->topic_writer_.in())) {
36  DDS::DomainParticipant_var dp = this->topic_->get_participant();
37  DomainParticipantImpl* dp_impl =
38  dynamic_cast<DomainParticipantImpl*>(dp.in());
39  if (dp_impl) {
40  report.dp_id = dp_impl->get_id();
41  report.topic_id = this->topic_->get_id();
42  report.topic_name = this->topic_->get_name();
43  report.type_name = this->topic_->get_type_name();
44  this->topic_writer_->write(report, DDS::HANDLE_NIL);
45  } else {
46  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) TopicMonitorImpl::report(): ")
47  ACE_TEXT("failed to obtain DomainParticipantImpl.\n")));
48  }
49  }
50 }
51 
52 
53 } // namespace DCPS
54 } // namespace OpenDDS
55 
Implements the OpenDDS::DCPS::DomainParticipant interfaces.
#define ACE_ERROR(X)
key GUID_t topic_id
GUID for the Topic.
Definition: monitor.idl:79
const InstanceHandle_t HANDLE_NIL
TopicMonitorImpl(TopicImpl *topic, OpenDDS::DCPS::TopicReportDataWriter_ptr topic_writer)
GUID_t dp_id
GUID of the Domain Participant this Topic belongs to.
Definition: monitor.idl:77
OpenDDS::DCPS::TopicReportDataWriter_var topic_writer_
T * _duplicate(T *st)
Implements the DDS::Topic interface.
Definition: TopicImpl.h:37
ACE_TEXT("TCP_Factory")
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
LM_ERROR
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28
virtual DDS::DomainParticipant_ptr get_participant()
Boolean is_nil(T x)
GUID_t get_id() const
Definition: TopicImpl.cpp:172