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

Function ACE_TMAIN

tests/DCPS/Reliability/sub/Subscriber.cpp:76–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74} // namespace
75
76int
77ACE_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);

Callers

nothing calls this directly

Calls 12

set_num_sleepsMethod · 0.80
set_sleep_lengthMethod · 0.80
_tao_print_exceptionMethod · 0.80
parse_argsFunction · 0.70
createParticipantFunction · 0.50
createTopicFunction · 0.50
createSubscriberFunction · 0.50
createDataReaderFunction · 0.50
cleanupFunction · 0.50
sample_countMethod · 0.45
expected_countMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected