Vector 0.0.2
Loading...
Searching...
No Matches
Searches

Methods for querying the vector. More...

Collaboration diagram for Searches:

Functions

void * vector_linear_find (const vector_t *const vector, const size_t limit, const predicate_t predicate, void *const param)
 Simple linear search for unordered data.
 
void * vector_binary_find (const vector_t *const vector, const void *const value, const size_t limit, const compare_t cmp, void *const param)
 Run binary search on the vector.
 
ssize_t vector_binary_find_index (const vector_t *const vector, const void *const value, const size_t limit, const compare_t cmp, void *const param)
 Run binary search on the vector.
 

Detailed Description

Methods for querying the vector.

Function Documentation

◆ vector_linear_find()

void * vector_linear_find ( const vector_t *const vector,
const size_t limit,
const predicate_t predicate,
void *const param )

Simple linear search for unordered data.

Linear search for a value in the vector with parametrized predicate. If no matching element found returns null pointer, otherwise pointer to a legit location in vector's memory span.

Parameters
[in]vectorPointer to a vector instance.
[in]limitIteration limit before break.
[in]predicateCondition for desired element to be found.
[in]paramUser defined parameter, passed to predicate.
Returns
Pointer to a found element.

Definition at line 215 of file vector.c.

Here is the call graph for this function:

◆ vector_binary_find()

void * vector_binary_find ( const vector_t *const vector,
const void *const value,
const size_t limit,
const compare_t cmp,
void *const param )

Run binary search on the vector.

Returns
pointer to the found element on success or NULL otherwise.
Parameters
[in]vectorPointer to a vector instance.
[in]valueReference value to be compared to elements.
[in]limitIteration limit before break.
[in]cmpCondition for desired element to be found.
[in]paramUser defined parameter, passed to predicate.
Returns
Pointer to a found element.

Definition at line 234 of file vector.c.

Here is the call graph for this function:

◆ vector_binary_find_index()

ssize_t vector_binary_find_index ( const vector_t *const vector,
const void *const value,
const size_t limit,
const compare_t cmp,
void *const param )

Run binary search on the vector.

Returns
index of the found element on success or -1 otherwise.
Parameters
[in]vectorPointer to a vector instance.
[in]valueReference value to be compared to elements.
[in]limitIteration limit before break.
[in]cmpCondition for desired element to be found.
[in]paramUser defined parameter, passed to predicate.
Returns
Index of found element or NULL if none.

Definition at line 249 of file vector.c.

Here is the call graph for this function: