GRASS GIS 7 Programmer's Manual  7.5.svn(2018)-r72886
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cache1.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <grass/raster3d.h>
#include "raster3d_intern.h"
#include "cachehash.h"
Include dependency graph for cache1.c:

Go to the source code of this file.

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 Rast3d_cache_reset (RASTER3D_cache *c)
 
void Rast3d_cache_dispose (RASTER3D_cache *c)
 
void * Rast3d_cache_new (int nofElts, int sizeOfElts, int nofNames, int(*eltRemoveFun)(), void *eltRemoveFunData, int(*eltLoadFun)(), void *eltLoadFunData)
 
void Rast3d_cache_set_remove_fun (RASTER3D_cache *c, int(*eltRemoveFun)(), void *eltRemoveFunData)
 
void Rast3d_cache_set_load_fun (RASTER3D_cache *c, int(*eltLoadFun)(), void *eltLoadFunData)
 
void * Rast3d_cache_new_read (int nofElts, int sizeOfElts, int nofNames, read_fn *eltLoadFun, void *eltLoadFunData)
 
int Rast3d_cache_lock (RASTER3D_cache *c, int name)
 
void Rast3d_cache_lock_intern (RASTER3D_cache *c, int index)
 
int Rast3d_cache_unlock (RASTER3D_cache *c, int name)
 
int Rast3d_cache_unlock_all (RASTER3D_cache *c)
 
int Rast3d_cache_lock_all (RASTER3D_cache *c)
 
void Rast3d_cache_autolock_on (RASTER3D_cache *c)
 
void Rast3d_cache_autolock_off (RASTER3D_cache *c)
 
void Rast3d_cache_set_min_unlock (RASTER3D_cache *c, int nofMinUnLocked)
 
int Rast3d_cache_remove_elt (RASTER3D_cache *c, int name)
 
int Rast3d_cache_flush (RASTER3D_cache *c, int name)
 
int Rast3d_cache_remove_all (RASTER3D_cache *c)
 
int Rast3d_cache_flush_all (RASTER3D_cache *c)
 
void * Rast3d_cache_elt_ptr (RASTER3D_cache *c, int name)
 
int Rast3d_cache_load (RASTER3D_cache *c, int name)
 
int Rast3d_cache_get_elt (RASTER3D_cache *c, int name, void *dst)
 
int Rast3d_cache_put_elt (RASTER3D_cache *c, int name, const void *src)
 
int MAIN ()
 

Macro Definition Documentation

#define ARE_MIN_UNLOCKED   (c->nofUnlocked <= c->minUnlocked)

Definition at line 30 of file cache1.c.

Referenced by Rast3d_cache_elt_ptr(), and Rast3d_cache_lock().

#define DEACTIVATE_ELT (   elt)
Value:
((IS_LOCKED_ELT(elt) ? \
(c->nofUnlocked)++ : (0)), \
c->locks[elt] = 2)
#define IS_LOCKED_ELT(elt)
Definition: cache1.c:14

Definition at line 19 of file cache1.c.

Referenced by Rast3d_cache_reset().

#define IS_ACTIVE_ELT (   elt)    (c->locks[elt] != 2)

Definition at line 12 of file cache1.c.

Referenced by Rast3d_cache_elt_ptr(), Rast3d_cache_flush_all(), and Rast3d_cache_remove_all().

#define IS_IN_QUEUE_ELT (   elt)    (! IS_NOT_IN_QUEUE_ELT (elt))

Definition at line 17 of file cache1.c.

#define IS_LOCKED_ELT (   elt)    (c->locks[elt] == 1)

Definition at line 14 of file cache1.c.

Referenced by Rast3d_cache_lock(), Rast3d_cache_lock_intern(), and Rast3d_cache_unlock_all().

#define IS_NOT_ACTIVE_ELT (   elt)    (c->locks[elt] == 2)

Definition at line 13 of file cache1.c.

#define IS_NOT_IN_QUEUE_ELT (   elt)    (IS_LOCKED_ELT (elt))

Definition at line 16 of file cache1.c.

#define IS_UNLOCKED_ELT (   elt)    (c->locks[elt] == 0)

Definition at line 15 of file cache1.c.

Referenced by Rast3d_cache_elt_ptr(), Rast3d_cache_lock_all(), and Rast3d_cache_unlock().

#define LOCK_ELT (   elt)
Value:
((IS_LOCKED_ELT(elt) ? \
(0) : (c->nofUnlocked)--), \
(c->locks[elt] = 1))
#define IS_LOCKED_ELT(elt)
Definition: cache1.c:14

