Veil
Bitmap Arrays

A bitmap array is an array of identically-ranged bitmaps, indexed by an integer value. They are initialised using two ranges, one for the range of each bitmap, and one providing the range of indices for the array.

Typically bitmap arrays are used for collections of privileges, where each element of the collection is indexed by something like a role_id.

The following functions comprise the Veil bitmap arrays API:

init_bitmap_array(bmarray text, array_range text, bitmap_range text)

function veil.init_bitmap_array(bmarray text, array_range text, bitmap_range text) returns bool

Creates or resets (clears) the bitmap array named bmarray. The last two parameters are the names of ranges used to bound the dimensions of the array, and the range of bits within the array's bitmaps. Implemented by C function veil_init_bitmap_array().

clear_bitmap_array(bmarray text)

function veil.clear_bitmap_array(bmarray text) returns bool

Clear all bits in all bitmaps of the bitmap array named bmarray. Implemented by C function veil_clear_bitmap_array().

bitmap_from_array(bmref_name text, bmarray text, index int4)

function veil.bitmap_from_array(bmref_name text, bmarray text, index int4) returns text

Place a reference into bmref_name to the bitmap identified by index in bitmap array bmarray. Implemented by C function veil_bitmap_from_array().

bitmap_array_testbit(bmarray text, arr_idx int4, bitno int4)

function veil.bitmap_array_testbit(bmarray text, arr_idx int4, bitno int4) returns bool

Test a specific bit in a bitmap array. Implemented by C function veil_bitmap_array_testbit().

bitmap_array_setbit(bmarray text, arr_idx int4, bitno int4)

function veil.bitmap_array_setbit(bmarray text, arr_idx int4, bitno int4) returns bool

Set a specific bit in a bitmap array. Implemented by C function veil_bitmap_array_setbit().

bitmap_array_clearbit(bmarray text, arr_idx int4, bitno int4)

function veil.bitmap_array_clearbit(bmarray text, arr_idx int4, bitno int4) returns bool

Clear a specific bit in a bitmap array. Implemented by C function veil_bitmap_array_clearbit().

union_from_bitmap_array(bitmap text, bmarray text, arr_idx int4)

function veil.union_from_bitmap_array(bitmap text, bmarray text, arr_idx int4) returns bool

Union a bitmap with a specified bitmap from an array, with the result in the bitmap. Implemented by C function veil_union_from_bitmap_array(). This is a faster shortcut for the following logical construction:

veil.bitmap_union(<bitmap>, veil.bitmap_from_array(<bitmap_array>, <index>))

intersect_from_bitmap_array(bitmap text, bmarray text, arr_idx int4)

function veil.intersect_from_bitmap_array(bitmap text, bmarray text, arr_idx int4) returns bool

Intersect a bitmap with a specified bitmap from an array, with the result in the bitmap. Implemented by C function veil_intersect_from_bitmap_array(). This is a faster shortcut for the following logical construction:

veil.bitmap_intersect(<bitmap>, veil.bitmap_from_array(<bitmap_array>,<index>))

bitmap_array_bits(bmarray text, arr_idx int4)

function veil.bitmap_array_bits(bmarray text, arr_idx int4) returns setof int4

Show all bits in the specific bitmap within an array. This is primarily intended for interactive use when developing and debugging Veil-based systems. Implemented by C function veil_bitmap_array_bits().

bitmap_array_arange(bmarray text)

function veil.bitmap_array_arange(bmarray text) returns veil_range_t

Return the range of array indices, as a veil_range_t, for the specified bitmap array. Primarily for interactive use. Implemented by C function veil_bitmap_array_arange().

bitmap_array_brange(bmarray text)

function veil.bitmap_array_brange(bmarray text) returns veil_range_t

Show the range, as a veil_range_t, of all bitmaps in the specified bitmap array. Primarily for interactive use. Implemented by C function veil_bitmap_array_range().

Next: Bitmap Hashes