SubscriberMonitorImpl.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 "SubscriberMonitorImpl.h"
00009 #include "monitorC.h"
00010 #include "monitorTypeSupportImpl.h"
00011 #include "dds/DCPS/SubscriberImpl.h"
00012 #include <dds/DdsDcpsInfrastructureC.h>
00013 #include <dds/DCPS/DomainParticipantImpl.h>
00014 
00015 namespace OpenDDS {
00016 namespace DCPS {
00017 
00018 
00019 SubscriberMonitorImpl::SubscriberMonitorImpl(SubscriberImpl* sub,
00020               OpenDDS::DCPS::SubscriberReportDataWriter_ptr sub_writer)
00021   : sub_(sub),
00022     sub_writer_(SubscriberReportDataWriter::_duplicate(sub_writer))
00023 {
00024 }
00025 
00026 SubscriberMonitorImpl::~SubscriberMonitorImpl()
00027 {
00028 }
00029 
00030 void
00031 SubscriberMonitorImpl::report() {
00032   if (!CORBA::is_nil(this->sub_writer_.in())) {
00033     SubscriberReport report;
00034     report.handle = sub_->get_instance_handle();
00035     DDS::DomainParticipant_var dp = sub_->get_participant();
00036     report.dp_id   = dynamic_cast<DomainParticipantImpl*>(dp.in())->get_id();
00037     TransportImpl_rch ti; //TODO: transport    = sub_->get_transport_impl();
00038     // TODO: remove transport_id and replace with name
00039     report.transport_id = 0;
00040     SubscriberImpl::SubscriptionIdVec readers;
00041     sub_->get_subscription_ids(readers);
00042     CORBA::ULong length = 0;
00043     report.readers.length(static_cast<CORBA::ULong>(readers.size()));
00044     for (SubscriberImpl::SubscriptionIdVec::iterator iter = readers.begin();
00045          iter != readers.end();
00046          ++iter) {
00047       report.readers[length++] = *iter;
00048     }
00049     this->sub_writer_->write(report, DDS::HANDLE_NIL);
00050   }
00051 }
00052 
00053 
00054 } // namespace DCPS
00055 } // namespace OpenDDS
00056 

Generated on Fri Feb 12 20:05:27 2016 for OpenDDS by  doxygen 1.4.7