gwenhywfar  5.11.1beta
Typedefs | Enumerations
idmap.h File Reference
#include <gwenhywfar/types.h>
#include <stdio.h>

Go to the source code of this file.

Typedefs

typedef struct GWEN_IDMAP GWEN_IDMAP
 

Enumerations

enum  GWEN_IDMAP_ALGO { GWEN_IdMapAlgo_Unknown =0 , GWEN_IdMapAlgo_Hex4 }
 
enum  GWEN_IDMAP_RESULT { GWEN_IdMapResult_Ok =0 , GWEN_IdMapResult_NoFit , GWEN_IdMapResult_NotFound }
 

Macros for Typesafe ID maps

#define GWEN_DUMMY_EMPTY_ARG
 
GWENHYWFAR_API void GWEN_IdMap_Clear (GWEN_IDMAP *map)
 
GWENHYWFAR_API void GWEN_IdMap_Dump (GWEN_IDMAP *map, FILE *f, int indent)
 
GWENHYWFAR_API void * GWEN_IdMap_Find (GWEN_IDMAP *map, uint32_t id)
 
GWENHYWFAR_API void GWEN_IdMap_free (GWEN_IDMAP *map)
 
#define GWEN_IDMAP_FUNCTION_DEFS(t, pr)    GWEN_IDMAP_FUNCTION_LIB_DEFS(t, pr, GWEN_DUMMY_EMPTY_ARG)
 
#define GWEN_IDMAP_FUNCTION_LIB_DEFS(t, pr, decl)
 
#define GWEN_IDMAP_FUNCTIONS(t, pr)
 
GWENHYWFAR_API GWEN_IDMAP_RESULT GWEN_IdMap_GetFirst (const GWEN_IDMAP *map, uint32_t *pid)
 
GWENHYWFAR_API GWEN_IDMAP_RESULT GWEN_IdMap_GetNext (const GWEN_IDMAP *map, uint32_t *pid)
 
GWENHYWFAR_API uint32_t GWEN_IdMap_GetSize (const GWEN_IDMAP *map)
 
GWENHYWFAR_API GWEN_IDMAP_RESULT GWEN_IdMap_Insert (GWEN_IDMAP *map, uint32_t id, void *ptr)
 
GWENHYWFAR_API GWEN_IDMAPGWEN_IdMap_new (GWEN_IDMAP_ALGO algo)
 
GWENHYWFAR_API GWEN_IDMAP_RESULT GWEN_IdMap_Remove (GWEN_IDMAP *map, uint32_t id)
 

Macro Definition Documentation

◆ GWEN_DUMMY_EMPTY_ARG

#define GWEN_DUMMY_EMPTY_ARG

Necessary for MSVC compiler because it does not accept a left-out macro argument.

Definition at line 60 of file idmap.h.

◆ GWEN_IDMAP_FUNCTION_DEFS

#define GWEN_IDMAP_FUNCTION_DEFS (   t,
  pr 
)     GWEN_IDMAP_FUNCTION_LIB_DEFS(t, pr, GWEN_DUMMY_EMPTY_ARG)

Definition at line 85 of file idmap.h.

◆ GWEN_IDMAP_FUNCTION_LIB_DEFS

