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

Function read

tools/rtpsrelay/control/RtpsRelayControl.cpp:103–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103int read(const RelayConfigDataReader_var& reader, RelayConfig& config, bool& done)
104{
105 RelayConfig sample;
106 DDS::SampleInfo info;
107 DDS::ReturnCode_t ret;
108 while ((ret = reader->take_next_sample(sample, info)) == DDS::RETCODE_OK) {
109 if (info.valid_data) {
110 filter(sample);
111 std::cout << OpenDDS::DCPS::to_json(sample) << std::endl;
112 if (sample.relay_id() == config.relay_id()) {
113 for (auto it{config.config().begin()}; it != config.config().end();) {
114 const auto sample_it{sample.config().find(it->first)};
115 if (sample_it != sample.config().end() && sample_it->second == it->second) {
116 config.config().erase(it++);
117 } else {
118 ++it;
119 }
120 }
121 if (config.config().empty() && !keep_running) {
122 done = true;
123 }
124 }
125 } else {
126 if (info.instance_state != DDS::ALIVE_INSTANCE_STATE) {
127 std::cerr << "Relay no longer available: " << sample.relay_id() << std::endl;
128 if (sample.relay_id() == config.relay_id() && !keep_running) {
129 done = true;
130 }
131 }
132 }
133 }
134
135 if (ret != DDS::RETCODE_NO_DATA) {
136 ACE_ERROR((LM_ERROR, "ERROR: read returned %C\n", OpenDDS::DCPS::retcode_to_string(ret)));
137 return EXIT_FAILURE;
138 }
139
140 return EXIT_SUCCESS;
141}
142
143int run(int argc, ACE_TCHAR* argv[])
144{

Callers 1

runFunction · 0.70

Calls 11

to_jsonFunction · 0.85
retcode_to_stringFunction · 0.85
relay_idMethod · 0.80
filterFunction · 0.70
take_next_sampleMethod · 0.45
beginMethod · 0.45
configMethod · 0.45
endMethod · 0.45
findMethod · 0.45
eraseMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected