1#ifndef CBF_COUNTER_HPP_QTMUOGJS
2#define CBF_COUNTER_HPP_QTMUOGJS
4#include <vanetza/common/clock.hpp>
5#include <vanetza/geonet/cbf_packet_identifier.hpp>
6#include <vanetza/geonet/soft_state_map.hpp>
8#include <unordered_map>
20
21
22
26 using id_type = CbfPacketIdentifier;
27 using counter_type = std::size_t;
30
31
32
33 virtual void add(
const id_type& id) = 0;
36
37
38
39 virtual void remove(
const id_type& id) = 0;
42
43
44
48
49
50
51 virtual counter_type
counter(
const id_type& id)
const = 0;
53 virtual ~CbfCounter() =
default;
58
59
60
64 void add(
const id_type&)
override;
65 void remove(
const id_type&)
override {}
67 counter_type
counter(
const id_type&)
const override;
70 std::unordered_map<id_type, counter_type> m_counters;
74
75
76
80 void add(
const id_type&)
override;
81 void remove(
const id_type&)
override;
85
86
87
88
89
94
95
96
97
100 void add(
const id_type&)
override;
103 counter_type
counter(
const id_type&)
const override;
106 SoftStateMap<id_type, counter_type> m_counters;
void add(const id_type &) override
void remove(const id_type &) override
void increment(const id_type &) override
void add(const id_type &) override
void remove(const id_type &) override
counter_type counter(const id_type &) const override
counter_type counter(const id_type &) const override
void remove(const id_type &) override
void add(const id_type &) override
void increment(const id_type &) override
virtual void increment(const id_type &id)=0
virtual void add(const id_type &id)=0
virtual void remove(const id_type &id)=0
virtual counter_type counter(const id_type &id) const =0