14#ifndef NETWORK_MONITOR_UTILS_H
15#define NETWORK_MONITOR_UTILS_H
18#include "attribute_store.h"
46template<
class Sequence>
void retain_recursive(
48 typename Sequence::iterator &begin,
49 const typename Sequence::iterator &end,
50 const std::function<
bool(
const typename Sequence::const_iterator &)> predicate)
52 constexpr int delete_buffer_size = 16;
53 typename Sequence::const_iterator to_delete[delete_buffer_size] = {};
54 size_t delete_index = 0;
56 while (begin != end) {
57 if (delete_index < delete_buffer_size) {
58 if (!predicate(begin)) {
59 to_delete[++delete_index] = begin;
62 retain_recursive(sequence, begin, end, predicate);
69 for (
size_t i = delete_index; i > 0; --i) {
70 sequence.erase(to_delete[i]);
84template<
class Sequence>
static void retain(
86 const std::function<
bool(
const typename Sequence::const_iterator &)> predicate)
88 auto begin = sequence.begin();
89 const auto end = sequence.end();
90 __private::retain_recursive(sequence, begin, end, predicate);
107 attribute_store_node_t
node_id_node, int32_t inactive_time);
enum zwave_operating_mode zwave_operating_mode_t
Z-Wave Operating Modes (AL, FL or NL). Refer to the Z-Wave Network Layer Specification for details.
zwave_operating_mode_t network_monitor_get_operating_mode(attribute_store_node_t node_id_node)
Gets the Z-Wave operating mode () from the Attribute Store Node for the NodeID.
bool network_monitor_is_node_asleep_due_to_inactivity(attribute_store_node_t node_id_node, int32_t inactive_time)
Checks if we had a long tx/rx inactivity that would result in an NL node falling asleep.
attribute_store_node_t node_id_node
Various Z-Wave related utilities.