| 25 | using namespace std; |
| 26 | |
| 27 | int |
| 28 | ACE_TMAIN(int argc, ACE_TCHAR* argv[]) |
| 29 | { |
| 30 | try { |
| 31 | DDS::DomainParticipantFactory_var dpf; |
| 32 | DDS::DomainParticipant_var participant; |
| 33 | |
| 34 | dpf = TheParticipantFactoryWithArgs(argc, argv); |
| 35 | participant = |
| 36 | dpf->create_participant(111, |
| 37 | PARTICIPANT_QOS_DEFAULT, |
| 38 | DDS::DomainParticipantListener::_nil(), |
| 39 | ::OpenDDS::DCPS::DEFAULT_STATUS_MASK); |
| 40 | if (CORBA::is_nil (participant.in ())) { |
| 41 | cerr << "create_participant failed." << endl; |
| 42 | return 1 ; |
| 43 | } |
| 44 | |
| 45 | MessageTypeSupportImpl::_var_type mts_servant = new MessageTypeSupportImpl; |
| 46 | |
| 47 | if (DDS::RETCODE_OK != mts_servant->register_type(participant.in (), |
| 48 | "")) { |
| 49 | cerr << "Failed to register the MessageTypeTypeSupport." << endl; |
| 50 | exit(1); |
| 51 | } |
| 52 | |
| 53 | CORBA::String_var type_name = mts_servant->get_type_name (); |
| 54 | |
| 55 | DDS::TopicQos topic_qos; |
| 56 | participant->get_default_topic_qos(topic_qos); |
| 57 | DDS::Topic_var topic = |
| 58 | participant->create_topic("Movie Discussion List", |
| 59 | type_name.in (), |
| 60 | topic_qos, |
| 61 | DDS::TopicListener::_nil(), |
| 62 | ::OpenDDS::DCPS::DEFAULT_STATUS_MASK); |
| 63 | if (CORBA::is_nil (topic.in ())) { |
| 64 | cerr << "Failed to create_topic." << endl; |
| 65 | exit(1); |
| 66 | } |
| 67 | |
| 68 | // Create the subscriber and attach to the corresponding |
| 69 | // transport. |
| 70 | DDS::Subscriber_var sub = |
| 71 | participant->create_subscriber(SUBSCRIBER_QOS_DEFAULT, |
| 72 | DDS::SubscriberListener::_nil(), |
| 73 | ::OpenDDS::DCPS::DEFAULT_STATUS_MASK); |
| 74 | if (CORBA::is_nil (sub.in ())) { |
| 75 | cerr << "Failed to create_subscriber." << endl; |
| 76 | exit(1); |
| 77 | } |
| 78 | |
| 79 | // activate the listener |
| 80 | DDS::DataReaderListener_var listener (new DataReaderListenerImpl); |
| 81 | if (CORBA::is_nil (listener.in ())) { |
| 82 | cerr << "listener is nil." << endl; |
| 83 | exit(1); |
| 84 | } |
nothing calls this directly
no test coverage detected