Lely core libraries 2.3.4
|
This header file is part of the utilities library; it contains the doubly-linked list declarations. More...
Go to the source code of this file.
Data Structures | |
struct | dlnode |
A node in a doubly-linked list. More... | |
struct | dllist |
A doubly-linked list. More... | |
Macros | |
#define | DLNODE_INIT |
The static initializer for dlnode. | |
#define | DLLIST_INIT |
The static initializer for dllist. | |
#define | dlnode_foreach(first, node) dlnode_foreach_(__LINE__, first, node) |
Iterates in order over each node in a doubly-linked list. More... | |
#define | dllist_foreach(list, node) dlnode_foreach (dllist_first(list), node) |
Iterates in order over each node in a doubly-linked list. More... | |
Functions | |
void | dlnode_init (struct dlnode *node) |
Initializes a node in a doubly-linked list. | |
int | dlnode_insert_after (struct dlnode *prev, struct dlnode *node) |
Inserts node after prev. More... | |
int | dlnode_insert_before (struct dlnode *next, struct dlnode *node) |
Inserts node before next. More... | |
void | dlnode_remove (struct dlnode *node) |
Removes node from a doubly-list. More... | |
void | dllist_init (struct dllist *list) |
Initializes a doubly-linked list. | |
int | dllist_empty (const struct dllist *list) |
Returns 1 if the doubly-linked list is empty, and 0 if not. More... | |
size_t | dllist_size (const struct dllist *list) |
Returns the size (in number of nodes) of a doubly-linked list. More... | |
void | dllist_push_front (struct dllist *list, struct dlnode *node) |
Pushes a node to the front of a doubly-linked list. More... | |
void | dllist_push_back (struct dllist *list, struct dlnode *node) |
Pushes a node to the back of a doubly-linked list. More... | |
struct dlnode * | dllist_pop_front (struct dllist *list) |
Pops a node from the front of a doubly-linked list. More... | |
struct dlnode * | dllist_pop_back (struct dllist *list) |
Pops a node from the back of a doubly-linked list. More... | |
void | dllist_insert_after (struct dllist *list, struct dlnode *prev, struct dlnode *node) |
Inserts a node into a doubly-linked list. More... | |
void | dllist_insert_before (struct dllist *list, struct dlnode *next, struct dlnode *node) |
Inserts a node into a doubly-linked list. More... | |
void | dllist_remove (struct dllist *list, struct dlnode *node) |
Removes a node from a doubly-linked list. More... | |
int | dllist_contains (const struct dllist *list, const struct dlnode *node) |
Checks if a node is part of a doubly-linked list. More... | |
struct dllist * | dllist_append (struct dllist *dst, struct dllist *src) |
Appends the doubly-linked list at src to the one at dst. More... | |
struct dlnode * | dllist_first (const struct dllist *list) |
Returns a pointer to the first node in a doubly-linked list. More... | |
struct dlnode * | dllist_last (const struct dllist *list) |
Returns a pointer to the last node in a doubly-linked list. More... | |
This header file is part of the utilities library; it contains the doubly-linked list declarations.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file dllist.h.
#define dlnode_foreach | ( | first, | |
node | |||
) | dlnode_foreach_(__LINE__, first, node) |
Iterates in order over each node in a doubly-linked list.
It is safe to remove the current node during the iteration.
first | a pointer to the first node in the list. |
node | the name of the pointer to the nodes. This variable is declared in the scope of the loop. |
#define dllist_foreach | ( | list, | |
node | |||
) | dlnode_foreach (dllist_first(list), node) |
Iterates in order over each node in a doubly-linked list.
It is safe to remove the current node during the iteration.
list | a pointer to a doubly-linked list. |
node | the name of the pointer to the nodes. This variable is declared in the scope of the loop. |
|
inline |
|
inline |
|
inline |
Pushes a node to the front of a doubly-linked list.
This is an O(1) operation.
Pushes a node to the back of a doubly-linked list.
This is an O(1) operation.
Pops a node from the front of a doubly-linked list.
This is an O(1) operation.
Pops a node from the back of a doubly-linked list.
This is an O(1) operation.
|
inline |
Inserts a node into a doubly-linked list.
prev MUST be part of list. This is an O(1) operation.
|
inline |
Inserts a node into a doubly-linked list.
next MUST be part of list. This is an O(1) operation.
Removes a node from a doubly-linked list.
node MUST be part of list. This is an O(1) operation.
Returns a pointer to the first node in a doubly-linked list.
This is an O(1) operation.
Returns a pointer to the last node in a doubly-linked list.
This is an O(1) operation.