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

Method write

tests/DCPS/ManyToMany/Writer.cpp:26–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24}
25
26bool
27Writer::write()
28{
29 bool valid = true;
30 try {
31 typedef std::vector<DDS::InstanceHandle_t> Handles;
32 Handles handles;
33 const unsigned int subscribers = options_.num_sub_processes *
34 options_.num_sub_participants * options_.num_readers;
35 ACE_DEBUG((LM_DEBUG,
36 ACE_TEXT("(%P|%t) Writers wait for %d subscribers\n"),
37 subscribers));
38
39 // Block until Subscriber is available
40 for (Writers::const_iterator writer = writers_.begin();
41 writer != writers_.end();
42 ++writer) {
43 Utils::wait_match(writer->writer, subscribers, Utils::GTE);
44
45 // we already have a ref count, no need to take another
46 Messenger::MessageDataWriter_ptr message_dw =
47 dynamic_cast<Messenger::MessageDataWriter*>(writer->writer.in());
48
49 if (CORBA::is_nil(message_dw)) {
50 ACE_ERROR((LM_ERROR,
51 ACE_TEXT("%N:%l: svc()")
52 ACE_TEXT(" ERROR: _narrow dw1 failed!\n")));
53 ACE_OS::exit(-1);
54 }
55
56 handles.push_back(message_dw->register_instance(writer->message));
57 }
58
59 ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) Writers matched\n")));
60
61 const ACE_Time_Value delay(options_.delay_msec / 1000,
62 (options_.delay_msec % 1000) * 1000);
63
64 for (unsigned int i = 0; i < options_.num_samples; i++) {
65 Handles::iterator handle = handles.begin();
66 for (Writers::iterator writer = writers_.begin();
67 writer != writers_.end();
68 ++writer, ++handle) {
69 // we already have a ref count, no need to take another
70 // Write samples
71 Messenger::MessageDataWriter_ptr message_dw =
72 dynamic_cast<Messenger::MessageDataWriter*>(writer->writer.in());
73
74 ++writer->message.sample_id;
75
76 ACE_DEBUG((LM_DEBUG,
77 ACE_TEXT("(%P|%t) Writing Message: process_id = %d ")
78 ACE_TEXT("participant_id = %d ")
79 ACE_TEXT("writer_id = %d ")
80 ACE_TEXT("sample_id = %d\n"),
81 writer->message.process_id,
82 writer->message.participant_id,
83 writer->message.writer_id,

Callers 13

on_data_availableMethod · 0.45
runMethod · 0.45
run_multitopic_testFunction · 0.45
svcMethod · 0.45
in_loopMethod · 0.45
ACE_TMAINFunction · 0.45
ACE_TMAINFunction · 0.45
svcMethod · 0.45
svcMethod · 0.45
on_data_availableMethod · 0.45
svcMethod · 0.45
ACE_TMAINFunction · 0.45

Calls 6

wait_matchFunction · 0.85
_tao_print_exceptionMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
inMethod · 0.45
register_instanceMethod · 0.45

Tested by 3

runMethod · 0.36
run_multitopic_testFunction · 0.36
svcMethod · 0.36