GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-d6dec75dd4
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)    ((IS_LOCKED_ELT(elt) ? (c->nofUnlocked)++ : (0)), c->locks[elt] = 2)
 
#define LOCK_ELT(elt)    ((IS_LOCKED_ELT(elt) ? (0) : (c->nofUnlocked)--), (c->locks[elt] = 1))
 
#define UNLOCK_ELT(elt)    ((IS_LOCKED_ELT(elt) ? (c->nofUnlocked)++ : (0)), (c->locks[elt] = 0))
 
#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)(int, const void *, void *), void *eltRemoveFunData, int(*eltLoadFun)(int, void *, void *), void *eltLoadFunData)
 
void Rast3d_cache_set_remove_fun (RASTER3D_cache *c, int(*eltRemoveFun)(int, const void *, void *), void *eltRemoveFunData)
 
void Rast3d_cache_set_load_fun (RASTER3D_cache *c, int(*eltLoadFun)(int, void *, void *), 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 (void)
 

Macro Definition Documentation

◆ ARE_MIN_UNLOCKED

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

Definition at line 27 of file cache1.c.

◆ DEACTIVATE_ELT

#define DEACTIVATE_ELT (   elt)     ((IS_LOCKED_ELT(elt) ? (c->nofUnlocked)++ : (0)), c->locks[elt] = 2)

Definition at line 19 of file cache1.c.

◆ IS_ACTIVE_ELT

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

Definition at line 12 of file cache1.c.

◆ IS_IN_QUEUE_ELT

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

Definition at line 17 of file cache1.c.

◆ IS_LOCKED_ELT

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

Definition at line 14 of file cache1.c.

◆ IS_NOT_ACTIVE_ELT

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

Definition at line 13 of file cache1.c.

◆ IS_NOT_IN_QUEUE_ELT

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

Definition at line 16 of file cache1.c.

◆ IS_UNLOCKED_ELT

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

Definition at line 15 of file cache1.c.

◆ LOCK_ELT

#define LOCK_ELT (   elt)     ((IS_LOCKED_ELT(elt) ? (0) : (c->nofUnlocked)--), (c->locks[elt] = 1))

Definition at line 21 of file cache1.c.

◆ ONE_UNLOCKED_ELT_ONLY

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

Definition at line 26 of file cache1.c.

◆ UNLOCK_ELT

#define UNLOCK_ELT (   elt)     ((IS_LOCKED_ELT(elt) ? (c->nofUnlocked)++ : (0)), (c->locks[elt] = 0))

Definition at line 23 of file cache1.c.

Function Documentation

◆ MAIN()

int MAIN ( void  )

Definition at line 652 of file cache1.c.

◆ Rast3d_cache_autolock_off()

void Rast3d_cache_autolock_off ( RASTER3D_cache c)

Definition at line 361 of file cache1.c.

Referenced by Rast3d_autolock_off().

◆ Rast3d_cache_autolock_on()

void Rast3d_cache_autolock_on ( RASTER3D_cache c)

Definition at line 354 of file cache1.c.

Referenced by Rast3d_autolock_on().

◆ Rast3d_cache_dispose()

void Rast3d_cache_dispose ( RASTER3D_cache c)

Definition at line 63 of file cache1.c.

◆ Rast3d_cache_elt_ptr()

void* Rast3d_cache_elt_ptr ( RASTER3D_cache c,
int  name 
)

Definition at line 468 of file cache1.c.

Referenced by Rast3d_get_tile_ptr().

◆ Rast3d_cache_flush()

int Rast3d_cache_flush ( RASTER3D_cache c,
int  name 
)

Definition at line 422 of file cache1.c.

◆ Rast3d_cache_flush_all()

int Rast3d_cache_flush_all ( RASTER3D_cache c)

Definition at line 451 of file cache1.c.

◆ Rast3d_cache_get_elt()

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

Definition at line 530 of file cache1.c.

◆ Rast3d_cache_load()

int Rast3d_cache_load ( RASTER3D_cache c,
int  name 
)

Definition at line 518 of file cache1.c.

◆ Rast3d_cache_lock()

int Rast3d_cache_lock ( RASTER3D_cache c,
int  name 
)

Definition at line 267 of file cache1.c.

Referenced by Rast3d_lock_tile().

◆ Rast3d_cache_lock_all()

int Rast3d_cache_lock_all ( RASTER3D_cache c)

Definition at line 341 of file cache1.c.

◆ Rast3d_cache_lock_intern()

void Rast3d_cache_lock_intern ( RASTER3D_cache c,
int  index 
)

Definition at line 292 of file cache1.c.

◆ Rast3d_cache_new()

void* Rast3d_cache_new ( int  nofElts,
int  sizeOfElts,
int  nofNames,
int(*)(int, const void *, void *)  eltRemoveFun,
void *  eltRemoveFunData,
int(*)(int, void *, void *)  eltLoadFun,
void *  eltLoadFunData 
)

Definition at line 86 of file cache1.c.

Referenced by Rast3d_cache_new_read().

◆ Rast3d_cache_new_read()

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 Rast3d_cache_new().

◆ Rast3d_cache_put_elt()

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

Definition at line 547 of file cache1.c.

◆ Rast3d_cache_remove_all()

int Rast3d_cache_remove_all ( RASTER3D_cache c)

Definition at line 434 of file cache1.c.

Referenced by Rast3d_flush_all_tiles().

◆ Rast3d_cache_remove_elt()

int Rast3d_cache_remove_elt ( RASTER3D_cache c,
int  name 
)

Definition at line 410 of file cache1.c.

Referenced by Rast3d__remove_tile().

◆ Rast3d_cache_reset()

void Rast3d_cache_reset ( RASTER3D_cache c)

Definition at line 31 of file cache1.c.

◆ Rast3d_cache_set_load_fun()

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

Definition at line 151 of file cache1.c.

◆ Rast3d_cache_set_min_unlock()

void Rast3d_cache_set_min_unlock ( RASTER3D_cache c,
int  nofMinUnLocked 
)

Definition at line 368 of file cache1.c.

Referenced by Rast3d_min_unlocked().

◆ Rast3d_cache_set_remove_fun()

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

Definition at line 141 of file cache1.c.

◆ Rast3d_cache_unlock()

int Rast3d_cache_unlock ( RASTER3D_cache c,
int  name 
)

Definition at line 303 of file cache1.c.

Referenced by Rast3d_unlock_tile().

◆ Rast3d_cache_unlock_all()

int Rast3d_cache_unlock_all ( RASTER3D_cache c)

Definition at line 324 of file cache1.c.

Referenced by Rast3d_unlock_all().