rbtree
1# This file was automatically generated by SWIG (https://www.swig.org). 2# Version 4.2.1 3# 4# Do not make changes to this file unless you know what you are doing - modify 5# the SWIG interface file instead. 6 7from sys import version_info as _swig_python_version_info 8from mock_rtems import _rbtree as _rbtree 9 10try: 11 import builtins as __builtin__ 12except ImportError: 13 import __builtin__ 14 15def _swig_repr(self): 16 try: 17 strthis = "proxy of " + self.this.__repr__() 18 except __builtin__.Exception: 19 strthis = "" 20 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) 21 22 23def _swig_setattr_nondynamic_instance_variable(set): 24 def set_instance_attr(self, name, value): 25 if name == "this": 26 set(self, name, value) 27 elif name == "thisown": 28 self.this.own(value) 29 elif hasattr(self, name) and isinstance(getattr(type(self), name), property): 30 set(self, name, value) 31 else: 32 raise AttributeError("You cannot add instance attributes to %s" % self) 33 return set_instance_attr 34 35 36def _swig_setattr_nondynamic_class_variable(set): 37 def set_class_attr(cls, name, value): 38 if hasattr(cls, name) and not isinstance(getattr(cls, name), property): 39 set(cls, name, value) 40 else: 41 raise AttributeError("You cannot add class attributes to %s" % cls) 42 return set_class_attr 43 44 45def _swig_add_metaclass(metaclass): 46 """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass""" 47 def wrapper(cls): 48 return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy()) 49 return wrapper 50 51 52class _SwigNonDynamicMeta(type): 53 """Meta class to enforce nondynamic attributes (no new attributes) for a class""" 54 __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__) 55 56 57 58def rtems_rbtree_initialize(the_rbtree, compare, starting_address, number_nodes, node_size, is_unique): 59 r""" 60 RBTree initializer for an empty rbtree with designator *name*. 61 62 RBTree definition for an empty rbtree with designator *name*. 63 64 Initialize a RBTree header. 65 66 This routine initializes *the_rbtree* structure to manage the 67 contiguous array of *number_nodes* nodes which starts at 68 *starting_address*. Each node is of *node_size* bytes. 69 70 :type the_rbtree: rtems_rbtree_control, in 71 :param the_rbtree: is the pointer to rbtree header 72 :type compare: long, in 73 :param compare: The node compare function. 74 :type starting_address: void, in 75 :param starting_address: is the starting address of first node 76 :type number_nodes: int, in 77 :param number_nodes: is the number of nodes in rbtree 78 :type node_size: int, in 79 :param node_size: is the size of node in bytes 80 :type is_unique: boolean, in 81 :param is_unique: If true, then reject nodes with a duplicate key, else 82 otherwise. 83 """ 84 return _rbtree.rtems_rbtree_initialize(the_rbtree, compare, starting_address, number_nodes, node_size, is_unique) 85 86def rtems_rbtree_initialize_empty(the_rbtree): 87 r""" 88 Initialize this RBTree as Empty 89 90 This routine initializes *the_rbtree* to contain zero nodes. 91 """ 92 return _rbtree.rtems_rbtree_initialize_empty(the_rbtree) 93 94def rtems_rbtree_set_off_tree(node): 95 r""" 96 Set off RBtree. 97 98 This function sets the next and previous fields of the *node* to NULL 99 indicating the *node* is not part of any rbtree. 100 """ 101 return _rbtree.rtems_rbtree_set_off_tree(node) 102 103def rtems_rbtree_is_node_off_tree(node): 104 r""" 105 Is the Node off RBTree. 106 107 This function returns true if the *node* is not on a rbtree. A *node* is 108 off rbtree if the next and previous fields are set to NULL. 109 """ 110 return _rbtree.rtems_rbtree_is_node_off_tree(node) 111 112def rtems_rbtree_root(the_rbtree): 113 r""" 114 Return pointer to RBTree root. 115 116 This function returns a pointer to the root node of *the_rbtree*. 117 """ 118 return _rbtree.rtems_rbtree_root(the_rbtree) 119 120def rtems_rbtree_min(the_rbtree): 121 122 return _rbtree.rtems_rbtree_min(the_rbtree) 123 124def rtems_rbtree_max(the_rbtree): 125 126 return _rbtree.rtems_rbtree_max(the_rbtree) 127 128def rtems_rbtree_left(the_node): 129 r""" 130 Return pointer to the left child node from this node. 131 132 This function returns a pointer to the left child node of *the_node*. 133 """ 134 return _rbtree.rtems_rbtree_left(the_node) 135 136def rtems_rbtree_right(the_node): 137 r""" 138 Return pointer to the right child node from this node. 139 140 This function returns a pointer to the right child node of *the_node*. 141 """ 142 return _rbtree.rtems_rbtree_right(the_node) 143 144def rtems_rbtree_parent(the_node): 145 146 return _rbtree.rtems_rbtree_parent(the_node) 147 148def rtems_rbtree_is_empty(the_rbtree): 149 r""" 150 Is the RBTree empty. 151 152 This function returns true if there a no nodes on *the_rbtree* and 153 false otherwise. 154 """ 155 return _rbtree.rtems_rbtree_is_empty(the_rbtree) 156 157def rtems_rbtree_is_min(the_rbtree, the_node): 158 r""" 159 Is this the minimum node on the RBTree. 160 161 This function returns true if *the_node* is the min node on *the_rbtree* 162 and false otherwise. 163 """ 164 return _rbtree.rtems_rbtree_is_min(the_rbtree, the_node) 165 166def rtems_rbtree_is_max(the_rbtree, the_node): 167 r""" 168 Is this the maximum node on the RBTree. 169 170 This function returns true if *the_node* is the max node on *the_rbtree* 171 and false otherwise. 172 """ 173 return _rbtree.rtems_rbtree_is_max(the_rbtree, the_node) 174 175def rtems_rbtree_is_root(the_node): 176 177 return _rbtree.rtems_rbtree_is_root(the_node) 178 179def rtems_rbtree_is_equal(compare_result): 180 r""" 181 rtems_rbtree_is_equal(rtems_rbtree_compare_result compare_result) -> bool 182 183 Parameters 184 ---------- 185 compare_result: rtems_rbtree_compare_result 186 187 """ 188 return _rbtree.rtems_rbtree_is_equal(compare_result) 189 190def rtems_rbtree_is_greater(compare_result): 191 r""" 192 rtems_rbtree_is_greater(rtems_rbtree_compare_result compare_result) -> bool 193 194 Parameters 195 ---------- 196 compare_result: rtems_rbtree_compare_result 197 198 """ 199 return _rbtree.rtems_rbtree_is_greater(compare_result) 200 201def rtems_rbtree_is_lesser(compare_result): 202 r""" 203 rtems_rbtree_is_lesser(rtems_rbtree_compare_result compare_result) -> bool 204 205 Parameters 206 ---------- 207 compare_result: rtems_rbtree_compare_result 208 209 """ 210 return _rbtree.rtems_rbtree_is_lesser(compare_result) 211 212def rtems_rbtree_find(the_rbtree, the_node, compare, is_unique): 213 r""" 214 Tries to find a node for the specified key in the tree. 215 216 :type the_rbtree: rtems_rbtree_control, in 217 :param the_rbtree: The red-black tree control. 218 :type the_node: rtems_rbtree_node, in 219 :param the_node: A node specifying the key. 220 :type compare: long, in 221 :param compare: The node compare function. 222 :type is_unique: boolean, in 223 :param is_unique: If true, then return the first node with a key equal to 224 the one of the node specified if it exits, else return the last node if it 225 exists. 226 """ 227 return _rbtree.rtems_rbtree_find(the_rbtree, the_node, compare, is_unique) 228 229def rtems_rbtree_predecessor(node): 230 231 return _rbtree.rtems_rbtree_predecessor(node) 232 233def rtems_rbtree_successor(node): 234 235 return _rbtree.rtems_rbtree_successor(node) 236 237def rtems_rbtree_extract(the_rbtree, the_node): 238 239 return _rbtree.rtems_rbtree_extract(the_rbtree, the_node) 240 241def rtems_rbtree_get_min(the_rbtree): 242 r""" 243 Gets a node with the minimum key value from the red-black tree. 244 245 This function extracts a node with the minimum key value from 246 tree and returns a pointer to that node if it exists. In case multiple 247 nodes with a minimum key value exist, then they are extracted in FIFO order. 248 249 :type the_rbtree: rtems_rbtree_control, in 250 :param the_rbtree: The red-black tree control. 251 """ 252 return _rbtree.rtems_rbtree_get_min(the_rbtree) 253 254def rtems_rbtree_get_max(the_rbtree): 255 r""" 256 Gets a node with the maximal key value from the red-black tree. 257 258 This function extracts a node with the maximum key value from tree and 259 returns a pointer to that node if it exists. In case multiple nodes with a 260 maximum key value exist, then they are extracted in LIFO order. 261 262 :type the_rbtree: rtems_rbtree_control, in 263 :param the_rbtree: The red-black tree control. 264 """ 265 return _rbtree.rtems_rbtree_get_max(the_rbtree) 266 267def rtems_rbtree_peek_min(the_rbtree): 268 r""" 269 Peek at the min node on a rbtree. 270 271 This function returns a pointer to the min node from *the_rbtree* 272 without changing the tree. If *the_rbtree* is empty, 273 then NULL is returned. 274 """ 275 return _rbtree.rtems_rbtree_peek_min(the_rbtree) 276 277def rtems_rbtree_peek_max(the_rbtree): 278 r""" 279 Peek at the max node on a rbtree. 280 281 This function returns a pointer to the max node from *the_rbtree* 282 without changing the tree. If *the_rbtree* is empty, 283 then NULL is returned. 284 """ 285 return _rbtree.rtems_rbtree_peek_max(the_rbtree) 286 287def rtems_rbtree_insert(the_rbtree, the_node, compare, is_unique): 288 r""" 289 Inserts the node into the red-black tree. 290 291 In case the node is already a node of a tree, then this function yields 292 unpredictable results. 293 294 :type the_rbtree: RBTree_Control, in 295 :param the_rbtree: The red-black tree control. 296 :type the_node: RBTree_Node, in 297 :param the_node: The node to insert. 298 :type compare: long, in 299 :param compare: The node compare function. 300 :type is_unique: boolean, in 301 :param is_unique: If true, then reject nodes with a duplicate key, else 302 insert nodes in FIFO order in case the key value is equal to existing nodes. 303 """ 304 return _rbtree.rtems_rbtree_insert(the_rbtree, the_node, compare, is_unique)
59def rtems_rbtree_initialize(the_rbtree, compare, starting_address, number_nodes, node_size, is_unique): 60 r""" 61 RBTree initializer for an empty rbtree with designator *name*. 62 63 RBTree definition for an empty rbtree with designator *name*. 64 65 Initialize a RBTree header. 66 67 This routine initializes *the_rbtree* structure to manage the 68 contiguous array of *number_nodes* nodes which starts at 69 *starting_address*. Each node is of *node_size* bytes. 70 71 :type the_rbtree: rtems_rbtree_control, in 72 :param the_rbtree: is the pointer to rbtree header 73 :type compare: long, in 74 :param compare: The node compare function. 75 :type starting_address: void, in 76 :param starting_address: is the starting address of first node 77 :type number_nodes: int, in 78 :param number_nodes: is the number of nodes in rbtree 79 :type node_size: int, in 80 :param node_size: is the size of node in bytes 81 :type is_unique: boolean, in 82 :param is_unique: If true, then reject nodes with a duplicate key, else 83 otherwise. 84 """ 85 return _rbtree.rtems_rbtree_initialize(the_rbtree, compare, starting_address, number_nodes, node_size, is_unique)
RBTree initializer for an empty rbtree with designator name.
RBTree definition for an empty rbtree with designator name.
Initialize a RBTree header.
This routine initializes the_rbtree structure to manage the contiguous array of number_nodes nodes which starts at starting_address. Each node is of node_size bytes.
Parameters
- the_rbtree: is the pointer to rbtree header
- compare: The node compare function.
- starting_address: is the starting address of first node
- number_nodes: is the number of nodes in rbtree
- node_size: is the size of node in bytes
- is_unique: If true, then reject nodes with a duplicate key, else otherwise.
87def rtems_rbtree_initialize_empty(the_rbtree): 88 r""" 89 Initialize this RBTree as Empty 90 91 This routine initializes *the_rbtree* to contain zero nodes. 92 """ 93 return _rbtree.rtems_rbtree_initialize_empty(the_rbtree)
Initialize this RBTree as Empty
This routine initializes the_rbtree to contain zero nodes.
95def rtems_rbtree_set_off_tree(node): 96 r""" 97 Set off RBtree. 98 99 This function sets the next and previous fields of the *node* to NULL 100 indicating the *node* is not part of any rbtree. 101 """ 102 return _rbtree.rtems_rbtree_set_off_tree(node)
Set off RBtree.
This function sets the next and previous fields of the node to NULL indicating the node is not part of any rbtree.
104def rtems_rbtree_is_node_off_tree(node): 105 r""" 106 Is the Node off RBTree. 107 108 This function returns true if the *node* is not on a rbtree. A *node* is 109 off rbtree if the next and previous fields are set to NULL. 110 """ 111 return _rbtree.rtems_rbtree_is_node_off_tree(node)
Is the Node off RBTree.
This function returns true if the node is not on a rbtree. A node is off rbtree if the next and previous fields are set to NULL.
113def rtems_rbtree_root(the_rbtree): 114 r""" 115 Return pointer to RBTree root. 116 117 This function returns a pointer to the root node of *the_rbtree*. 118 """ 119 return _rbtree.rtems_rbtree_root(the_rbtree)
Return pointer to RBTree root.
This function returns a pointer to the root node of the_rbtree.
129def rtems_rbtree_left(the_node): 130 r""" 131 Return pointer to the left child node from this node. 132 133 This function returns a pointer to the left child node of *the_node*. 134 """ 135 return _rbtree.rtems_rbtree_left(the_node)
Return pointer to the left child node from this node.
This function returns a pointer to the left child node of the_node.
137def rtems_rbtree_right(the_node): 138 r""" 139 Return pointer to the right child node from this node. 140 141 This function returns a pointer to the right child node of *the_node*. 142 """ 143 return _rbtree.rtems_rbtree_right(the_node)
Return pointer to the right child node from this node.
This function returns a pointer to the right child node of the_node.
149def rtems_rbtree_is_empty(the_rbtree): 150 r""" 151 Is the RBTree empty. 152 153 This function returns true if there a no nodes on *the_rbtree* and 154 false otherwise. 155 """ 156 return _rbtree.rtems_rbtree_is_empty(the_rbtree)
Is the RBTree empty.
This function returns true if there a no nodes on the_rbtree and false otherwise.
158def rtems_rbtree_is_min(the_rbtree, the_node): 159 r""" 160 Is this the minimum node on the RBTree. 161 162 This function returns true if *the_node* is the min node on *the_rbtree* 163 and false otherwise. 164 """ 165 return _rbtree.rtems_rbtree_is_min(the_rbtree, the_node)
Is this the minimum node on the RBTree.
This function returns true if the_node is the min node on the_rbtree and false otherwise.
167def rtems_rbtree_is_max(the_rbtree, the_node): 168 r""" 169 Is this the maximum node on the RBTree. 170 171 This function returns true if *the_node* is the max node on *the_rbtree* 172 and false otherwise. 173 """ 174 return _rbtree.rtems_rbtree_is_max(the_rbtree, the_node)
Is this the maximum node on the RBTree.
This function returns true if the_node is the max node on the_rbtree and false otherwise.
180def rtems_rbtree_is_equal(compare_result): 181 r""" 182 rtems_rbtree_is_equal(rtems_rbtree_compare_result compare_result) -> bool 183 184 Parameters 185 ---------- 186 compare_result: rtems_rbtree_compare_result 187 188 """ 189 return _rbtree.rtems_rbtree_is_equal(compare_result)
rtems_rbtree_is_equal(rtems_rbtree_compare_result compare_result) -> bool
Parameters
compare_result: rtems_rbtree_compare_result
191def rtems_rbtree_is_greater(compare_result): 192 r""" 193 rtems_rbtree_is_greater(rtems_rbtree_compare_result compare_result) -> bool 194 195 Parameters 196 ---------- 197 compare_result: rtems_rbtree_compare_result 198 199 """ 200 return _rbtree.rtems_rbtree_is_greater(compare_result)
rtems_rbtree_is_greater(rtems_rbtree_compare_result compare_result) -> bool
Parameters
compare_result: rtems_rbtree_compare_result
202def rtems_rbtree_is_lesser(compare_result): 203 r""" 204 rtems_rbtree_is_lesser(rtems_rbtree_compare_result compare_result) -> bool 205 206 Parameters 207 ---------- 208 compare_result: rtems_rbtree_compare_result 209 210 """ 211 return _rbtree.rtems_rbtree_is_lesser(compare_result)
rtems_rbtree_is_lesser(rtems_rbtree_compare_result compare_result) -> bool
Parameters
compare_result: rtems_rbtree_compare_result
213def rtems_rbtree_find(the_rbtree, the_node, compare, is_unique): 214 r""" 215 Tries to find a node for the specified key in the tree. 216 217 :type the_rbtree: rtems_rbtree_control, in 218 :param the_rbtree: The red-black tree control. 219 :type the_node: rtems_rbtree_node, in 220 :param the_node: A node specifying the key. 221 :type compare: long, in 222 :param compare: The node compare function. 223 :type is_unique: boolean, in 224 :param is_unique: If true, then return the first node with a key equal to 225 the one of the node specified if it exits, else return the last node if it 226 exists. 227 """ 228 return _rbtree.rtems_rbtree_find(the_rbtree, the_node, compare, is_unique)
Tries to find a node for the specified key in the tree.
Parameters
- the_rbtree: The red-black tree control.
- the_node: A node specifying the key.
- compare: The node compare function.
- is_unique: If true, then return the first node with a key equal to the one of the node specified if it exits, else return the last node if it exists.
242def rtems_rbtree_get_min(the_rbtree): 243 r""" 244 Gets a node with the minimum key value from the red-black tree. 245 246 This function extracts a node with the minimum key value from 247 tree and returns a pointer to that node if it exists. In case multiple 248 nodes with a minimum key value exist, then they are extracted in FIFO order. 249 250 :type the_rbtree: rtems_rbtree_control, in 251 :param the_rbtree: The red-black tree control. 252 """ 253 return _rbtree.rtems_rbtree_get_min(the_rbtree)
Gets a node with the minimum key value from the red-black tree.
This function extracts a node with the minimum key value from tree and returns a pointer to that node if it exists. In case multiple nodes with a minimum key value exist, then they are extracted in FIFO order.
Parameters
- the_rbtree: The red-black tree control.
255def rtems_rbtree_get_max(the_rbtree): 256 r""" 257 Gets a node with the maximal key value from the red-black tree. 258 259 This function extracts a node with the maximum key value from tree and 260 returns a pointer to that node if it exists. In case multiple nodes with a 261 maximum key value exist, then they are extracted in LIFO order. 262 263 :type the_rbtree: rtems_rbtree_control, in 264 :param the_rbtree: The red-black tree control. 265 """ 266 return _rbtree.rtems_rbtree_get_max(the_rbtree)
Gets a node with the maximal key value from the red-black tree.
This function extracts a node with the maximum key value from tree and returns a pointer to that node if it exists. In case multiple nodes with a maximum key value exist, then they are extracted in LIFO order.
Parameters
- the_rbtree: The red-black tree control.
268def rtems_rbtree_peek_min(the_rbtree): 269 r""" 270 Peek at the min node on a rbtree. 271 272 This function returns a pointer to the min node from *the_rbtree* 273 without changing the tree. If *the_rbtree* is empty, 274 then NULL is returned. 275 """ 276 return _rbtree.rtems_rbtree_peek_min(the_rbtree)
Peek at the min node on a rbtree.
This function returns a pointer to the min node from the_rbtree without changing the tree. If the_rbtree is empty, then NULL is returned.
278def rtems_rbtree_peek_max(the_rbtree): 279 r""" 280 Peek at the max node on a rbtree. 281 282 This function returns a pointer to the max node from *the_rbtree* 283 without changing the tree. If *the_rbtree* is empty, 284 then NULL is returned. 285 """ 286 return _rbtree.rtems_rbtree_peek_max(the_rbtree)
Peek at the max node on a rbtree.
This function returns a pointer to the max node from the_rbtree without changing the tree. If the_rbtree is empty, then NULL is returned.
288def rtems_rbtree_insert(the_rbtree, the_node, compare, is_unique): 289 r""" 290 Inserts the node into the red-black tree. 291 292 In case the node is already a node of a tree, then this function yields 293 unpredictable results. 294 295 :type the_rbtree: RBTree_Control, in 296 :param the_rbtree: The red-black tree control. 297 :type the_node: RBTree_Node, in 298 :param the_node: The node to insert. 299 :type compare: long, in 300 :param compare: The node compare function. 301 :type is_unique: boolean, in 302 :param is_unique: If true, then reject nodes with a duplicate key, else 303 insert nodes in FIFO order in case the key value is equal to existing nodes. 304 """ 305 return _rbtree.rtems_rbtree_insert(the_rbtree, the_node, compare, is_unique)
Inserts the node into the red-black tree.
In case the node is already a node of a tree, then this function yields unpredictable results.
Parameters
- the_rbtree: The red-black tree control.
- the_node: The node to insert.
- compare: The node compare function.
- is_unique: If true, then reject nodes with a duplicate key, else insert nodes in FIFO order in case the key value is equal to existing nodes.