OpenDDS::DCPS::SPMonitorImpl Class Reference

#include <SPMonitorImpl.h>

Inheritance diagram for OpenDDS::DCPS::SPMonitorImpl:

Inheritance graph
[legend]
Collaboration diagram for OpenDDS::DCPS::SPMonitorImpl:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SPMonitorImpl (MonitorFactoryImpl *monitor_factory, Service_Participant *sp)
virtual ~SPMonitorImpl ()
virtual void report ()

Private Attributes

MonitorFactoryImplmonitor_factory_
OpenDDS::DCPS::ServiceParticipantReportDataWriter_var sp_writer_
std::string hostname_
pid_t pid_

Detailed Description

Definition at line 24 of file SPMonitorImpl.h.


Constructor & Destructor Documentation

OpenDDS::DCPS::SPMonitorImpl::SPMonitorImpl ( MonitorFactoryImpl monitor_factory,
Service_Participant sp 
)

Definition at line 20 of file SPMonitorImpl.cpp.

References hostname_, and pid_.

00022     : monitor_factory_(monitor_factory)
00023 {
00024   char host[256];
00025   ACE_OS::hostname(host, 256);
00026   hostname_ = host;
00027   pid_ = ACE_OS::getpid();
00028 }

OpenDDS::DCPS::SPMonitorImpl::~SPMonitorImpl (  )  [virtual]

Definition at line 30 of file SPMonitorImpl.cpp.

00031 {
00032 }


Member Function Documentation

void OpenDDS::DCPS::SPMonitorImpl::report (  )  [virtual]

Implements OpenDDS::DCPS::Monitor.

Definition at line 35 of file SPMonitorImpl.cpp.

References OpenDDS::DCPS::MonitorFactoryImpl::get_sp_writer(), DDS::HANDLE_NIL, hostname_, monitor_factory_, pid_, sp_writer_, and TheParticipantFactory.

00036 {
00037   if (CORBA::is_nil(this->sp_writer_.in())) {
00038     this->sp_writer_ = this->monitor_factory_->get_sp_writer();
00039   }
00040 
00041   // If the SP writer is not available, it is too soon to report
00042   if (!CORBA::is_nil(this->sp_writer_.in())) {
00043     ServiceParticipantReport report;
00044     report.host = this->hostname_.c_str();
00045     report.pid  = this->pid_;
00046     DDS::DomainParticipantFactory_var pf = TheParticipantFactory;
00047     const DomainParticipantFactoryImpl::DPMap& participants =
00048       dynamic_cast<DomainParticipantFactoryImpl*>(pf.in())->participants();
00049     CORBA::ULong length = 0;
00050     for (DomainParticipantFactoryImpl::DPMap::const_iterator mapIter = participants.begin();
00051          mapIter != participants.end();
00052          ++mapIter) {
00053       for (DomainParticipantFactoryImpl::DPSet::const_iterator iter = mapIter->second.begin();
00054            iter != mapIter->second.end();
00055            ++iter) {
00056         report.domain_participants.length(length+1);
00057         report.domain_participants[length] = iter->svt_->get_id();
00058         length++;
00059       }
00060     }
00061     length = 0;
00062     // TODO: Redo the transport-related monitor publishing here...
00063     //const TransportFactory::ImplMap& transports =
00064     //  TransportFactory::instance()->get_transport_impl_map();
00065     //report.transports.length(static_cast<CORBA::ULong>(transports.size()));
00066     //for (TransportFactory::ImplMap::const_iterator mapIter = transports.begin();
00067     //     mapIter != transports.end();
00068     //     ++mapIter) {
00069     //  report.transports[length++] = mapIter->first;
00070     //}
00071     this->sp_writer_->write(report, DDS::HANDLE_NIL);
00072   }
00073 }


Member Data Documentation

std::string OpenDDS::DCPS::SPMonitorImpl::hostname_ [private]

Definition at line 34 of file SPMonitorImpl.h.

Referenced by report(), and SPMonitorImpl().

MonitorFactoryImpl* OpenDDS::DCPS::SPMonitorImpl::monitor_factory_ [private]

Definition at line 32 of file SPMonitorImpl.h.

Referenced by report().

pid_t OpenDDS::DCPS::SPMonitorImpl::pid_ [private]

Definition at line 35 of file SPMonitorImpl.h.

Referenced by report(), and SPMonitorImpl().

OpenDDS::DCPS::ServiceParticipantReportDataWriter_var OpenDDS::DCPS::SPMonitorImpl::sp_writer_ [private]

Definition at line 33 of file SPMonitorImpl.h.

Referenced by report().


The documentation for this class was generated from the following files:
Generated on Fri Feb 12 20:06:43 2016 for OpenDDS by  doxygen 1.4.7