#define GWEN_IDMAP_FUNCTION_LIB_DEFS (   t,
  pr,
  decl 
)
Value:
typedef GWEN_IDMAP t##_IDMAP; \
\
decl t##_IDMAP *pr##_IdMap_new(GWEN_IDMAP_ALGO algo); \
decl void pr##_IdMap_free(t##_IDMAP *l); \
decl void pr##_IdMap_freeAll(t##_IDMAP *l); \
decl void pr##_IdMap_FreeItems(t##_IDMAP *l); \
decl GWEN_IDMAP_RESULT pr##_IdMap_Insert(t##_IDMAP *l, \
uint32_t id, \
t* ptr); \
decl GWEN_IDMAP_RESULT pr##_IdMap_Remove(t##_IDMAP *l, \
uint32_t id); \
decl t* pr##_IdMap_Find(t##_IDMAP *l, uint32_t id); \
decl GWEN_IDMAP_RESULT pr##_IdMap_GetFirst(const t##_IDMAP *map, \
uint32_t *pid); \
decl GWEN_IDMAP_RESULT pr##_IdMap_GetNext(const t##_IDMAP *map, \
uint32_t *pid); \
decl uint32_t pr##_IdMap_GetSize(const GWEN_IDMAP *map); \
decl void pr##_IdMap_Clear(GWEN_IDMAP *l);
GWEN_IDMAP_RESULT
Definition: idmap.h:40
struct GWEN_IDMAP GWEN_IDMAP
Definition: idmap.h:38
GWEN_IDMAP_ALGO
Definition: idmap.h:47

Definition at line 64 of file idmap.h.

◆ GWEN_IDMAP_FUNCTIONS

#define GWEN_IDMAP_FUNCTIONS (   t,
  pr 
)

Definition at line 89 of file idmap.h.

Typedef Documentation

◆ GWEN_IDMAP

typedef struct GWEN_IDMAP GWEN_IDMAP

Definition at line 1 of file idmap.h.

Enumeration Type Documentation

◆ GWEN_IDMAP_ALGO

Enumerator
GWEN_IdMapAlgo_Unknown 
GWEN_IdMapAlgo_Hex4 

Definition at line 47 of file idmap.h.

◆ GWEN_IDMAP_RESULT

Enumerator
GWEN_IdMapResult_Ok 
GWEN_IdMapResult_NoFit 
GWEN_IdMapResult_NotFound 

Definition at line 40 of file idmap.h.

Function Documentation

◆ GWEN_IdMap_Clear()

GWENHYWFAR_API void GWEN_IdMap_Clear ( GWEN_IDMAP map)

◆ GWEN_IdMap_Dump()

GWENHYWFAR_API void GWEN_IdMap_Dump ( GWEN_IDMAP map,
FILE *  f,
int  indent 
)

◆ GWEN_IdMap_Find()

GWENHYWFAR_API void* GWEN_IdMap_Find ( GWEN_IDMAP map,
uint32_t  id 
)

◆ GWEN_IdMap_free()

GWENHYWFAR_API void GWEN_IdMap_free ( GWEN_IDMAP map)

◆ GWEN_IdMap_GetFirst()

GWENHYWFAR_API GWEN_IDMAP_RESULT GWEN_IdMap_GetFirst ( const GWEN_IDMAP map,
uint32_t *  pid 
)

Return the first id in the map.

Parameters
mapmap to browse
pidpointer to a variable to receive the first id in the map. Upon return this variable will be updated to the first id in the map if the result is GWEN_IdMapResult_Ok.

◆ GWEN_IdMap_GetNext()

GWENHYWFAR_API GWEN_IDMAP_RESULT GWEN_IdMap_GetNext ( const GWEN_IDMAP map,
uint32_t *  pid 
)

Return the next id in the map.

Parameters
mapmap to browse
pidpointer to the id retrieved via GWEN_IdMap_GetFirst. Upon return this variable will be updated to the next id in the map if the result is GWEN_IdMapResult_Ok.

◆ GWEN_IdMap_GetSize()

GWENHYWFAR_API uint32_t GWEN_IdMap_GetSize ( const GWEN_IDMAP map)

◆ GWEN_IdMap_Insert()

GWENHYWFAR_API GWEN_IDMAP_RESULT GWEN_IdMap_Insert ( GWEN_IDMAP map,
uint32_t  id,
void *  ptr 
)

◆ GWEN_IdMap_new()

GWENHYWFAR_API GWEN_IDMAP* GWEN_IdMap_new ( GWEN_IDMAP_ALGO  algo)

◆ GWEN_IdMap_Remove()

GWENHYWFAR_API GWEN_IDMAP_RESULT GWEN_IdMap_Remove ( GWEN_IDMAP map,
uint32_t  id 
)