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

Method svc

tests/DCPS/SkipSerialize/Writer.cpp:50–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50int
51Writer::svc()
52{
53 DDS::InstanceHandleSeq handles;
54
55 try {
56 // Block until Subscriber is available
57 DDS::StatusCondition_var condition = writer_->get_statuscondition();
58 condition->set_enabled_statuses(DDS::PUBLICATION_MATCHED_STATUS);
59
60 DDS::WaitSet_var ws = new DDS::WaitSet;
61 ws->attach_condition(condition);
62
63 DDS::Duration_t timeout =
64 { DDS::DURATION_INFINITE_SEC, DDS::DURATION_INFINITE_NSEC };
65
66 DDS::ConditionSeq conditions;
67 DDS::PublicationMatchedStatus matches = {0, 0, 0, 0, 0};
68
69 do {
70 if (ws->wait(conditions, timeout) != DDS::RETCODE_OK) {
71 ACE_ERROR((LM_ERROR,
72 ACE_TEXT("%N:%l: svc()")
73 ACE_TEXT(" ERROR: wait failed!\n")));
74 ACE_OS::exit(EXIT_FAILURE);
75 }
76
77 if (writer_->get_publication_matched_status(matches) != ::DDS::RETCODE_OK) {
78 ACE_ERROR((LM_ERROR,
79 ACE_TEXT("%N:%l: svc()")
80 ACE_TEXT(" ERROR: get_publication_matched_status failed!\n")));
81 ACE_OS::exit(EXIT_FAILURE);
82 }
83
84 } while (matches.current_count < 1);
85
86 ws->detach_condition(condition);
87
88 // Write samples
89 SkipSerialize::MessageDataWriter_var message_dw
90 = SkipSerialize::MessageDataWriter::_narrow(writer_.in());
91
92 if (CORBA::is_nil(message_dw.in())) {
93 ACE_ERROR((LM_ERROR,
94 ACE_TEXT("%N:%l: svc()")
95 ACE_TEXT(" ERROR: _narrow failed!\n")));
96 ACE_OS::exit(EXIT_FAILURE);
97 }
98
99 SkipSerialize::Message message;
100 message.serialized_data.length(message_length);
101 for (CORBA::ULong i = 0; i < message.serialized_data.length(); i++) {
102 message.serialized_data[i] = '1';
103 }
104
105 for (int i = 0; i < num_messages; i++) {
106 DDS::ReturnCode_t error;
107 do {

Callers

nothing calls this directly

Calls 10

set_enabled_statusesMethod · 0.80
attach_conditionMethod · 0.80
detach_conditionMethod · 0.80
_tao_print_exceptionMethod · 0.80
get_statusconditionMethod · 0.45
waitMethod · 0.45
inMethod · 0.45
lengthMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected