Vector 0.0.2
Loading...
Searching...
No Matches
Callbacks

Callbacks used by various API funcions. More...

Collaboration diagram for Callbacks:

Typedefs

typedef bool(* predicate_t) (const void *const element, void *const param)
 Predicate, tells if traversed element matches user's criteria.
 
typedef ssize_t(* compare_t) (const void *const value, const void *const element, void *const param)
 Compare, used to define traversal order.
 
typedef int(* foreach_t) (const void *const element, void *const param)
 Callback determines an operation for vector_foreach.
 
typedef int(* aggregate_t) (const void *const element, void *const acc, void *const param)
 Callback determines an operation for vector_aggregate.
 
typedef int(* transform_t) (void *const element, void *const param)
 Callback determines an operation for vector_transform.
 

Detailed Description

Callbacks used by various API funcions.

Typedef Documentation

◆ predicate_t

typedef bool(* predicate_t) (const void *const element, void *const param)

Predicate, tells if traversed element matches user's criteria.

Parameters
[in]elementPoints to an element inside a vector.
[in]paramAdditional parameter from user, if you don't need it, pass NULL.
Returns
true - element matches, otherwise false

Definition at line 97 of file vector.h.

◆ compare_t

typedef ssize_t(* compare_t) (const void *const value, const void *const element, void *const param)

Compare, used to define traversal order.

See also
binary_find
Parameters
[in]valueComparison reference value.
[in]elementPoints to an element inside a vector.
[in]paramAdditional parameter from user, if you don't need it, pass NULL.
Returns
Positive (value > element), negative (value < element) or zero (value == element).

Definition at line 108 of file vector.h.

◆ foreach_t

typedef int(* foreach_t) (const void *const element, void *const param)

Callback determines an operation for vector_foreach.

This operation will be performed on each element of the vector, until one of the calls retuned non-zero value.

Parameters
[in]elementPoints to an element in a processed vector.
[in,out]paramUser defined parameter that for scaling.
Returns
User defined code, non-zero code results in loop break.

Definition at line 120 of file vector.h.

◆ aggregate_t

typedef int(* aggregate_t) (const void *const element, void *const acc, void *const param)

Callback determines an operation for vector_aggregate.

This operation will be performed on each element of the vector, until one of the calls retuned non-zero value. Reduces vector into a acc parameter, non-destructive operation.

Parameters
[in]elementPoints to an element in a processed vector.
[in,out]accAccumulator that stores end result.
[in,out]paramUser defined parameter that for scaling.
Returns
User defined code, non-zero code results in loop break.

Definition at line 133 of file vector.h.

◆ transform_t

typedef int(* transform_t) (void *const element, void *const param)

Callback determines an operation for vector_transform.

This operation will be performed on each element of the vector, until one of the calls retuned non-zero value. Destructive operation, designed to mutate vector elements.

Parameters
[in]elementPoints to an element in a processed vector.
[in,out]paramUser defined parameter that for scaling.
Returns
User defined code, non-zero code results in loop break.

Definition at line 145 of file vector.h.