libdacav 0.9.0
Generic Data Types

This module declares some general use data types. More...

Data Structures

struct  dcprm_t
 Pair of callbacks for copy construction and for distruction of a generic item. More...

Typedefs

typedef void(* dfree_cb_t )(void *obj)
 Memory free callback function.
typedef void *(* diter_cb_t )(void *udata, void *data)
 Container scan callback function.
typedef void *(* dcreate_cb_t )(void *src)
 Constructor callback function.
typedef void *(* dcopy_cb_t )(const void *src)
 Copy-constructor callback function.
typedef int( dfilter_cb_t )(void *udata, void *data)
 Filter scan callback function.
typedef int(* dcmp_cb_t )(const void *v0, const void *v1)
 Callback for comparation between two generic objects.

Detailed Description

This module declares some general use data types.


Typedef Documentation

typedef int(* dcmp_cb_t)(const void *v0, const void *v1)

Callback for comparation between two generic objects.

Parameters:
[in]v0The first object to be compared;
[in]v1The second object to be compared;
Returns:
an integer less than, equal to or greater than zero if v0 is found, respectively, to be less than, to match, or to be greater than v1.
typedef void*(* dcopy_cb_t)(const void *src)

Copy-constructor callback function.

A type of function to be used for copying stored values. Any implementing function is supposed to return a copy of the parameter object.

Parameters:
[in]srcThe object to be copied.
Returns:
A copy of the input object.
typedef void*(* dcreate_cb_t)(void *src)

Constructor callback function.

A type of function to be used for creating new instances of a certain structure. The parameter is a user context.

Parameters:
[in]ctxThe user context.
Returns:
The newly allocated object.
typedef int( dfilter_cb_t)(void *udata, void *data)

Filter scan callback function.

This type describes the callback parameter of 'filter' functions. The pattern requires that a container gets scanned, and such a callback gets called for each contained element. The return value of the callback decides if the element should be keeped or removed.

A 'filter' primitive generally requires a udata parameter which is a pointer to generic user defined data. This allows to write reentrant code.

Parameters:
[in]udataA pointer to some generic user defined data;
[in]dataA pointer to the stored data being considered;
Returns:
1 if the element must be keeped, 0 otherwise.
typedef void(* dfree_cb_t)(void *obj)

Memory free callback function.

This type describes the callback parameter of destructors. For instance, if you are using allocated 'char *' as key for hash tables, you may use simply the free(3) as key destroyer. Note that free(3) matches the dfree_cb_t data type.

Parameters:
[in]objThe object to be freed.
typedef void*(* diter_cb_t)(void *udata, void *data)

Container scan callback function.

This type describes the callback parameter of 'foreach' functions. The pattern requires that a container gets scanned, and such a callback gets called for each contained element. The return value of the callback replaces the stored one.

A 'foreach' primitive generally requires a udata parameter which is a pointer to generic user defined data. This allows to write reentrant code.

Parameters:
[in]udataA pointer to some generic user defined data;
[in]dataA pointer to the stored data being considered;
Returns:
The new value for the given element.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator