diff options
Diffstat (limited to 'cpukit/sapi/inline/rtems/rbtree.inl')
-rw-r--r-- | cpukit/sapi/inline/rtems/rbtree.inl | 97 |
1 files changed, 79 insertions, 18 deletions
diff --git a/cpukit/sapi/inline/rtems/rbtree.inl b/cpukit/sapi/inline/rtems/rbtree.inl index ab81baf23b..dc53fa0381 100644 --- a/cpukit/sapi/inline/rtems/rbtree.inl +++ b/cpukit/sapi/inline/rtems/rbtree.inl @@ -5,17 +5,14 @@ * with the RBTree API in RTEMS. The rbtree is a Red Black Tree that * is part of the Super Core. This is the published interface to that * code. - * */ /* - * Copyright (c) 2010 Gedare Bloom. + * Copyright (c) 2010-2012 Gedare Bloom. * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. - * - * $Id$ */ #ifndef _RTEMS_RBTREE_H @@ -254,6 +251,17 @@ RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_root( return _RBTree_Is_root( the_rbtree, the_node ); } +/** + * @copydoc _RBTree_Find_unprotected() + */ +RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_find_unprotected( + rtems_rbtree_control *the_rbtree, + rtems_rbtree_node *the_node +) +{ + return _RBTree_Find_unprotected( the_rbtree, the_node ); +} + /** @brief Find the node with given key in the tree * * This function returns a pointer to the node having key equal to the key @@ -275,44 +283,51 @@ RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_find( * @copydoc _RBTree_Predecessor_unprotected() */ RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_predecessor_unprotected( - const rtems_rbtree_control *rbtree, const rtems_rbtree_node *node ) { - return _RBTree_Predecessor_unprotected( rbtree, node ); + return _RBTree_Predecessor_unprotected( node ); } /** * @copydoc _RBTree_Predecessor() */ RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_predecessor( - const rtems_rbtree_control *rbtree, const rtems_rbtree_node *node ) { - return _RBTree_Predecessor( rbtree, node ); + return _RBTree_Predecessor( node ); } /** * @copydoc _RBTree_Successor_unprotected() */ RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_successor_unprotected( - const rtems_rbtree_control *rbtree, const rtems_rbtree_node *node ) { - return _RBTree_Successor_unprotected( rbtree, node ); + return _RBTree_Successor_unprotected( node ); } /** * @copydoc _RBTree_Successor() */ RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_successor( - const rtems_rbtree_control *rbtree, const rtems_rbtree_node *node ) { - return _RBTree_Successor( rbtree, node ); + return _RBTree_Successor( node ); +} + +/** + * @copydoc _RBTree_Extract_unprotected() + */ +RTEMS_INLINE_ROUTINE void rtems_rbtree_extract_unprotected( + rtems_rbtree_control *the_rbtree, + rtems_rbtree_node *the_node +) +{ + _RBTree_Extract_unprotected( the_rbtree, the_node ); } /** @@ -334,6 +349,20 @@ RTEMS_INLINE_ROUTINE void rtems_rbtree_extract( * * This function removes the min node from @a the_rbtree and returns * a pointer to that node. If @a the_rbtree is empty, then NULL is returned. + */ + +RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_get_min_unprotected( + rtems_rbtree_control *the_rbtree +) +{ + return _RBTree_Get_unprotected( the_rbtree, RBT_LEFT ); +} + +/** + * @brief Obtain the min node on a rbtree + * + * This function removes the min node from @a the_rbtree and returns + * a pointer to that node. If @a the_rbtree is empty, then NULL is returned. * It disables interrupts to ensure the atomicity of the get operation. */ RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_get_min( @@ -348,6 +377,20 @@ RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_get_min( * * This function removes the max node from @a the_rbtree and returns * a pointer to that node. If @a the_rbtree is empty, then NULL is returned. + */ + +RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_get_max_unprotected( + rtems_rbtree_control *the_rbtree +) +{ + return _RBTree_Get_unprotected( the_rbtree, RBT_RIGHT ); +} + +/** + * @brief Obtain the max node on a rbtree + * + * This function removes the max node from @a the_rbtree and returns + * a pointer to that node. If @a the_rbtree is empty, then NULL is returned. * It disables interrupts to ensure the atomicity of the get operation. */ RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_get_max( @@ -363,13 +406,12 @@ RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_get_max( * This function returns a pointer to the min node from @a the_rbtree * without changing the tree. If @a the_rbtree is empty, * then NULL is returned. - * It disables interrupts to ensure the atomicity of the peek operation. */ RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_peek_min( const rtems_rbtree_control *the_rbtree ) { - return _RBTree_Peek( the_rbtree, RBT_LEFT ); + return _RBTree_First( the_rbtree, RBT_LEFT ); } /** @@ -378,15 +420,23 @@ RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_peek_min( * This function returns a pointer to the max node from @a the_rbtree * without changing the tree. If @a the_rbtree is empty, * then NULL is returned. - * It disables interrupts to ensure the atomicity of the peek operation. */ RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_peek_max( const rtems_rbtree_control *the_rbtree ) { - return _RBTree_Peek( the_rbtree, RBT_RIGHT ); + return _RBTree_First( the_rbtree, RBT_RIGHT ); } +/** + * @copydoc _RBTree_Find_header_unprotected() + */ +RTEMS_INLINE_ROUTINE rtems_rbtree_control *rtems_rbtree_find_header_unprotected( + rtems_rbtree_node *the_node +) +{ + return _RBTree_Find_header_unprotected( the_node ); +} /** * @brief Find the control header of the tree containing a given node. @@ -399,7 +449,18 @@ RTEMS_INLINE_ROUTINE rtems_rbtree_control *rtems_rbtree_find_header( rtems_rbtree_node *the_node ) { - return(_RBTree_Find_header( the_node )); + return _RBTree_Find_header( the_node ); +} + +/** + * @copydoc _RBTree_Insert_unprotected() + */ +RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_insert_unprotected( + rtems_rbtree_control *the_rbtree, + rtems_rbtree_node *the_node +) +{ + return _RBTree_Insert_unprotected( the_rbtree, the_node ); } /** @@ -427,7 +488,7 @@ RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_unique( const rtems_rbtree_control *the_rbtree ) { - return( _RBTree_Is_unique(the_rbtree) ); + return _RBTree_Is_unique(the_rbtree); } #endif |