1 | /** |
---|
2 | * @file rtems/rbtree.h |
---|
3 | * |
---|
4 | * This include file contains all the constants and structures associated |
---|
5 | * with the RBTree API in RTEMS. The rbtree is a Red Black Tree that |
---|
6 | * is part of the Super Core. This is the published interface to that |
---|
7 | * code. |
---|
8 | * |
---|
9 | */ |
---|
10 | |
---|
11 | /* |
---|
12 | * Copyright (c) 2010 Gedare Bloom. |
---|
13 | * |
---|
14 | * The license and distribution terms for this file may be |
---|
15 | * found in the file LICENSE in this distribution or at |
---|
16 | * http://www.rtems.com/license/LICENSE. |
---|
17 | * |
---|
18 | * $Id$ |
---|
19 | */ |
---|
20 | |
---|
21 | #ifndef _RTEMS_RBTREE_H |
---|
22 | #define _RTEMS_RBTREE_H |
---|
23 | |
---|
24 | #ifdef __cplusplus |
---|
25 | extern "C" { |
---|
26 | #endif |
---|
27 | |
---|
28 | #include <rtems/system.h> |
---|
29 | #include <rtems/score/rbtree.h> |
---|
30 | |
---|
31 | /** |
---|
32 | * @typedef rtems_rbtree_node |
---|
33 | * |
---|
34 | * A node that can be manipulated in the rbtree. |
---|
35 | */ |
---|
36 | typedef RBTree_Node rtems_rbtree_node; |
---|
37 | |
---|
38 | /** |
---|
39 | * @typedef rtems_rbtree_control |
---|
40 | * |
---|
41 | * The rbtree's control anchors the rbtree. |
---|
42 | */ |
---|
43 | typedef RBTree_Control rtems_rbtree_control; |
---|
44 | |
---|
45 | /** |
---|
46 | * @typedef rtems_rbtree_compare_function |
---|
47 | * |
---|
48 | * This type defines function pointers for user-provided comparison |
---|
49 | * function. The function compares two nodes in order to determine |
---|
50 | * the order in a red-black tree. |
---|
51 | */ |
---|
52 | typedef RBTree_Compare_function rtems_rbtree_compare_function; |
---|
53 | |
---|
54 | /** |
---|
55 | * @typedef rtems_rbtree_unique |
---|
56 | * |
---|
57 | * This enum type defines whether the tree can contain nodes with |
---|
58 | * duplicate keys. |
---|
59 | */ |
---|
60 | typedef enum { |
---|
61 | /** The tree is not unique, insertion of duplicate keys is performed |
---|
62 | * in a FIFO manner. */ |
---|
63 | RTEMS_RBTREE_DUPLICATE = false, |
---|
64 | /** The tree is unique, insertion of duplicate key is refused. */ |
---|
65 | RTEMS_RBTREE_UNIQUE = true |
---|
66 | } rtems_rbtree_unique; |
---|
67 | |
---|
68 | /** |
---|
69 | * @brief RBTree initializer for an empty rbtree with designator @a name. |
---|
70 | */ |
---|
71 | #define RTEMS_RBTREE_INITIALIZER_EMPTY(name) \ |
---|
72 | RBTREE_INITIALIZER_EMPTY(name) |
---|
73 | |
---|
74 | /** |
---|
75 | * @brief RBTree definition for an empty rbtree with designator @a name. |
---|
76 | */ |
---|
77 | #define RTEMS_RBTREE_DEFINE_EMPTY(name) \ |
---|
78 | RBTREE_DEFINE_EMPTY(name) |
---|
79 | |
---|
80 | /** |
---|
81 | * @brief macro to return the structure containing the @a node. |
---|
82 | * |
---|
83 | * This macro returns a pointer of type @a object_type that points |
---|
84 | * to the structure containing @a node, where @a object_member is the |
---|
85 | * field name of the rtems_rbtree_node structure in objects of @a object_type. |
---|
86 | */ |
---|
87 | #define rtems_rbtree_container_of(node,object_type, object_member) \ |
---|
88 | _RBTree_Container_of(node,object_type,object_member) |
---|
89 | |
---|
90 | #include <rtems/rbtree.inl> |
---|
91 | |
---|
92 | #ifdef __cplusplus |
---|
93 | } |
---|
94 | #endif |
---|
95 | |
---|
96 | #endif |
---|
97 | /* end of include file */ |
---|