inc/ecu/dlist.h Source File
|
ECU
|
dlist.h
Go to the documentation of this file.
578 bool (*lhs_less_than_rhs)(const struct ecu_dnode *lhs, const struct ecu_dnode *rhs, void *data),
640 extern struct ecu_dnode *ecu_dlist_iterator_begin(struct ecu_dlist_iterator *me, struct ecu_dlist *list);
const struct ecu_dnode * ecu_dnode_cprev(const struct ecu_dnode *me)
Const-qualified version of ecu_dnode_prev(). Returned node is read-only.
bool ecu_dlist_empty(const struct ecu_dlist *me)
Returns true if the list is empty. False otherwise.
struct ecu_dnode * ecu_dlist_pop_front(struct ecu_dlist *me)
Removes the front node from the list and returns it. If the list is empty, returns NULL.
struct ecu_dnode * ecu_dlist_iterator_begin(struct ecu_dlist_iterator *me, struct ecu_dlist *list)
Initializes iterator and returns first node in the list. Returns first user-defined node if list is n...
struct ecu_dnode * ecu_dlist_iterator_at(struct ecu_dlist_iterator *me, struct ecu_dlist *list, struct ecu_dnode *start)
Initializes iterator at the supplied starting node's position. The supplied starting node is returned...
bool ecu_dnode_in_list(const struct ecu_dnode *me)
Returns true if the node is in a list. False otherwise.
void ecu_dlist_insert_before(struct ecu_dlist *me, struct ecu_dnode *node, bool(*condition)(const struct ecu_dnode *node, const struct ecu_dnode *position, void *data), void *data)
Inserts a node before the position specified by a condition function. Starting from HEAD,...
bool ecu_dlist_valid(const struct ecu_dlist *me)
Returns true if the supplied list has been constructed via ecu_dlist_ctor(). False otherwise.
const struct ecu_dnode * ecu_dlist_iterator_cnext(struct ecu_dlist_citerator *me)
Const-qualified version of ecu_dlist_iterator_next(). Returns the next node in the iteration.
size_t ecu_dlist_size(const struct ecu_dlist *me)
Returns the number of nodes in a list. Returns 0 if the list is empty.
const struct ecu_dnode * ecu_dlist_cback(const struct ecu_dlist *me)
Const-qualified version of ecu_dlist_back(). Returned node is read-only.
struct ecu_dnode * ecu_dlist_pop_back(struct ecu_dlist *me)
Removes the tail node from the list and returns it. If the list is empty, returns NULL.
void ecu_dlist_sort(struct ecu_dlist *me, bool(*lhs_less_than_rhs)(const struct ecu_dnode *lhs, const struct ecu_dnode *rhs, void *data), void *data)
Merge sorts all nodes in the list. The sorting condition is defined by a user-supplied function.
const struct ecu_dnode * ecu_dlist_cfront(const struct ecu_dlist *me)
Const-qualified version of ecu_dlist_front(). Returned node is read-only.
struct ecu_dnode * ecu_dlist_back(struct ecu_dlist *me)
Returns the tail node but does not remove it. If the list is empty, NULL is returned.
void ecu_dlist_swap(struct ecu_dlist *me, struct ecu_dlist *other)
Swaps nodes between two lists. If one list is empty, the swapped list will become empty:
void ecu_dlist_push_back(struct ecu_dlist *me, struct ecu_dnode *node)
Inserts node to the back of the list.
void ecu_dnode_insert_before(struct ecu_dnode *pos, struct ecu_dnode *node)
Inserts a node before the specified position.
const struct ecu_dnode * ecu_dlist_iterator_cat(struct ecu_dlist_citerator *me, const struct ecu_dlist *list, const struct ecu_dnode *start)
Const-qualified version of ecu_dlist_iterator_at(). Initializes iterator at the supplied starting nod...
const struct ecu_dnode * ecu_dnode_cnext(const struct ecu_dnode *me)
Const-qualified version of ecu_dnode_next(). Returned node is read-only.
struct ecu_dnode * ecu_dlist_iterator_end(struct ecu_dlist_iterator *me)
Returns list's terminal node, which is HEAD (ecu_dlist::head).
const struct ecu_dnode * ecu_dlist_iterator_cbegin(struct ecu_dlist_citerator *me, const struct ecu_dlist *list)
Const-qualified version of ecu_dlist_iterator_begin(). Initializes iterator and returns first node in...
void ecu_dnode_remove(struct ecu_dnode *me)
Removes the node from a list. It can be reused and added to another list without reconstruction....
void ecu_dnode_destroy(struct ecu_dnode *me)
Node destructor. Removes node if it is in a list. Executes the user-defined destructor if one was sup...
void ecu_dnode_insert_after(struct ecu_dnode *pos, struct ecu_dnode *node)
Inserts a node after the specified position.
void ecu_dlist_destroy(struct ecu_dlist *me)
List destructor. Destroys the list and all nodes within the list. All destroyed objects must be recon...
struct ecu_dnode * ecu_dlist_front(struct ecu_dlist *me)
Returns the front node in the list but does not remove it. If the list is empty, returns NULL.
bool ecu_dnode_valid(const struct ecu_dnode *me)
Returns true if the supplied node has been constructed via ecu_dnode_ctor(). Returns false if supplie...
ecu_object_id_t ecu_dnode_id(const struct ecu_dnode *me)
Returns node ID. Used to identity different user-defined types stored in the same list.
struct ecu_dnode * ecu_dnode_prev(struct ecu_dnode *me)
Returns the node previous to (left of) me. NULL is returned if me is the first node in the list (one ...
struct ecu_dnode * ecu_dnode_next(struct ecu_dnode *me)
Returns the node next to (right of) me. NULL is returned if me is the last node in the list or if me ...
void ecu_dnode_ctor(struct ecu_dnode *me, void(*destroy)(struct ecu_dnode *me, ecu_object_id_t id), ecu_object_id_t id)
Node constructor.
const struct ecu_dnode * ecu_dlist_iterator_cend(struct ecu_dlist_citerator *me)
Const-qualified version of ecu_dlist_iterator_end(). Returns list's terminal node,...
struct ecu_dnode * ecu_dlist_iterator_next(struct ecu_dlist_iterator *me)
Returns the next node in the iteration.
void ecu_dlist_clear(struct ecu_dlist *me)
Removes all nodes from the list. List and nodes can be reused without reconstruction.
void ecu_dlist_push_front(struct ecu_dlist *me, struct ecu_dnode *node)
Inserts node to the front of the list.
int32_t ecu_object_id_t
Object ID type. Used so the library can implicitly typecast between this value, ecu_reserved_object_i...
Definition: object_id.h:64
const struct ecu_dnode * next
Next position in the list. Allows user to safely add and remove nodes in the middle of an iteration.
Definition: dlist.h:239
const struct ecu_dlist * list
List that is being iterated. List's HEAD is used as a delimiter.
Definition: dlist.h:231
const struct ecu_dnode * current
Current position in list.
Definition: dlist.h:234
struct ecu_dnode * current
Current position in list.
Definition: dlist.h:213
struct ecu_dlist * list
List that is being iterated. List's HEAD is used as a delimiter.
Definition: dlist.h:210
struct ecu_dnode * next
Next position in the list. Allows user to safely add and remove nodes in the middle of an iteration.
Definition: dlist.h:218
struct ecu_dnode head
Dummy node used as delimiter to represent start and end of list. Not apart of user's list.
Definition: dlist.h:193
Single node within list. Intrusive, so user-defined types contain this node as a member.
Definition: dlist.h:166
ecu_object_id_t id
Optional node ID. Helps user identify different types stored in the same list.
Definition: dlist.h:180
void(* destroy)(struct ecu_dnode *me, ecu_object_id_t id)
Optional user-defined node destructor. Executes when ecu_dlist_destroy() or ecu_dnode_destroy() are c...
Definition: dlist.h:176
Generated by