00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #include "TopicMonitorImpl.h" 00009 #include "monitorC.h" 00010 #include "monitorTypeSupportImpl.h" 00011 #include "dds/DCPS/TopicImpl.h" 00012 #include "dds/DCPS/DomainParticipantImpl.h" 00013 #include <dds/DdsDcpsInfrastructureC.h> 00014 00015 namespace OpenDDS { 00016 namespace DCPS { 00017 00018 00019 TopicMonitorImpl::TopicMonitorImpl(TopicImpl* topic, 00020 OpenDDS::DCPS::TopicReportDataWriter_ptr topic_writer) 00021 : topic_(topic), 00022 topic_writer_(TopicReportDataWriter::_duplicate(topic_writer)) 00023 { 00024 } 00025 00026 TopicMonitorImpl::~TopicMonitorImpl() 00027 { 00028 } 00029 00030 void 00031 TopicMonitorImpl::report() { 00032 if (!CORBA::is_nil(this->topic_writer_.in())) { 00033 TopicReport report; 00034 DDS::DomainParticipant_var dp = this->topic_->get_participant(); 00035 DomainParticipantImpl* dp_impl = 00036 dynamic_cast<DomainParticipantImpl*>(dp.in()); 00037 report.dp_id = dp_impl->get_id(); 00038 report.topic_id = this->topic_->get_id(); 00039 report.topic_name = this->topic_->get_name(); 00040 report.type_name = this->topic_->get_type_name(); 00041 this->topic_writer_->write(report, DDS::HANDLE_NIL); 00042 } 00043 } 00044 00045 00046 } // namespace DCPS 00047 } // namespace OpenDDS 00048