Callbacks used by various API funcions.
More...
|
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.
|
|
Callbacks used by various API funcions.
◆ predicate_t
typedef bool(* predicate_t) (const void *const element, void *const param) |
Predicate, tells if traversed element matches user's criteria.
- Parameters
-
[in] | element | Points to an element inside a vector. |
[in] | param | Additional 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] | value | Comparison reference value. |
[in] | element | Points to an element inside a vector. |
[in] | param | Additional 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] | element | Points to an element in a processed vector. |
[in,out] | param | User 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] | element | Points to an element in a processed vector. |
[in,out] | acc | Accumulator that stores end result. |
[in,out] | param | User 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] | element | Points to an element in a processed vector. |
[in,out] | param | User defined parameter that for scaling. |
- Returns
- User defined code, non-zero code results in loop break.
Definition at line 145 of file vector.h.