forked from open62541pp/open62541pp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubscription.cpp
32 lines (25 loc) · 980 Bytes
/
subscription.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "open62541pp/subscription.hpp"
#ifdef UA_ENABLE_SUBSCRIPTIONS
#include "open62541pp/client.hpp"
#include "open62541pp/detail/client_context.hpp"
#include "open62541pp/detail/server_context.hpp"
#include "open62541pp/server.hpp"
namespace opcua {
template <typename T>
std::vector<MonitoredItem<T>> Subscription<T>::monitoredItems() {
std::vector<MonitoredItem<T>> result;
auto& monitoredItems = opcua::detail::getContext(connection()).monitoredItems;
monitoredItems.eraseStale();
monitoredItems.iterate([&](const auto& pair) {
const auto [subId, monId] = pair.first;
if (subId == subscriptionId()) {
result.emplace_back(connection(), subId, monId);
}
});
return result;
}
// explicit template instantiation
template std::vector<MonitoredItem<Client>> Subscription<Client>::monitoredItems();
template std::vector<MonitoredItem<Server>> Subscription<Server>::monitoredItems();
} // namespace opcua
#endif