MCPcopy Create free account
hub / github.com/COVESA/vsomeip / update

Method update

implementation/routing/src/remote_subscription.cpp:216–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216std::set<client_t> remote_subscription::update(const std::set<client_t>& _clients, const std::chrono::steady_clock::time_point& _timepoint,
217 const bool _is_subscribe) {
218 std::set<client_t> its_changed;
219
220 std::scoped_lock its_lock(mutex_);
221 for (const auto& its_client : _clients) {
222 auto found_client = clients_.find(its_client);
223 if (_is_subscribe) {
224 if (found_client != clients_.end()) {
225 found_client->second.second = _timepoint;
226 } else {
227 its_changed.insert(its_client);
228 }
229 } else {
230 if (found_client != clients_.end()) {
231 its_changed.insert(its_client);
232 }
233 }
234 }
235
236 for (const auto& its_client : its_changed) {
237 if (_is_subscribe) {
238 clients_[its_client] = std::make_pair(remote_subscription_state_e::SUBSCRIPTION_PENDING, _timepoint);
239 } else {
240 clients_.erase(its_client);
241 }
242 }
243
244 return its_changed;
245}
246
247std::shared_ptr<remote_subscription> remote_subscription::get_parent() const {
248 return parent_.lock();

Callers 1

Calls 2

endMethod · 0.80
insertMethod · 0.80

Tested by

no test coverage detected