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

Function write

performance-tests/DCPS/UDPNoKeyTest/Writer.cpp:24–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22
23template<class T, class W, class W_var, class W_ptr>
24void write (long id,
25 int size,
26 int num_messages,
27 unsigned throttle_factor_,
28 ::DDS::DataWriter_ptr writer)
29{
30 T data;
31 data.data_source = id;
32 data.values.length(size);
33
34 for (int i = 0; i < size; i ++)
35 {
36 data.values[i] = (float) i;
37 }
38
39 W_var pt_dw
40 = W::_narrow(writer);
41 ACE_ASSERT (! CORBA::is_nil (pt_dw.in ()));
42
43 //SHH remove this kludge when the transport is fixed.
44 ACE_OS::sleep(2); // ensure that the connection has been fully established
45 ACE_DEBUG((LM_DEBUG,
46 ACE_TEXT("(%P|%t) %T Writer::svc starting to write.\n")));
47
48 ::DDS::InstanceHandle_t handle
49 = pt_dw->register_instance(data);
50
51 {
52 for (int i = 0; i < num_messages; i ++)
53 {
54 data.sequence_num = i;
55 pt_dw->write(data, handle);
56 THROTTLE
57 }
58 }
59
60 for (int j = 0; j < 500; j ++)
61 {
62 data.sequence_num = -1;
63 pt_dw->write(data, handle);
64 // throttle twice to slow the rate to ensure one gets sent.
65 THROTTLE
66 THROTTLE
67 }
68}
69
70
71

Callers

nothing calls this directly

Calls 4

lengthMethod · 0.45
inMethod · 0.45
register_instanceMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected