Line data Source code
1 : // Copyright 2024 Accenture. 2 : 3 : /** 4 : * Contains IFilter interface. 5 : * \file IFilter.h 6 : * \ingroup filter 7 : */ 8 : #pragma once 9 : 10 : #include <platform/estdint.h> 11 : 12 : namespace can 13 : { 14 : class IMerger; 15 : 16 : /** 17 : * common interface for filter classes 18 : * 19 : */ 20 : class IFilter 21 : { 22 : public: 23 121 : IFilter() = default; 24 : IFilter(IFilter const&) = delete; 25 : IFilter& operator=(IFilter const&) = delete; 26 : 27 : /** 28 : * adds a single id to the filter 29 : * \param filterId id to add 30 : * \post filter.match(filterId) 31 : */ 32 : virtual void add(uint32_t filterId) = 0; 33 : 34 : /** 35 : * adds a range of ids to the filter 36 : * \param from begin of range 37 : * \param to end of range 38 : * \post filter.match(from...to); 39 : */ 40 : virtual void add(uint32_t from, uint32_t to) = 0; 41 : 42 : /** 43 : * checks if a given id matches the filter 44 : * \return * - true: filterId matches filter 45 : * - false: filterId does not match filter 46 : */ 47 : virtual bool match(uint32_t filterId) const = 0; 48 : 49 : /** 50 : * clears the filter so that nothing matches 51 : */ 52 : virtual void clear() = 0; 53 : 54 : /** 55 : * opens the filters full range 56 : */ 57 : virtual void open() = 0; 58 : 59 : /** 60 : * merges filter with a given merger 61 : * \param merger IMerger to merge filter to 62 : * 63 : * This is part of the visitor pattern that is used to 64 : * merge different kinds of filters. 65 : */ 66 : virtual void acceptMerger(IMerger& merger) = 0; 67 : }; 68 : 69 : } // namespace can