source: rtems/cpukit/sapi/include/rtems/rbtree.h @ 74f1c73e

4.115
Last change on this file since 74f1c73e was 74f1c73e, checked in by Joel Sherrill <joel.sherrill@…>, on 08/21/11 at 20:07:11

2011-08-21 Petr Benes <benesp16@…>

PR 1886/cpukit

  • sapi/include/rtems/rbtree.h, sapi/inline/rtems/rbtree.inl, score/include/rtems/score/rbtree.h, score/inline/rtems/score/rbtree.inl, score/src/rbtree.c, score/src/rbtreeinsert.c: This patch enables inserting duplicate keys into rbtree. It is possible to turn on this feature when initializing the tree.
  • Property mode set to 100644
File size: 2.4 KB
Line 
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
25extern "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 */
36typedef RBTree_Node rtems_rbtree_node;
37
38/**
39 * @typedef rtems_rbtree_control
40 *
41 * The rbtree's control anchors the rbtree.
42 */
43typedef 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 */
52typedef 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 */
60typedef 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 */
Note: See TracBrowser for help on using the repository browser.