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

Function read

performance-tests/DCPS/UDPNoKeyTest/Reader.cpp:14–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12
13template<class Tseq, class R, class R_var, class R_ptr>
14::DDS::ReturnCode_t read (TestStats* stats,
15 ::DDS::Subscriber_ptr subscriber,
16 ::DDS::DataReader_ptr reader)
17{
18 R_var pt_dr
19 = R::_narrow(reader);
20 if (CORBA::is_nil (pt_dr.in ()))
21 {
22 ACE_ERROR ((LM_ERROR,
23 ACE_TEXT("(%P|%t) _narrow failed.\n")));
24 throw TestException() ;
25 }
26
27 const ::CORBA::Long max_read_samples = 100;
28 Tseq samples(max_read_samples);
29 ::DDS::SampleInfoSeq infos(max_read_samples);
30
31 ACE_Array<bool> pub_finished(stats->num_publishers_);
32 for (unsigned j =0; j < stats->num_publishers_; j++)
33 {
34 pub_finished[j] = false;
35 }
36
37
38 // wait for data to become available
39 // so we know to start reading
40 if (!Reader::wait_for_data(subscriber, 10))
41 ACE_ERROR_RETURN((LM_ERROR,
42 "ERROR: waited too long for the first sample\n"),
43 -2);
44
45 int num_reads = 0;
46 int zero_reads = 0;
47 DDS::ReturnCode_t status;
48 ::DDS::SampleRejectedStatus rejected;
49 if (pt_dr->get_sample_rejected_status (rejected) != ::DDS::RETCODE_OK)
50 {
51 ACE_ERROR_RETURN((LM_ERROR,
52 "ERROR: failed to get sample rejected status\n"),
53 -2);
54 }
55
56 ::DDS::SampleLostStatus lost;
57 if (pt_dr->get_sample_lost_status (lost) != ::DDS::RETCODE_OK)
58 {
59 ACE_ERROR_RETURN((LM_ERROR,
60 "ERROR: failed to get sample lost status\n"),
61 -2);
62 }
63
64
65 bool end_messages = false;
66
67 while ( !stats->all_packets_received () && ! end_messages )
68 {
69
70 // very slow status = pt_dr->read_next_sample(sample, si) ;
71

Callers

nothing calls this directly

Calls 10

TestExceptionClass · 0.70
wait_for_dataFunction · 0.50
inMethod · 0.45
all_packets_receivedMethod · 0.45
readMethod · 0.45
lengthMethod · 0.45
samples_receivedMethod · 0.45
finishedMethod · 0.45

Tested by

no test coverage detected