|
ADTF
|
#include <substream_name_filter.h>
Classes | |
| struct | tFilterBase |
| struct | tPlain |
| struct | tPrefix |
| struct | tRegex |
| struct | tRegexFilterBase |
| struct | tStreamFilter |
| struct | tWildcard |
Public Types | |
| enum class | tFilterMode : uint8_t { Plain = 0 , PrefixTrim = 1 , Prefix = 2 , Wildcard = 3 , Regex = 4 } |
| using | tFilter = std::variant<tPlain, tPrefix, tWildcard, tRegex> |
| Variant holding the filter specialization. | |
| using | tStreamAttributes = std::map<std::string, std::variant<bool, double, std::string>> |
| Storage type for additional stream attributes. | |
Public Member Functions | |
| cSubstreamNameFilter () noexcept | |
| cSubstreamNameFilter (const cSubstreamNameFilter &) | |
| cSubstreamNameFilter (cSubstreamNameFilter &&) noexcept | |
| cSubstreamNameFilter (std::string_view strFileName, std::optional< tFilterMode > oTextModeOverride) | |
| cSubstreamNameFilter (std::vector< tStreamFilter > oStreamFilters) noexcept | |
| ~cSubstreamNameFilter () | |
| void | Reset (std::vector< tStreamFilter > oStreamFilters={}) noexcept |
| void | AddFilter (const tFilter &oFilter, const tStreamAttributes &oAttributes={}) |
| void | AddFilterFile (std::string_view strFileName, std::optional< tFilterMode > oTextModeOverride) |
| void | SaveFiltersToFile (std::string_view strFileName, std::optional< tFilterMode > oTextModeOverride) |
| tResult | RemoveFilter (const tFilter &oFilter) noexcept |
| std::vector< tStreamFilter > | GetStreamFilters () const &noexcept |
| std::vector< tStreamFilter > && | GetStreamFilters () &&noexcept |
| bool | Matches (std::string_view strName) const noexcept |
| bool | PrefixMatches (std::string_view strName) const |
| void | Select (std::string_view strPrefix, const adtf::streaming::ant::IStreamType &oType, const std::function< void(std::string_view, uint32_t, const tStreamFilter &, const adtf::ucom::ant::iobject_ptr< const adtf::streaming::ant::IStreamType > &)> &fnSelectedCallback, bool bInverseMatch=false) const |
| void | Select (const adtf::streaming::ant::IStreamType &oType, const std::function< void(std::string_view, uint32_t, const tStreamFilter &, const adtf::ucom::ant::iobject_ptr< const adtf::streaming::ant::IStreamType > &)> &fnSelectedCallback, bool bInverseMatch=false) const |
Static Public Member Functions | |
| static std::string | WildcardToRegex (std::string_view strString) |
| static std::string | EscapeRegularExpression (std::string_view strString) |
Utility class to define substream name filters either from file or from string. Allows to match the substreams defined from streamtypes against these filters.
|
strong |
Legacy: Supported filter modes. Only required if filters are imported from legacy text files.
|
noexcept |
CTOR
| adtf::filter::private_implementations::cSubstreamNameFilter::cSubstreamNameFilter | ( | const cSubstreamNameFilter & | ) |
Copy CTOR
|
noexcept |
Move CTOR
| adtf::filter::private_implementations::cSubstreamNameFilter::cSubstreamNameFilter | ( | std::string_view | strFileName, |
| std::optional< tFilterMode > | oTextModeOverride ) |
Construct a new cSubstreamNameFilter from a given input file.
| strFileName | The file path. |
| oTextModeOverride | Specifies the filtermode if a text file is passed. In this case, the filtermode must be set! |
|
noexcept |
Construct a new cSubstreamNameFilter from an existing filter set.
| oStreamFilters | The filter set to be imported. |
| adtf::filter::private_implementations::cSubstreamNameFilter::~cSubstreamNameFilter | ( | ) |
DTOR
| void adtf::filter::private_implementations::cSubstreamNameFilter::AddFilter | ( | const tFilter & | oFilter, |
| const tStreamAttributes & | oAttributes = {} ) |
Adds a filter.
| oFilter | The filter to be added. |
| oAttributes | Additional attributes. |
| void adtf::filter::private_implementations::cSubstreamNameFilter::AddFilterFile | ( | std::string_view | strFileName, |
| std::optional< tFilterMode > | oTextModeOverride ) |
Adds filters loaded from file.
| strFileName | The file path. |
| oTextModeOverride | Specifies the filtermode if a text file is passed. In this case, the filtermode must be set! |
|
static |
Escapes a string so that it is usable as regular expression so that characters are not interpreted as regular expression characters.
| strString | The string. |
|
noexcept |
Get the filters (by move).
|
noexcept |
Get the filters (by copy).
|
noexcept |
Checks if any filter matches a name.
| strName | The name. |
| bool adtf::filter::private_implementations::cSubstreamNameFilter::PrefixMatches | ( | std::string_view | strName | ) | const |
Determines whether a given name (prefix-)matches a substreamname filter.
| strName | The name. |
|
noexcept |
Removes a filter.
| oFilter | The filter to be added. |
|
noexcept |
Resets all filters to a predefined set of filters.
| oStreamFilters | The filter set to be set. |
| void adtf::filter::private_implementations::cSubstreamNameFilter::SaveFiltersToFile | ( | std::string_view | strFileName, |
| std::optional< tFilterMode > | oTextModeOverride ) |
Saves the filters to file.
| strFileName | The file path. |
| oTextModeOverride | Specifies the filtermode if a text file is passed. In this case, the filtermode must be set! For text files, only filters matching the filtermode will be written to the file. This does not apply for Regex filtermode which tries to convert other filters to regular expressions. |
| void adtf::filter::private_implementations::cSubstreamNameFilter::Select | ( | const adtf::streaming::ant::IStreamType & | oType, |
| const std::function< void(std::string_view, uint32_t, const tStreamFilter &, const adtf::ucom::ant::iobject_ptr< const adtf::streaming::ant::IStreamType > &)> & | fnSelectedCallback, | ||
| bool | bInverseMatch = false ) const |
Filters substreams from streamtype and calls back a function on them.
| oType | The streamtype. |
| fnSelectedCallback | The callback function. |
| bInverseMatch | If set to true, the callback is invoked for substreams that do not match any filter instead of those that do. |
| void adtf::filter::private_implementations::cSubstreamNameFilter::Select | ( | std::string_view | strPrefix, |
| const adtf::streaming::ant::IStreamType & | oType, | ||
| const std::function< void(std::string_view, uint32_t, const tStreamFilter &, const adtf::ucom::ant::iobject_ptr< const adtf::streaming::ant::IStreamType > &)> & | fnSelectedCallback, | ||
| bool | bInverseMatch = false ) const |
Filters substreams from streamtype and calls back a function on them.
| strPrefix | A prefix which will be prepended to the substream names. |
| oType | The streamtype. |
| fnSelectedCallback | The callback function. |
| bInverseMatch | If set to true, the callback is invoked for substreams that do not match any filter instead of those that do. |
|
static |
Transforms a string containing wildcards to a regex string.
| strString | The string. |