Definition at line 22 of file cache1.c.

Referenced by Rast3d_cache_lock(), and Rast3d_cache_lock_intern().

#define ONE_UNLOCKED_ELT_ONLY   (c->first == c->last)

Definition at line 29 of file cache1.c.

Referenced by Rast3d_cache_elt_ptr(), and Rast3d_cache_lock().

#define UNLOCK_ELT (   elt)
Value:
((IS_LOCKED_ELT(elt) ? \
(c->nofUnlocked)++ : (0)), \
(c->locks[elt] = 0))
#define IS_LOCKED_ELT(elt)
Definition: cache1.c:14

Definition at line 25 of file cache1.c.

Referenced by Rast3d_cache_elt_ptr(), and Rast3d_cache_unlock().

Function Documentation

void Rast3d_cache_autolock_off ( RASTER3D_cache c)

Definition at line 359 of file cache1.c.

References RASTER3D_cache::autoLock.

Referenced by Rast3d_autolock_off().

void Rast3d_cache_autolock_on ( RASTER3D_cache c)

Definition at line 352 of file cache1.c.

References RASTER3D_cache::autoLock.

Referenced by MAIN(), and Rast3d_autolock_on().

int Rast3d_cache_flush ( RASTER3D_cache c,
int  name 
)

Definition at line 420 of file cache1.c.

References Rast3d_error().

Referenced by MAIN(), Rast3d_cache_flush_all(), and Rast3d_flush_all_tiles().

int Rast3d_cache_flush_all ( RASTER3D_cache c)
int Rast3d_cache_get_elt ( RASTER3D_cache c,
int  name,
void *  dst 
)

Definition at line 527 of file cache1.c.

References RASTER3D_cache::eltSize, NULL, Rast3d_cache_elt_ptr(), and Rast3d_error().

int Rast3d_cache_load ( RASTER3D_cache c,
int  name 
)

Definition at line 515 of file cache1.c.

References NULL, Rast3d_cache_elt_ptr(), and Rast3d_error().

Referenced by MAIN(), and Rast3d_flush_all_tiles().

int Rast3d_cache_lock ( RASTER3D_cache c,
int  name 
)
int Rast3d_cache_lock_all ( RASTER3D_cache c)

Definition at line 339 of file cache1.c.

References IS_UNLOCKED_ELT, RASTER3D_cache::nofElts, and Rast3d_cache_lock_intern().

void Rast3d_cache_lock_intern ( RASTER3D_cache c,
int  index 
)

Definition at line 291 of file cache1.c.

References IS_LOCKED_ELT, and LOCK_ELT.

Referenced by Rast3d_cache_elt_ptr(), and Rast3d_cache_lock_all().

void* Rast3d_cache_new_read ( int  nofElts,
int  sizeOfElts,
int  nofNames,
read_fn eltLoadFun,
void *  eltLoadFunData 
)

Definition at line 161 of file cache1.c.

References NULL, and Rast3d_cache_new().

int Rast3d_cache_put_elt ( RASTER3D_cache c,
int  name,
const void *  src 
)

Definition at line 544 of file cache1.c.

References RASTER3D_cache::eltSize, NULL, Rast3d_cache_elt_ptr(), and Rast3d_error().

int Rast3d_cache_remove_all ( RASTER3D_cache c)
int Rast3d_cache_remove_elt ( RASTER3D_cache c,
int  name 
)

Definition at line 408 of file cache1.c.

References Rast3d_error().

Referenced by Rast3d__remove_tile(), and Rast3d_cache_remove_all().

void Rast3d_cache_set_load_fun ( RASTER3D_cache c,
int(*)()  eltLoadFun,
void *  eltLoadFunData 
)

Definition at line 152 of file cache1.c.

References RASTER3D_cache::eltLoadFun, and RASTER3D_cache::eltLoadFunData.

void Rast3d_cache_set_min_unlock ( RASTER3D_cache c,
int  nofMinUnLocked 
)

Definition at line 366 of file cache1.c.

References RASTER3D_cache::minUnlocked.

Referenced by Rast3d_min_unlocked().

void Rast3d_cache_set_remove_fun ( RASTER3D_cache c,
int(*)()  eltRemoveFun,
void *  eltRemoveFunData 
)

Definition at line 142 of file cache1.c.

References RASTER3D_cache::eltRemoveFun, and RASTER3D_cache::eltRemoveFunData.

Referenced by Rast3d_flush_all_tiles().

int Rast3d_cache_unlock_all ( RASTER3D_cache c)