PublisherMonitorImpl.cpp

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #include "PublisherMonitorImpl.h"
00009 #include "monitorC.h"
00010 #include "monitorTypeSupportImpl.h"
00011 #include "dds/DCPS/PublisherImpl.h"
00012 #include <dds/DdsDcpsInfrastructureC.h>
00013 #include <dds/DCPS/DomainParticipantImpl.h>
00014 
00015 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00016 
00017 namespace OpenDDS {
00018 namespace DCPS {
00019 
00020 
00021 PublisherMonitorImpl::PublisherMonitorImpl(PublisherImpl* pub,
00022               OpenDDS::DCPS::PublisherReportDataWriter_ptr pub_writer)
00023   : pub_(pub),
00024     pub_writer_(PublisherReportDataWriter::_duplicate(pub_writer))
00025 {
00026 }
00027 
00028 PublisherMonitorImpl::~PublisherMonitorImpl()
00029 {
00030 }
00031 
00032 void
00033 PublisherMonitorImpl::report() {
00034   if (!CORBA::is_nil(this->pub_writer_.in())) {
00035     PublisherReport report;
00036     report.handle = pub_->get_instance_handle();
00037     DDS::DomainParticipant_var dp = pub_->get_participant();
00038     OpenDDS::DCPS::DomainParticipantImpl* dpi = dynamic_cast<DomainParticipantImpl*>(dp.in());
00039     if (!dpi) {
00040       ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) PublisherMonitorImpl::report():")
00041         ACE_TEXT(" failed to obtain DomainParticipantImpl.\n")));
00042       return;
00043     }
00044     report.dp_id   = dpi->get_id();
00045     TransportImpl_rch ti; //TODO: transport    = pub_->get_transport_impl();
00046     // TODO: remove/replace
00047     report.transport_id = 0;
00048     PublisherImpl::PublicationIdVec writers;
00049     pub_->get_publication_ids(writers);
00050     CORBA::ULong length = 0;
00051     report.writers.length(static_cast<CORBA::ULong>(writers.size()));
00052     for (PublisherImpl::PublicationIdVec::iterator iter = writers.begin();
00053          iter != writers.end();
00054          ++iter) {
00055       report.writers[length++] = *iter;
00056     }
00057     this->pub_writer_->write(report, DDS::HANDLE_NIL);
00058   }
00059 }
00060 
00061 
00062 } // namespace DCPS
00063 } // namespace OpenDDS
00064 
00065 OPENDDS_END_VERSIONED_NAMESPACE_DECL
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1