Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
c42a5618
Commit
c42a5618
authored
11 years ago
by
Ludwig Knüpfer
Browse files
Options
Downloads
Patches
Plain Diff
core/doc: complete queue.h
parent
93647306
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/include/queue.h
+61
-4
61 additions, 4 deletions
core/include/queue.h
with
61 additions
and
4 deletions
core/include/queue.h
+
61
−
4
View file @
c42a5618
...
...
@@ -23,22 +23,79 @@
#include
<stdint.h>
#include
<inttypes.h>
// mspgcc bug : PRIxxx macros not defined before mid-2011 versions
/* mspgcc bug : PRIxxx macros not defined before mid-2011 versions */
/**
* @brief Macro for printing 32 bit format specifier
* @def PRIu32
*/
#ifndef PRIu32
#define PRIu32 "lu"
#endif
/**
* data type for queue nodes
*/
typedef
struct
queue_node_t
{
struct
queue_node_t
*
next
;
unsigned
int
data
;
uint32_t
priority
;
struct
queue_node_t
*
next
;
/**< next queue node */
unsigned
int
data
;
/**< queue node data */
uint32_t
priority
;
/**< queue node priority */
}
queue_node_t
;
/**
* @brief attach `new_obj` to the tail of the queue (identified
* `root`)
*
* @param[in,out] root the queue's root
* @param[in] new_obj the object to append
*/
void
queue_add_tail
(
queue_node_t
*
root
,
queue_node_t
*
new_obj
);
/**
* @brief attach `new_obj` to `root` at the beginning
*
* @param[in,out] root the queue's root
* @param[in] new_obj the object to prepend
*/
void
queue_add_head
(
queue_node_t
*
root
,
queue_node_t
*
new_obj
);
/**
* @brief remove the queue's head
*
* @param[out] root the queue's root
*
* @return the old head
*/
queue_node_t
*
queue_remove_head
(
queue_node_t
*
root
);
/**
* @brief insert `new_obj` into `root` based on its priority
*
* @details
* The new object will be appended after objects with the same priority.
*
* @param[in,out] root the queue's root
* @param[in] new_obj the object to prepend
*/
void
queue_priority_add
(
queue_node_t
*
root
,
queue_node_t
*
new_obj
);
/**
* @brief insert `new_obj` into `root` based on an arbitrary priority
*
* @details
* The new object will be appended after objects with the same priority.
*
* @param[in,out] root the queue's root
* @param[in] new_obj the object to prepend
* @param[in] cmp a comparator function used to determine the priority
*/
void
queue_priority_add_generic
(
queue_node_t
*
root
,
queue_node_t
*
new_obj
,
int
(
*
cmp
)(
queue_node_t
*
,
queue_node_t
*
))
;
/**
* @brief remove `node` from `root`
*
* @param[in,out] root the queue's root
* @param[in] node the node to remove
*/
void
queue_remove
(
queue_node_t
*
root
,
queue_node_t
*
node
);
#if ENABLE_DEBUG
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment