Class that contains all data required for an asset filter:
More...
#include <cs_AssetFilter.h>
|
virtual asset_id_t | assetId (const void *key, size_t keyLengthInBytes, uint32_t *startCrc=nullptr) |
| A assetId is generated as crc32 from filtered input data. More...
|
|
template<class ReturnType , class ExpressionType > |
ReturnType | prepareFilterInputAndCallDelegate (const scanned_device_t &device, AssetFilterInput filterInputDescription, ExpressionType delegateExpression, ReturnType defaultValue) |
| This method extracts the filters 'input description', prepares the input according to that description and calls the delegate with the prepared data. More...
|
|
virtual | ~FilterInterface ()=default |
|
virtual bool | contains (const void *key, size_t keyLengthInBytes)=0 |
|
virtual size_t | size ()=0 |
|
virtual bool | isValid ()=0 |
|
Class that contains all data required for an asset filter:
- Runtime data.
- persisted data (filterdata).
◆ AssetFilter()
◆ ~AssetFilter()
AssetFilter::~AssetFilter |
( |
| ) |
|
|
default |
◆ assetId()
virtual asset_id_t AssetFilter::assetId |
( |
const void * |
key, |
|
|
size_t |
keyLengthInBytes, |
|
|
uint32_t * |
startCrc = nullptr |
|
) |
| |
|
privatevirtual |
A assetId is generated as crc32 from filtered input data.
For output type MAC the data is prepended with a fixed value to avoid collisions with filters with assetId output based on MAC.
◆ contains()
bool AssetFilter::contains |
( |
const void * |
key, |
|
|
size_t |
keyLengthInBytes |
|
) |
| |
|
overridevirtual |
◆ filterAcceptsScannedDevice()
Returns true if the device passes the filter according to its metadata settings.
Returns false otherwise.
◆ filterdata()
◆ getAssetId()
Returns a asset_id_t based on the configured selection of data in metadata.outputType.inFormat.
If the data is not sufficient, a default constructed object is returned. (Data not sufficient can be detected: filterInputResult will return false in that case.)
◆ isValid()
bool AssetFilter::isValid |
( |
| ) |
|
|
overridevirtual |
◆ prepareFilterInputAndCallDelegate()
template<class ReturnType , class ExpressionType >
ReturnType AssetFilter::prepareFilterInputAndCallDelegate |
( |
const scanned_device_t & |
device, |
|
|
AssetFilterInput |
filterInputDescription, |
|
|
ExpressionType |
delegateExpression, |
|
|
ReturnType |
defaultValue |
|
) |
| |
|
private |
This method extracts the filters 'input description', prepares the input according to that description and calls the delegate with the prepared data.
delegateExpression should be of the form (FilterInterface&, void*, size_t) -> ReturnType.
The argument that is passed into delegateExpression
is based on the AssetFilterInputType of the assetFilter
. Buffers are only allocated when strictly necessary. (E.g. MacAddress is already available in the device
, but for MaskedAdDataType a buffer of 31 bytes needs to be allocated on the stack.)
The delegate return type is left as free template parameter so that this template can be used for both contains
and assetId
return values.
◆ runtimedata()
◆ size()
size_t AssetFilter::size |
( |
| ) |
|
|
overridevirtual |
Number of bytes of the data, according to the metadata contained in it.
Implements FilterInterface.
◆ _data
uint8_t* AssetFilter::_data |
The documentation for this class was generated from the following file: