GRASS Programmer's Manual
6.5.svn(2014)-r66266
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <grass/G3d.h>
#include "G3d_intern.h"
#include "cachehash.h"
Go to the source code of this file.
Data Structures | |
struct | cache_test_data_type |
Macros | |
#define | IS_ACTIVE_ELT(elt) (c->locks[elt] != 2) |
#define | IS_NOT_ACTIVE_ELT(elt) (c->locks[elt] == 2) |
#define | IS_LOCKED_ELT(elt) (c->locks[elt] == 1) |
#define | IS_UNLOCKED_ELT(elt) (c->locks[elt] == 0) |
#define | IS_NOT_IN_QUEUE_ELT(elt) (IS_LOCKED_ELT (elt)) |
#define | IS_IN_QUEUE_ELT(elt) (! IS_NOT_IN_QUEUE_ELT (elt)) |
#define | DEACTIVATE_ELT(elt) |
#define | LOCK_ELT(elt) |
#define | UNLOCK_ELT(elt) |
#define | ONE_UNLOCKED_ELT_ONLY (c->first == c->last) |
#define | ARE_MIN_UNLOCKED (c->nofUnlocked <= c->minUnlocked) |
Functions | |
void | G3d_cache_reset (G3D_cache *c) |
void | G3d_cache_dispose (G3D_cache *c) |
void * | G3d_cache_new (int nofElts, int sizeOfElts, int nofNames, int(*eltRemoveFun)(), void *eltRemoveFunData, int(*eltLoadFun)(), void *eltLoadFunData) |
void | G3d_cache_set_removeFun (G3D_cache *c, int(*eltRemoveFun)(), void *eltRemoveFunData) |
void | G3d_cache_set_loadFun (G3D_cache *c, int(*eltLoadFun)(), void *eltLoadFunData) |
void * | G3d_cache_new_read (int nofElts, int sizeOfElts, int nofNames, read_fn *eltLoadFun, void *eltLoadFunData) |
int | G3d_cache_lock (G3D_cache *c, int name) |
void | G3d_cache_lock_intern (G3D_cache *c, int index) |
int | G3d_cache_unlock (G3D_cache *c, int name) |
int | G3d_cache_unlock_all (G3D_cache *c) |
int | G3d_cache_lock_all (G3D_cache *c) |
void | G3d_cache_autolock_on (G3D_cache *c) |
void | G3d_cache_autolock_off (G3D_cache *c) |
void | G3d_cache_set_minUnlock (G3D_cache *c, int nofMinUnLocked) |
int | G3d_cache_remove_elt (G3D_cache *c, int name) |
int | G3d_cache_flush (G3D_cache *c, int name) |
int | G3d_cache_remove_all (G3D_cache *c) |
int | G3d_cache_flush_all (G3D_cache *c) |
void * | G3d_cache_elt_ptr (G3D_cache *c, int name) |
int | G3d_cache_load (G3D_cache *c, int name) |
int | G3d_cache_get_elt (G3D_cache *c, int name, void *dst) |
int | G3d_cache_put_elt (G3D_cache *c, int name, const void *src) |
int | MAIN () |
#define ARE_MIN_UNLOCKED (c->nofUnlocked <= c->minUnlocked) |
Definition at line 30 of file cache.c.
Referenced by G3d_cache_elt_ptr(), and G3d_cache_lock().
#define DEACTIVATE_ELT | ( | elt | ) |
Definition at line 19 of file cache.c.
Referenced by G3d_cache_reset().
#define IS_ACTIVE_ELT | ( | elt | ) | (c->locks[elt] != 2) |
Definition at line 12 of file cache.c.
Referenced by G3d_cache_elt_ptr(), G3d_cache_flush_all(), and G3d_cache_remove_all().
#define IS_IN_QUEUE_ELT | ( | elt | ) | (! IS_NOT_IN_QUEUE_ELT (elt)) |
#define IS_LOCKED_ELT | ( | elt | ) | (c->locks[elt] == 1) |
Definition at line 14 of file cache.c.
Referenced by G3d_cache_lock(), G3d_cache_lock_intern(), and G3d_cache_unlock_all().
#define IS_NOT_IN_QUEUE_ELT | ( | elt | ) | (IS_LOCKED_ELT (elt)) |
#define IS_UNLOCKED_ELT | ( | elt | ) | (c->locks[elt] == 0) |
Definition at line 15 of file cache.c.
Referenced by G3d_cache_elt_ptr(), G3d_cache_lock_all(), and G3d_cache_unlock().
#define LOCK_ELT | ( | elt | ) |
Definition at line 22 of file cache.c.
Referenced by G3d_cache_lock(), and G3d_cache_lock_intern().
#define ONE_UNLOCKED_ELT_ONLY (c->first == c->last) |
Definition at line 29 of file cache.c.
Referenced by G3d_cache_elt_ptr(), and G3d_cache_lock().
#define UNLOCK_ELT | ( | elt | ) |
Definition at line 25 of file cache.c.
Referenced by G3d_cache_elt_ptr(), and G3d_cache_unlock().
void G3d_cache_autolock_off | ( | G3D_cache * | c | ) |
Definition at line 360 of file cache.c.
Referenced by G3d_autolockOff().
void G3d_cache_autolock_on | ( | G3D_cache * | c | ) |
Definition at line 353 of file cache.c.
Referenced by G3d_autolockOn(), and MAIN().
void G3d_cache_dispose | ( | G3D_cache * | c | ) |
Definition at line 65 of file cache.c.
References G3d_cache_hash_dispose(), G3d_free(), and NULL.
Referenced by G3d_cache_new().
void* G3d_cache_elt_ptr | ( | G3D_cache * | c, |
int | name | ||
) |
Definition at line 466 of file cache.c.
References ARE_MIN_UNLOCKED, G3d_cache_hash_load_name(), G3d_cache_hash_name2index(), G3d_cache_hash_remove_name(), G3d_cache_lock_intern(), G3d_cache_unlock(), G3d_error(), IS_ACTIVE_ELT, IS_UNLOCKED_ELT, render::name, NULL, ONE_UNLOCKED_ELT_ONLY, and UNLOCK_ELT.
Referenced by G3d_cache_get_elt(), G3d_cache_load(), G3d_cache_put_elt(), and G3d_getTilePtr().
Definition at line 421 of file cache.c.
References G3d_error().
Referenced by G3d_cache_flush_all(), G3d_flushAllTiles(), and MAIN().
int G3d_cache_flush_all | ( | G3D_cache * | c | ) |
Definition at line 450 of file cache.c.
References G3d_cache_flush(), G3d_error(), and IS_ACTIVE_ELT.
Referenced by G3d_flushAllTiles(), and MAIN().
Definition at line 528 of file cache.c.
References G3d_cache_elt_ptr(), G3d_error(), and NULL.
Definition at line 516 of file cache.c.
References G3d_cache_elt_ptr(), G3d_error(), and NULL.
Referenced by G3d_flushAllTiles(), and MAIN().
Definition at line 267 of file cache.c.
References ARE_MIN_UNLOCKED, G3d_cache_hash_name2index(), G3d_error(), IS_LOCKED_ELT, LOCK_ELT, and ONE_UNLOCKED_ELT_ONLY.
Referenced by G3d_lockTile().
int G3d_cache_lock_all | ( | G3D_cache * | c | ) |
Definition at line 340 of file cache.c.
References G3d_cache_lock_intern(), and IS_UNLOCKED_ELT.
void G3d_cache_lock_intern | ( | G3D_cache * | c, |
int | index | ||
) |
Definition at line 292 of file cache.c.
References IS_LOCKED_ELT, and LOCK_ELT.
Referenced by G3d_cache_elt_ptr(), and G3d_cache_lock_all().
void* G3d_cache_new | ( | int | nofElts, |
int | sizeOfElts, | ||
int | nofNames, | ||
int(*)() | eltRemoveFun, | ||
void * | eltRemoveFunData, | ||
int(*)() | eltLoadFun, | ||
void * | eltLoadFunData | ||
) |
Definition at line 88 of file cache.c.
References G3d_cache_dispose(), G3d_cache_hash_new(), G3d_cache_reset(), G3d_error(), G3d_malloc(), and NULL.
Referenced by G3d_cache_new_read(), and MAIN().
void* G3d_cache_new_read | ( | int | nofElts, |
int | sizeOfElts, | ||
int | nofNames, | ||
read_fn * | eltLoadFun, | ||
void * | eltLoadFunData | ||
) |
Definition at line 162 of file cache.c.
References G3d_cache_new(), and NULL.
Definition at line 545 of file cache.c.
References G3d_cache_elt_ptr(), G3d_error(), and NULL.
int G3d_cache_remove_all | ( | G3D_cache * | c | ) |
Definition at line 433 of file cache.c.
References G3d_cache_remove_elt(), G3d_error(), and IS_ACTIVE_ELT.
Referenced by G3d_flushAllTiles().
Definition at line 409 of file cache.c.
References G3d_error().
Referenced by G3d__removeTile(), and G3d_cache_remove_all().
void G3d_cache_reset | ( | G3D_cache * | c | ) |
Definition at line 34 of file cache.c.
References DEACTIVATE_ELT, and G3d_cache_hash_reset().
Referenced by G3d_cache_new(), and MAIN().
void G3d_cache_set_loadFun | ( | G3D_cache * | c, |
int(*)() | eltLoadFun, | ||
void * | eltLoadFunData | ||
) |
void G3d_cache_set_minUnlock | ( | G3D_cache * | c, |
int | nofMinUnLocked | ||
) |
Definition at line 367 of file cache.c.
Referenced by G3d_minUnlocked().
void G3d_cache_set_removeFun | ( | G3D_cache * | c, |
int(*)() | eltRemoveFun, | ||
void * | eltRemoveFunData | ||
) |
Definition at line 143 of file cache.c.
Referenced by G3d_flushAllTiles().
Definition at line 303 of file cache.c.
References G3d_cache_hash_name2index(), G3d_error(), IS_UNLOCKED_ELT, and UNLOCK_ELT.
Referenced by G3d_cache_elt_ptr(), G3d_cache_unlock_all(), and G3d_unlockTile().
int G3d_cache_unlock_all | ( | G3D_cache * | c | ) |
Definition at line 324 of file cache.c.
References G3d_cache_unlock(), G3d_error(), and IS_LOCKED_ELT.
Referenced by G3d_unlockAll(), and MAIN().
int MAIN | ( | ) |
Definition at line 650 of file cache.c.
References G3d_cache_autolock_on(), G3d_cache_flush(), G3d_cache_flush_all(), G3d_cache_load(), G3d_cache_new(), G3d_cache_reset(), G3d_cache_unlock_all(), and NULL.