| 256 | }; |
| 257 | |
| 258 | int run(int argc, ACE_TCHAR* argv[]) |
| 259 | { |
| 260 | int ret_val = 0; |
| 261 | try { |
| 262 | TransportConfig_rch transport_config = |
| 263 | TheTransportRegistry->create_config("default_rtps_transport_config"); |
| 264 | TransportInst_rch transport_inst = |
| 265 | TheTransportRegistry->create_inst("default_rtps_transport", "rtps_udp"); |
| 266 | transport_config->instances_.push_back(transport_inst); |
| 267 | TheTransportRegistry->global_config(transport_config); |
| 268 | |
| 269 | DDS::DomainParticipantFactory_var dpf = |
| 270 | TheParticipantFactoryWithArgs(argc, argv); |
| 271 | ret_val = parse_args(argc, argv); |
| 272 | if (ret_val) { |
| 273 | return ret_val; |
| 274 | } |
| 275 | |
| 276 | OpenDDS::RTPS::RtpsDiscovery_rch disc = |
| 277 | make_rch<OpenDDS::RTPS::RtpsDiscovery>("rtps_disc"); |
| 278 | disc->use_xtypes(OpenDDS::RTPS::RtpsDiscoveryConfig::XTYPES_COMPLETE); |
| 279 | Service_Participant* const service = TheServiceParticipant; |
| 280 | service->add_discovery(static_rchandle_cast<Discovery>(disc)); |
| 281 | service->set_repo_domain(domainid, disc->key()); |
| 282 | |
| 283 | // Create DomainParticipant |
| 284 | DDS::DomainParticipant_var participant = |
| 285 | dpf->create_participant(domainid, |
| 286 | PARTICIPANT_QOS_DEFAULT, |
| 287 | 0, |
| 288 | DEFAULT_STATUS_MASK); |
| 289 | |
| 290 | if (!participant) { |
| 291 | if (log_level >= LogLevel::Error) { |
| 292 | ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: main(): create_participant failed!\n")); |
| 293 | } |
| 294 | return 1; |
| 295 | } |
| 296 | |
| 297 | DDS::GuardCondition_var gc = new DDS::GuardCondition; |
| 298 | DDS::WaitSet_var ws = new DDS::WaitSet; |
| 299 | DDS::ReturnCode_t ret = ws->attach_condition(gc); |
| 300 | { |
| 301 | DDS::Topic_var topic = |
| 302 | service->create_typeless_topic(participant, |
| 303 | topic_name.c_str(), |
| 304 | type_name.c_str(), |
| 305 | true, |
| 306 | TOPIC_QOS_DEFAULT, |
| 307 | 0, |
| 308 | DEFAULT_STATUS_MASK); |
| 309 | |
| 310 | if (!topic) { |
| 311 | if (log_level >= LogLevel::Error) { |
| 312 | ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: main(): create_topic failed!\n")); |
| 313 | } |
| 314 | return 1; |
| 315 | } |
no test coverage detected