idls(3) | Library Functions Manual | idls(3) |
NAME¶
idls - ID List Management
SYNOPSIS¶
Data Structures¶
struct MDB_ID2
Macros¶
#define MDB_IDL_LOGN 16 /* DB_SIZE is 2^16, UM_SIZE is 2^17
*/
#define MDB_IDL_DB_SIZE (1<<MDB_IDL_LOGN)
#define MDB_IDL_UM_SIZE (1<<(MDB_IDL_LOGN+1))
#define MDB_IDL_DB_MAX (MDB_IDL_DB_SIZE-1)
#define MDB_IDL_UM_MAX (MDB_IDL_UM_SIZE-1)
#define MDB_IDL_SIZEOF(ids) (((ids)[0]+1) * sizeof(MDB_ID))
#define MDB_IDL_IS_ZERO(ids) ( (ids)[0] == 0 )
#define MDB_IDL_CPY(dst, src) (memcpy( dst, src, MDB_IDL_SIZEOF( src )
))
#define MDB_IDL_FIRST(ids) ( (ids)[1] )
#define MDB_IDL_LAST(ids) ( (ids)[(ids)[0]] )
#define MDB_IDL_ALLOCLEN(ids) ( (ids)[-1] )
#define mdb_midl_xappend(idl, id)
#define CMP(x, y) ( (x) < (y) ? -1 : (x) > (y) )
#define SMALL 8
#define MIDL_SWAP(a, b) { itmp=(a); (a)=(b); (b)=itmp; }
Typedefs¶
typedef size_t MDB_ID
typedef MDB_ID * MDB_IDL
typedef MDB_ID2 * MDB_ID2L
Functions¶
unsigned mdb_midl_search (MDB_IDL ids, MDB_ID
id)
MDB_IDL mdb_midl_alloc (int num)
void mdb_midl_free (MDB_IDL ids)
void mdb_midl_shrink (MDB_IDL *idp)
int mdb_midl_need (MDB_IDL *idp, unsigned num)
int mdb_midl_append (MDB_IDL *idp, MDB_ID id)
int mdb_midl_append_list (MDB_IDL *idp, MDB_IDL app)
int mdb_midl_append_range (MDB_IDL *idp, MDB_ID id,
unsigned n)
void mdb_midl_xmerge (MDB_IDL idl, MDB_IDL merge)
void mdb_midl_sort (MDB_IDL ids)
unsigned mdb_mid2l_search (MDB_ID2L ids, MDB_ID id)
int mdb_mid2l_insert (MDB_ID2L ids, MDB_ID2 *id)
int mdb_mid2l_append (MDB_ID2L ids, MDB_ID2 *id)
static int mdb_midl_grow (MDB_IDL *idp, int num)
Detailed Description¶
Data Structure Documentation¶
struct MDB_ID2¶
An ID2 is an ID/pointer pair.
Data Fields
MDB_ID mid
void * mptr
Field Documentation¶
MDB_ID MDB_ID2::mid¶
The ID
void* MDB_ID2::mptr¶
The pointer
Macro Definition Documentation¶
#define MDB_IDL_ALLOCLEN(ids) ( (ids)[-1] )¶
Current max length of an mdb_midl_alloc()ed IDL
#define mdb_midl_xappend(idl, id)¶
Value:
Append ID to IDL. The IDL must be big enough.
do { MDB_ID *xidl = (idl), xlen = ++(xidl[0]); xidl[xlen] = (id); } while (0)
Typedef Documentation¶
typedef size_t MDB_ID¶
A generic unsigned ID number. These were entryIDs in back-bdb. Preferably it should have the same size as a pointer.
typedef MDB_ID* MDB_IDL¶
An IDL is an ID List, a sorted array of IDs. The first element of the array is a counter for how many actual IDs are in the list. In the original back-bdb code, IDLs are sorted in ascending order. For libmdb IDLs are sorted in descending order.
typedef MDB_ID2* MDB_ID2L¶
An ID2L is an ID2 List, a sorted array of ID2s. The first element's mid member is a count of how many actual elements are in the array. The mptr member of the first element is unused. The array is sorted in ascending order by mid.
Function Documentation¶
unsigned mdb_midl_search (MDB_IDL ids, MDB_ID id)¶
Search for an ID in an IDL.
Parameters
id The ID to search for.
Returns
MDB_IDL mdb_midl_alloc (int num)¶
Allocate an IDL. Allocates memory for an IDL of the given size.
Returns
void mdb_midl_free (MDB_IDL ids)¶
Free an IDL.
Parameters
void mdb_midl_shrink (MDB_IDL * idp)¶
Shrink an IDL. Return the IDL to the default size if it has grown larger.
Parameters
int mdb_midl_need (MDB_IDL * idp, unsigned num)¶
Make room for num additional elements in an IDL.
Parameters
num Number of elements to make room for.
Returns
int mdb_midl_append (MDB_IDL * idp, MDB_ID id)¶
Append an ID onto an IDL.
Parameters
id The ID to append.
Returns
int mdb_midl_append_list (MDB_IDL * idp, MDB_IDL app)¶
Append an IDL onto an IDL.
Parameters
app The IDL to append.
Returns
int mdb_midl_append_range (MDB_IDL * idp, MDB_ID id, unsigned n)¶
Append an ID range onto an IDL.
Parameters
id The lowest ID to append.
n Number of IDs to append.
Returns
void mdb_midl_xmerge (MDB_IDL idl, MDB_IDL merge)¶
Merge an IDL onto an IDL. The destination IDL must be big enough.
Parameters
merge The IDL to merge.
void mdb_midl_sort (MDB_IDL ids)¶
Sort an IDL.
Parameters
unsigned mdb_mid2l_search (MDB_ID2L ids, MDB_ID id)¶
Search for an ID in an ID2L.
Parameters
id The ID to search for.
Returns
int mdb_mid2l_insert (MDB_ID2L ids, MDB_ID2 * id)¶
Insert an ID2 into a ID2L.
Parameters
id The ID2 to insert.
Returns
int mdb_mid2l_append (MDB_ID2L ids, MDB_ID2 * id)¶
Append an ID2 into a ID2L.
Parameters
id The ID2 to append.
Returns
Author¶
Generated automatically by Doxygen for LMDB from the source code.
Wed Aug 16 2023 | LMDB |