ucx
UAP Common Extensions
Macros | Typedefs
ucx.h File Reference

Main UCX Header providing most common definitions. More...

#include <stdlib.h>
#include <stdint.h>
#include <sys/types.h>

Go to the source code of this file.

Macros

#define UCX_VERSION_MAJOR   1
 Major UCX version as integer constant. More...
 
#define UCX_VERSION_MINOR   0
 Minor UCX version as integer constant. More...
 
#define UCX_VERSION   (((UCX_VERSION_MAJOR)<<16)|UCX_VERSION_MINOR)
 Version constant which ensures to increase monotonically. More...
 

Typedefs

typedef void(* ucx_destructor) (void *)
 A function pointer to a destructor function. More...
 
typedef int(* cmp_func) (const void *, const void *, void *)
 Function pointer to a compare function. More...
 
typedef intmax_t(* distance_func) (const void *, const void *, void *)
 Function pointer to a distance function. More...
 
typedef void *(* copy_func) (const void *, void *)
 Function pointer to a copy function. More...
 
typedef size_t(* write_func) (const void *, size_t, size_t, void *)
 Function pointer to a write function. More...
 
typedef size_t(* read_func) (void *, size_t, size_t, void *)
 Function pointer to a read function. More...
 

Detailed Description

Main UCX Header providing most common definitions.

Author
Mike Becker
Olaf Wintermann

Macro Definition Documentation

#define UCX_VERSION   (((UCX_VERSION_MAJOR)<<16)|UCX_VERSION_MINOR)

Version constant which ensures to increase monotonically.

#define UCX_VERSION_MAJOR   1

Major UCX version as integer constant.

#define UCX_VERSION_MINOR   0

Minor UCX version as integer constant.

Typedef Documentation

typedef int(* cmp_func) (const void *, const void *, void *)

Function pointer to a compare function.

The compare function shall take three arguments: the two values that shall be compared and optional additional data. The function shall then return -1 if the first argument is less than the second argument, 1 if the first argument is greater than the second argument and 0 if both arguments are equal. If the third argument is NULL, it shall be ignored.

typedef void*(* copy_func) (const void *, void *)

Function pointer to a copy function.

The copy function shall create a copy of the first argument and may use additional data provided by the second argument. If the second argument is NULL, it shall be ignored.

Attention: if pointers returned by functions of this type may be passed to free() depends on the implementation of the respective copy_func.

typedef intmax_t(* distance_func) (const void *, const void *, void *)

Function pointer to a distance function.

The distance function shall take three arguments: the two values for which the distance shall be computed and optional additional data. The function shall then return the signed distance as integer value.

typedef size_t(* read_func) (void *, size_t, size_t, void *)

Function pointer to a read function.

The signature of the read function shall be compatible to the signature of standard fread, though it may use arbitrary data types for source and destination.

The arguments shall contain (in ascending order): a pointer to the destination, the length of one element, the element count and a pointer to the source.

typedef void(* ucx_destructor) (void *)

A function pointer to a destructor function.

See also
ucx_mempool_setdestr()
ucx_mempool_regdestr()
typedef size_t(* write_func) (const void *, size_t, size_t, void *)

Function pointer to a write function.

The signature of the write function shall be compatible to the signature of standard fwrite, though it may use arbitrary data types for source and destination.

The arguments shall contain (in ascending order): a pointer to the source, the length of one element, the element count and a pointer to the destination.