| 74 | } // namespace |
| 75 | |
| 76 | int |
| 77 | ACE_TMAIN(int argc, ACE_TCHAR *argv[]) |
| 78 | { |
| 79 | int status = -1; |
| 80 | try { |
| 81 | // Initialize DomainParticipantFactory, handling command line args |
| 82 | DDS::DomainParticipantFactory_var dpf = |
| 83 | TheParticipantFactoryWithArgs(argc, argv); |
| 84 | |
| 85 | parse_args(argc, argv); |
| 86 | |
| 87 | // Create Listener |
| 88 | DataReaderListenerImpl* listener_impl = NULL; |
| 89 | if (take_next) { |
| 90 | listener_impl = new TakeNextReaderListenerImpl; |
| 91 | } else if (take) { |
| 92 | listener_impl = new SeqReaderListenerImpl; |
| 93 | } else if (zero_copy) { |
| 94 | listener_impl = new ZeroCopyReaderListenerImpl; |
| 95 | } else { |
| 96 | listener_impl = new TakeNextReaderListenerImpl; |
| 97 | } |
| 98 | |
| 99 | listener_impl->set_num_sleeps(num_sleeps); |
| 100 | listener_impl->set_sleep_length(sleep_time); |
| 101 | |
| 102 | // Create domain participant |
| 103 | DDS::DomainParticipant_var participant = createParticipant(dpf); |
| 104 | |
| 105 | // Register type support and create topic |
| 106 | DDS::Topic_var topic = createTopic(participant); |
| 107 | |
| 108 | // Create subscriber |
| 109 | DDS::Subscriber_var subscriber = createSubscriber(participant); |
| 110 | |
| 111 | DDS::DataReaderListener_var listener(listener_impl); |
| 112 | |
| 113 | // Create DataReader with the listener attached |
| 114 | DDS::DataReader_var reader = createDataReader(subscriber, topic, listener); |
| 115 | |
| 116 | std::cout << "Waiting for connection" << std::endl; |
| 117 | { |
| 118 | // Block until reader has associated with a writer |
| 119 | // but is no longer associated with any writer |
| 120 | OpenDDS::Model::ReaderSync rs(reader); |
| 121 | } |
| 122 | |
| 123 | if (listener_impl->sample_count() == listener_impl->expected_count()) { |
| 124 | std::cout << "Got all " << listener_impl->sample_count() |
| 125 | << " samples" << std::endl; |
| 126 | status = 0; |
| 127 | } else { |
| 128 | std::cout << "ERROR: Got " << listener_impl->sample_count() |
| 129 | << " samples, expected " << listener_impl->expected_count() |
| 130 | << std::endl; |
| 131 | } |
| 132 | // Clean-up! |
| 133 | cleanup(participant, dpf); |
nothing calls this directly
no test coverage detected