|
Nagios 4.5.2
Dev docs for Nagios core and neb-module hackers
|
Bit map API. More...
Go to the source code of this file.
| #define | bitmap_size bitmap_cardinality |
| typedef struct bitmap | bitmap |
| int | bitmap_resize (bitmap *bm, unsigned long size) |
| Resize a bitmap If the bitmap is made smaller, data will silently be lost. | |
| bitmap * | bitmap_create (unsigned long size) |
| Create a bitmaptor of size 'size'. | |
| void | bitmap_destroy (bitmap *bm) |
| Destroy a bitmaptor by freeing all the memory it uses. | |
| bitmap * | bitmap_copy (const bitmap *bm) |
| Copy a bitmaptor. | |
| int | bitmap_set (bitmap *bm, unsigned long pos) |
| Set a bit in the map. | |
| int | bitmap_isset (const bitmap *bm, unsigned long pos) |
| Check if a particular bit is set in the map. | |
| int | bitmap_unset (bitmap *bm, unsigned long pos) |
| Unset a particular bit in the map. | |
| unsigned long | bitmap_cardinality (const bitmap *bm) |
| Obtain cardinality (max number of elements) of the bitmaptor. | |
| unsigned long | bitmap_count_set_bits (const bitmap *bm) |
| Count set bits in map. | |
| unsigned long | bitmap_count_unset_bits (const bitmap *bm) |
| Count unset bits in map. | |
| void | bitmap_clear (bitmap *bm) |
| Unset all bits in a bitmap. | |
| bitmap * | bitmap_intersect (const bitmap *a, const bitmap *b) |
| Calculate intersection of two bitmaps The intersection is defined as all bits that are members of both A and B. | |
| bitmap * | bitmap_union (const bitmap *a, const bitmap *b) |
| Calculate union of two bitmaps The union is defined as all bits that are members of A or B or both A and B. | |
| bitmap * | bitmap_unite (bitmap *res, const bitmap *addme) |
| Calculate union of two bitmaps and store result in one of them. | |
| bitmap * | bitmap_diff (const bitmap *a, const bitmap *b) |
| Calculate set difference between two bitmaps The set difference of A / B is defined as all members of A that isn't members of B. | |
| bitmap * | bitmap_symdiff (const bitmap *a, const bitmap *b) |
| Calculate symmetric difference between two bitmaps The symmetric difference between A and B is the set that contains all elements in either set but not in both. | |
| int | bitmap_cmp (const bitmap *a, const bitmap *b) |
| Compare two bitmaps for equality. | |
Bit map API.
The bitmap api is useful for running set operations on objects indexed by unsigned integers.
|
extern |
Obtain cardinality (max number of elements) of the bitmaptor.
| bm | The bitmaptor to check |
|
extern |
Unset all bits in a bitmap.
| bm | The bitmap to clear |
|
extern |
Compare two bitmaps for equality.
| a | The first bitmaptor |
| b | The other bitmaptor |
|
extern |
Copy a bitmaptor.
| bm | The bitmaptor to copy |
|
extern |
Count set bits in map.
Completed in O(n/8) time.
| bm | The bitmaptor to count bits in |
|
extern |
Count unset bits in map.
Completed in O(n/8) time.
| bm | The bitmaptor to count bits in |
|
extern |
Create a bitmaptor of size 'size'.
| size | Desired storage capacity |
|
extern |
Destroy a bitmaptor by freeing all the memory it uses.
| bm | The bitmaptor to destroy |
|
extern |
Calculate set difference between two bitmaps The set difference of A / B is defined as all members of A that isn't members of B.
Note that parameter ordering matters for this function. This function completes in O(n/sizeof(long)) operations.
| a | The first bitmaptor (numerator) |
| b | The first bitmaptor (denominator) |
|
extern |
Calculate intersection of two bitmaps The intersection is defined as all bits that are members of both A and B.
It's equivalent to bitwise AND. This function completes in O(n/sizeof(long)) operations.
| a | The first bitmaptor |
| b | The second bitmaptor |
|
extern |
Check if a particular bit is set in the map.
| bm | The bitmaptor to check |
| pos | Position of the bit to check |
|
extern |
Resize a bitmap If the bitmap is made smaller, data will silently be lost.
| bm | The bitmap to resize |
| size | The new desired size of the bitmap |
|
extern |
Set a bit in the map.
| bm | The bitmaptor to operate on |
| pos | Position of the bit to set |
|
extern |
Calculate symmetric difference between two bitmaps The symmetric difference between A and B is the set that contains all elements in either set but not in both.
This function completes in O(n/sizeof(long)) operations.
| a | The first bitmaptor |
| b | The second bitmaptor |
|
extern |
Calculate union of two bitmaps The union is defined as all bits that are members of A or B or both A and B.
It's equivalent to bitwise OR. This function completes in O(n/sizeof(long)) operations.
| a | The first bitmaptor |
| b | The second bitmaptor |
|
extern |
Calculate union of two bitmaps and store result in one of them.
| res | The first bitmap |
| addme | The bitmap to unite to the first bitmap |
|
extern |
Unset a particular bit in the map.
| bm | The bitmaptor to operate on |
| pos | Position of the bit to unset |