Blender  V2.59
Classes | Typedefs | Functions | Variables
BLI_ghash.h File Reference

A general (pointer -> pointer) hash table ADT. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "BLI_mempool.h"
#include "BLI_blenlib.h"

Go to the source code of this file.

Classes

struct  Entry
struct  GHash
struct  GHashIterator

Typedefs

typedef unsigned int(* GHashHashFP )(const void *key)
typedef int(* GHashCmpFP )(const void *a, const void *b)
typedef void(* GHashKeyFreeFP )(void *key)
typedef void(* GHashValFreeFP )(void *val)
typedef struct Entry Entry
typedef struct GHash GHash
typedef struct GHashIterator GHashIterator

Functions

GHashBLI_ghash_new (GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info)
void BLI_ghash_free (GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
int BLI_ghash_size (GHash *gh)
GHashIteratorBLI_ghashIterator_new (GHash *gh)
void BLI_ghashIterator_init (GHashIterator *ghi, GHash *gh)
void BLI_ghashIterator_free (GHashIterator *ghi)
void * BLI_ghashIterator_getKey (GHashIterator *ghi)
void * BLI_ghashIterator_getValue (GHashIterator *ghi)
void BLI_ghashIterator_step (GHashIterator *ghi)
int BLI_ghashIterator_isDone (GHashIterator *ghi)
unsigned int BLI_ghashutil_ptrhash (const void *key)
int BLI_ghashutil_ptrcmp (const void *a, const void *b)
unsigned int BLI_ghashutil_strhash (const void *key)
int BLI_ghashutil_strcmp (const void *a, const void *b)
unsigned int BLI_ghashutil_inthash (const void *ptr)
int BLI_ghashutil_intcmp (const void *a, const void *b)
BM_INLINE void BLI_ghash_insert (GHash *gh, void *key, void *val)
BM_INLINE void * BLI_ghash_lookup (GHash *gh, const void *key)
BM_INLINE int BLI_ghash_remove (GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
BM_INLINE int BLI_ghash_haskey (GHash *gh, void *key)

Variables

unsigned int hashsizes []

Detailed Description

A general (pointer -> pointer) hash table ADT.

Definition in file BLI_ghash.h.


Typedef Documentation

typedef struct Entry Entry
typedef struct GHash GHash
typedef int(* GHashCmpFP)(const void *a, const void *b)

Definition at line 50 of file BLI_ghash.h.

typedef unsigned int(* GHashHashFP)(const void *key)

Definition at line 49 of file BLI_ghash.h.

typedef struct GHashIterator GHashIterator
typedef void(* GHashKeyFreeFP)(void *key)

Definition at line 51 of file BLI_ghash.h.

typedef void(* GHashValFreeFP)(void *val)

Definition at line 52 of file BLI_ghash.h.


Function Documentation

void BLI_ghash_free ( GHash gh,
GHashKeyFreeFP  keyfreefp,
GHashValFreeFP  valfreefp 
)
BM_INLINE int BLI_ghash_haskey ( GHash gh,
void *  key 
)
BM_INLINE void BLI_ghash_insert ( GHash gh,
void *  key,
void *  val 
)
BM_INLINE void* BLI_ghash_lookup ( GHash gh,
const void *  key 
)
GHash* BLI_ghash_new ( GHashHashFP  hashfp,
GHashCmpFP  cmpfp,
const char *  info 
)
BM_INLINE int BLI_ghash_remove ( GHash gh,
void *  key,
GHashKeyFreeFP  keyfreefp,
GHashValFreeFP  valfreefp 
)
int BLI_ghash_size ( GHash gh)
void BLI_ghashIterator_free ( GHashIterator ghi)
void* BLI_ghashIterator_getKey ( GHashIterator ghi)

Retrieve the key from an iterator.

Parameters:
ghiThe iterator.
Returns:
The key at the current index, or NULL if the iterator is done.

Definition at line 134 of file BLI_ghash.c.

References GHashIterator::curEntry, Entry::key, and NULL.

Referenced by applyModifier(), BIF_currentTemplate(), BIF_listTemplates(), BLI_pbvh_get_grid_updates(), build_mesh_leaf_node(), dupli_keyIndexHash(), sb_detect_aabb_collisionCached(), sb_detect_edge_collisionCached(), sb_detect_face_collisionCached(), sb_detect_face_pointCached(), and sb_detect_vertex_collisionCached().

void* BLI_ghashIterator_getValue ( GHashIterator ghi)
void BLI_ghashIterator_init ( GHashIterator ghi,
GHash gh 
)

Init an already allocated GHashIterator. The hash table must not be mutated while the iterator is in use, and the iterator will step exactly BLI_ghash_size(gh) times before becoming done.

Parameters:
ghiThe GHashIterator to initialize.
ghThe GHash to iterate over.

Definition at line 119 of file BLI_ghash.c.

References GHash::buckets, GHashIterator::curBucket, GHashIterator::curEntry, GHashIterator::gh, GHash::nbuckets, and NULL.

Referenced by BIF_currentTemplate(), BIF_listTemplates(), filterSmartReebGraph(), mergeArcFaces(), and RIG_reconnectControlBones().

int BLI_ghashIterator_isDone ( GHashIterator ghi)
GHashIterator* BLI_ghashIterator_new ( GHash gh)

Create a new GHashIterator. The hash table must not be mutated while the iterator is in use, and the iterator will step exactly BLI_ghash_size(gh) times before becoming done.

Parameters:
ghThe GHash to iterate over.
Returns:
Pointer to a new DynStr.

Definition at line 106 of file BLI_ghash.c.

References GHash::buckets, GHashIterator::curBucket, GHashIterator::curEntry, GHashIterator::gh, MEM_mallocN(), GHash::nbuckets, and NULL.

Referenced by applyModifier(), BLI_pbvh_get_grid_updates(), build_mesh_leaf_node(), dupli_keyIndexHash(), free_sss(), sb_detect_aabb_collisionCached(), sb_detect_edge_collisionCached(), sb_detect_face_collisionCached(), sb_detect_face_pointCached(), sb_detect_vertex_collisionCached(), WM_menutype_contains(), WM_menutype_free(), and WM_operatortype_iter().

void BLI_ghashIterator_step ( GHashIterator ghi)
int BLI_ghashutil_intcmp ( const void *  a,
const void *  b 
)
unsigned int BLI_ghashutil_inthash ( const void *  ptr)
int BLI_ghashutil_ptrcmp ( const void *  a,
const void *  b 
)
unsigned int BLI_ghashutil_ptrhash ( const void *  key)
int BLI_ghashutil_strcmp ( const void *  a,
const void *  b 
)
unsigned int BLI_ghashutil_strhash ( const void *  key)

Variable Documentation

unsigned int hashsizes[]

Definition at line 43 of file BLI_ghash.c.

Referenced by BLI_edgehash_insert(), BLI_edgehash_new(), and BLI_ghash_new().