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