Guardtime KSI c SDK
Macros | Typedefs | Functions
Lists

Macros

#define KSI_LIST(type)   type##List
 
#define KSI_NEW_LIST(type, list)   KSI_List_new(type##_free, (list))
 
#define KSI_NEW_REFLIST(type, list)   KSI_RefList_new(type##_free, type##_ref, (list))
 
#define KSI_LIST_FN_NAME(type, name)   type##List_##name
 
#define KSI_DEFINE_LIST_STRUCT(ltype, rtype)
 
#define KSI_DEFINE_LIST(type)
 
#define KSI_IMPLEMENT_LIST(type, free_fn)
 

Typedefs

typedef struct KSI_List_st KSI_List
 

Functions

void KSI_List_free (KSI_List *list)
 
int KSI_List_new (void(*obj_free)(void *), KSI_List **list)
 
int KSI_List_append (KSI_List *list, void *o)
 
int KSI_List_remove (KSI_List *list, size_t pos, void **o)
 
int KSI_List_indexOf (KSI_List *list, void *o, size_t **i)
 
int KSI_List_insertAt (KSI_List *list, size_t pos, void *o)
 
int KSI_List_replaceAt (KSI_List *list, size_t pos, void *o)
 
int KSI_List_elementAt (KSI_List *list, size_t pos, void **o)
 
size_t KSI_List_length (KSI_List *list)
 
int KSI_List_sort (KSI_List *list, int(*)(const void **, const void **))
 
int KSI_List_foldl (KSI_List *list, void *foldCtx, int(*fn)(void *el, void *foldCtx))
 
int KSI_List_find (KSI_List *list, void *el, int *found, size_t *pos)
 

Detailed Description

Macro Definition Documentation

#define KSI_DEFINE_LIST (   type)
Value:
typedef struct type##_list_st KSI_LIST(type); \
struct type##_list_st { \
}; \
int KSI_LIST_FN_NAME(type, new)(KSI_LIST(type) **list); \
void KSI_LIST_FN_NAME(type, free)(KSI_LIST(type) *list); \
#define KSI_LIST_FN_NAME(type, name)
Definition: list.h:65
#define KSI_DEFINE_LIST_STRUCT(ltype, rtype)
Definition: list.h:67
#define KSI_LIST(type)
Definition: list.h:44

This macro defines a new list of given type.

Parameters
[in]typeType of the elements stored in the list.
#define KSI_DEFINE_LIST_STRUCT (   ltype,
  rtype 
)
#define KSI_IMPLEMENT_LIST (   type,
  free_fn 
)
Value:
int KSI_LIST_FN_NAME(type, new)(KSI_LIST(type) **list) { \
return KSI_List_new((void (*)(void *))free_fn, (KSI_List **)list); \
} \
void KSI_LIST_FN_NAME(type, free)(KSI_LIST(type) *list) { \
} \
void KSI_List_free(KSI_List *list)
#define KSI_LIST_FN_NAME(type, name)
Definition: list.h:65
int KSI_List_new(void(*obj_free)(void *), KSI_List **list)
#define KSI_LIST(type)
Definition: list.h:44
struct KSI_List_st KSI_List
Definition: list.h:38

This macro implements all the functions of a list for a given type.

Parameters
[in]typeThe type of the elements stored in the list.
[in]free_fnFunction pointer to the free method of stored elements. May be NULL
#define KSI_LIST (   type)    type##List

Macro to get the list type name for a given type.

Parameters
[in]typeType of the list.
#define KSI_LIST_FN_NAME (   type,
  name 
)    type##List_##name

Generates the function name for a list with a given type.

Parameters
[in]typeType of the list.
[in]nameName of the function.
#define KSI_NEW_LIST (   type,
  list 
)    KSI_List_new(type##_free, (list))

Experimental macro for creating lists.

Parameters
[in]typeType of the list.
[out]listPointer to the receiving pointer.
#define KSI_NEW_REFLIST (   type,
  list 
)    KSI_RefList_new(type##_free, type##_ref, (list))

Experimental macro for creating lists.

Parameters
[in]typeType of the list.
[out]listPointer to the receiving pointer.

Typedef Documentation

typedef struct KSI_List_st KSI_List

Generic list type for storing void* pointers.

Function Documentation

int KSI_List_append ( KSI_List list,
void *  o 
)
int KSI_List_elementAt ( KSI_List list,
size_t  pos,
void **  o 
)
int KSI_List_find ( KSI_List list,
void *  el,
int *  found,
size_t *  pos 
)
int KSI_List_foldl ( KSI_List list,
void *  foldCtx,
int(*)(void *el, void *foldCtx)  fn 
)
void KSI_List_free ( KSI_List list)
int KSI_List_indexOf ( KSI_List list,
void *  o,
size_t **  i 
)
int KSI_List_insertAt ( KSI_List list,
size_t  pos,
void *  o 
)
size_t KSI_List_length ( KSI_List list)
int KSI_List_new ( void(*)(void *)  obj_free,
KSI_List **  list 
)
int KSI_List_remove ( KSI_List list,
size_t  pos,
void **  o 
)
int KSI_List_replaceAt ( KSI_List list,
size_t  pos,
void *  o 
)
int KSI_List_sort ( KSI_List list,
int(*)(const void **, const void **)   
)