MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / ACE_TMAIN

Function ACE_TMAIN

tests/DCPS/Monitor/monitor.cpp:64–340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64int
65ACE_TMAIN(int argc, ACE_TCHAR *argv[])
66{
67 try {
68 // Initialize DomainParticipantFactory
69 DDS::DomainParticipantFactory_var dpf =
70 TheParticipantFactoryWithArgs(argc, argv);
71
72 // Create DomainParticipant
73 DDS::DomainParticipant_var participant =
74 dpf->create_participant(OpenDDS::Monitor::MONITOR_DOMAIN_ID,
75 PARTICIPANT_QOS_DEFAULT,
76 DDS::DomainParticipantListener::_nil(),
77 OpenDDS::DCPS::DEFAULT_STATUS_MASK);
78
79 if (CORBA::is_nil(participant.in())) {
80 ACE_ERROR_RETURN((LM_ERROR,
81 ACE_TEXT("%N:%l main()")
82 ACE_TEXT(" ERROR: create_participant() failed!\n")), -1);
83 }
84
85 // Create Subscriber
86 DDS::Subscriber_var sub =
87 participant->create_subscriber(SUBSCRIBER_QOS_DEFAULT,
88 DDS::SubscriberListener::_nil(),
89 OpenDDS::DCPS::DEFAULT_STATUS_MASK);
90
91 if (CORBA::is_nil(sub.in())) {
92 ACE_ERROR_RETURN((LM_ERROR,
93 ACE_TEXT("%N:%l main()")
94 ACE_TEXT(" ERROR: create_subscriber() failed!\n")), -1);
95 }
96
97 DDS::DataReaderQos dr_qos;
98 sub->get_default_datareader_qos(dr_qos);
99 dr_qos.durability.kind = DDS::TRANSIENT_LOCAL_DURABILITY_QOS;
100 DDS::DataReader_var reader;
101
102 // Register for OpenDDS::Monitor::ServiceParticipantReport
103 OpenDDS::Monitor::ServiceParticipantReportTypeSupport_var sp_ts =
104 new OpenDDS::Monitor::ServiceParticipantReportTypeSupportImpl();
105 if (sp_ts->register_type(participant.in(), "") != DDS::RETCODE_OK) {
106 ACE_ERROR_RETURN((LM_ERROR,
107 ACE_TEXT("%N:%l main()")
108 ACE_TEXT(" ERROR: register_type() failed!\n")), -1);
109 }
110 CORBA::String_var sp_type_name = sp_ts->get_type_name();
111 DDS::DataReaderListener_var sp_drl(new SPMDataReaderListenerImpl);
112 reader = create_data_reader(participant.in(),
113 sub.in(),
114 sp_type_name.in(),
115 OpenDDS::Monitor::SERVICE_PARTICIPANT_MONITOR_TOPIC,
116 dr_qos,
117 sp_drl);
118 if (CORBA::is_nil(reader.in())) {
119 ACE_ERROR_RETURN((LM_ERROR,
120 ACE_TEXT("%N:%l main()")
121 ACE_TEXT(" ERROR: create_datareader() failed!\n")), -1);

Callers

nothing calls this directly

Calls 12

delete_participantMethod · 0.80
_tao_print_exceptionMethod · 0.80
create_data_readerFunction · 0.70
create_participantMethod · 0.45
inMethod · 0.45
create_subscriberMethod · 0.45
register_typeMethod · 0.45
get_type_nameMethod · 0.45
closeMethod · 0.45
shutdownMethod · 0.45

Tested by

no test coverage detected