OpenDDS  Snapshot(2023/04/28-20:55)
PublisherMonitorImpl.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 "PublisherMonitorImpl.h"
9 #include "monitorC.h"
10 #include "monitorTypeSupportImpl.h"
11 #include "dds/DCPS/PublisherImpl.h"
12 #include <dds/DdsDcpsInfrastructureC.h>
14 
16 
17 namespace OpenDDS {
18 namespace DCPS {
19 
20 
22  OpenDDS::DCPS::PublisherReportDataWriter_ptr pub_writer)
23  : pub_(pub),
24  pub_writer_(PublisherReportDataWriter::_duplicate(pub_writer))
25 {
26 }
27 
29 {
30 }
31 
32 void
34  if (!CORBA::is_nil(this->pub_writer_.in())) {
36  report.handle = pub_->get_instance_handle();
37  DDS::DomainParticipant_var dp = pub_->get_participant();
38  OpenDDS::DCPS::DomainParticipantImpl* dpi = dynamic_cast<DomainParticipantImpl*>(dp.in());
39  if (!dpi) {
40  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) PublisherMonitorImpl::report():")
41  ACE_TEXT(" failed to obtain DomainParticipantImpl.\n")));
42  return;
43  }
44  report.dp_id = dpi->get_id();
45  TransportImpl_rch ti; //TODO: transport = pub_->get_transport_impl();
46  // TODO: remove/replace
47  report.transport_id = 0;
48  PublisherImpl::PublicationIdVec writers;
49  pub_->get_publication_ids(writers);
50  CORBA::ULong length = 0;
51  report.writers.length(static_cast<CORBA::ULong>(writers.size()));
52  for (PublisherImpl::PublicationIdVec::iterator iter = writers.begin();
53  iter != writers.end();
54  ++iter) {
55  report.writers[length++] = *iter;
56  }
57  this->pub_writer_->write(report, DDS::HANDLE_NIL);
58  }
59 }
60 
61 
62 } // namespace DCPS
63 } // namespace OpenDDS
64 
Implements the OpenDDS::DCPS::DomainParticipant interfaces.
#define ACE_ERROR(X)
OpenDDS::DCPS::PublisherReportDataWriter_var pub_writer_
const InstanceHandle_t HANDLE_NIL
PublisherMonitorImpl(PublisherImpl *pub, OpenDDS::DCPS::PublisherReportDataWriter_ptr pub_writer)
T * _duplicate(T *st)
key GUID_t dp_id
GUID of the Domain Participant this Publisher belongs to.
Definition: monitor.idl:90
Implements the OpenDDS::DCPS::Publisher interfaces.
Definition: PublisherImpl.h:38
key DDS::InstanceHandle_t handle
Instance handle of this Publisher. Unique within the DP.
Definition: monitor.idl:88
ACE_CDR::ULong ULong
ACE_TEXT("TCP_Factory")
void get_publication_ids(PublicationIdVec &pubs)
virtual DDS::InstanceHandle_t get_instance_handle()
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
LM_ERROR
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28
Boolean is_nil(T x)
virtual DDS::DomainParticipant_ptr get_participant()