mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
doc: fix bloom filter documentation
This commit is contained in:
parent
04b67f1ff0
commit
1288b3f9cb
@ -132,22 +132,26 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* hashfp_t hash function to use in thee filter
|
||||
* @brief hash function to use in thee filter
|
||||
*/
|
||||
typedef uint32_t (*hashfp_t)(const uint8_t *, int len);
|
||||
|
||||
/**
|
||||
* bloom_t bloom filter object
|
||||
* @brief bloom_t bloom filter object
|
||||
*/
|
||||
typedef struct {
|
||||
/** number of bytes in the bloom array */
|
||||
size_t m;
|
||||
/** number of hash functions */
|
||||
size_t k;
|
||||
/** the bloom array */
|
||||
uint8_t *a;
|
||||
/** the hash functions */
|
||||
hashfp_t *hash;
|
||||
} bloom_t;
|
||||
|
||||
/**
|
||||
* bloom_new Allocate and return a pointer to a new Bloom filter.
|
||||
* @brief Allocate and return a pointer to a new Bloom filter.
|
||||
*
|
||||
* For best results, make 'size' a power of 2.
|
||||
*
|
||||
@ -161,7 +165,7 @@ typedef struct {
|
||||
bloom_t *bloom_new(size_t size, size_t num_hashes, ...);
|
||||
|
||||
/**
|
||||
* bloom_del Delete a Bloom filter.
|
||||
* @brief Delete a Bloom filter.
|
||||
*
|
||||
* @param bloom The condemned
|
||||
* @return nothing
|
||||
@ -170,20 +174,21 @@ bloom_t *bloom_new(size_t size, size_t num_hashes, ...);
|
||||
void bloom_del(bloom_t *bloom);
|
||||
|
||||
/**
|
||||
* bloom_add Add a string to a Bloom filter.
|
||||
* @brief Add a string to a Bloom filter.
|
||||
*
|
||||
* CAVEAT
|
||||
* Once a string has been added to the filter, it cannot be "removed"!
|
||||
*
|
||||
* @param bloom Bloom filter
|
||||
* @param buf string to add
|
||||
* @param len the length of the string @p buf
|
||||
* @return nothing
|
||||
*
|
||||
*/
|
||||
void bloom_add(bloom_t *bloom, const uint8_t *buf, size_t len);
|
||||
|
||||
/**
|
||||
* bloom_check Determine if a string is in the Bloom filter.
|
||||
* @brief Determine if a string is in the Bloom filter.
|
||||
*
|
||||
* The string 's' is hashed once for each of the 'k' hash functions, as
|
||||
* though we were planning to add it to the filter. Instead of adding it
|
||||
@ -213,6 +218,9 @@ void bloom_add(bloom_t *bloom, const uint8_t *buf, size_t len);
|
||||
*
|
||||
* @param bloom Bloom filter
|
||||
* @param buf string to check
|
||||
* @param len the length of the string @p buf
|
||||
*
|
||||
*
|
||||
* @return false if string does not exist in the filter
|
||||
* @return true if string is may be in the filter
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user