Bitmaps and Bitmap Refs

Bitmaps are used to implement bounded sets. Each bit in the bitmap may be on or off representing presence or absence of a value in the set. Typically bitmaps are used to record sets of privileges.

A bitmap ref is a variable that may temporarily reference another bitmap. These are useful for manipulating specific bitmaps within bitmap arrays or bitmap hashes. All bitmap operations except for veil_init_bitmap(text, text) may take the name of a bitmap ref instead of a bitmap.

Bitmap refs may not be shared, and the reference is only accessible within the transaction that created it. These restrictions exist to eliminate the possibility of references to deleted objects or to objects from other sessions.

The following functions comprise the Veil bitmaps API:

veil_init_bitmap(text, text)

function veil_init_bitmap(text, text) returns bool
This is used to create or resize a bitmap. The first parameter provides the name of the bitmap, the second is the name of a range variable that will govern the size of the bitmap.

veil_clear_bitmap(text)

function veil_clear_bitmap(text) returns bool
This is used to reset all bits in the bitmap.

veil_bitmap_setbit(text, int4)

function veil_bitmap_setbit(text, int4) returns bool
This is used to set a specified bit in a bitmap.

veil_bitmap_clearbit(text, int4)

function veil_bitmap_clearbit(text, int4) returns bool
This is used to set a specified bit in a bitmap.

veil_bitmap_testbit(text, int4)

function veil_bitmap_testbit(text, int4) returns bool
This is used to test a specified bit in a bitmap. It returns true if the bit is set, false otherwise.

veil_bitmap_union(text, int4)

function veil_bitmap_union(text, text) returns bool
Form the union of two bitmaps with the result going into the first.

veil_bitmap_intersect(text, int4)

function veil_bitmap_intersect(text, text) returns bool
Form the intersection of two bitmaps with the result going into the first.

veil_bitmap_bits(text)

function veil_bitmap_bits(text) returns setof int4
This is used to list all bits set within a bitmap. It is primarily for interactive use during development and debugging of Veil-based systems.

veil_bitmap_range(text)

function veil_bitmap_range(text) returns veil_range_t
This returns the range of a bitmap. It is primarily intended for interactive use.

Next: Bitmap Arrays


Generated on Tue Mar 11 10:08:38 2008 for Veil by  doxygen 1.5.4