bglibs: adt: Abstract Data Types.

- Main Page
- Modules
- Data Structures
- Files
- Directories
- Related Pages
- Examples

# adt: Abstract Data Types.

## Typedefs
typedef unsigned long | adt_hash_t
typedef void | adt_free_fn (void *)
typedef int | adt_copy_fn (void *, const void *)
typedef int | adt_cmp_fn (const void *, const void *)
typedef adt_hash_t | adt_hash_fn (const void *)
## Functions
adt_hash_t | adt_hashb (const unsigned char *, unsigned long)
adt_hash_t | adt_hashs (const unsigned char *)
adt_hash_t | adt_hashsp (const char *const *)
int | adt_cmpsp (const char *const *a, const char *const *b)
int | adt_copysp (const char **a, const char *const *b)
void | adt_freesp (const char **a)

## Typedef Documentation

typedef int adt_cmp_fn(const void *, const void *)

A function prototype for comparing two items. Such functions must return zero if the two items are identical, positive if the first is larger, and negative if the first is smaller.

typedef int adt_copy_fn(void *, const void *)

A function prototype for copying something. The function is expected to return false (zero) if the copy failed for any reason (ie could not allocate memory).

typedef void adt_free_fn(void *)

A function prototype used for freeing something.

typedef adt_hash_t adt_hash_fn(const void *)

A function prototype for hasing an item (typically a key).

typedef unsigned long adt_hash_t

The hash value type. All hash functions must output a value of this type, and all functions that use a hash store it in this type.

## Function Documentation

int adt_cmpsp | ( | const char *const * | a,
|  | const char *const * | b |
| ) |  |  |

A sample function for comparing two C string pointers.

int adt_copysp | ( | const char ** | a,
|  | const char *const * | b |
| ) |  |  |

A sample function for copying a C string pointer.

void adt_freesp | ( | const char ** | a | ) |

A sample function for freeing a C string pointer.

adt_hash_t adt_hashb | ( | const unsigned char * | ,
|  | unsigned | long |
| ) |  |  |

A sample function for hasing a block of memory.

adt_hash_t adt_hashs | ( | const unsigned char * |  | ) |

A sample function for hashing a C string.

adt_hash_t adt_hashsp | ( | const char *const * |  | ) |

A sample function for hashing a C string pointer.