rbheap

  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 _rbheap as _rbheap
  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
 57class rtems_rbheap_chunk(object):
 58    r"""Red-black heap chunk descriptor."""
 59
 60    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
 61    __repr__ = _swig_repr
 62    chain_node = property(_rbheap.rtems_rbheap_chunk_chain_node_get, _rbheap.rtems_rbheap_chunk_chain_node_set, doc=r"""
 63    This chain node can be used in two chains
 64     - the chain of spare chunk descriptors and
 65     - the chain of free chunks in the managed memory area.
 66
 67    In case this chain node is not part of a chain, the chunk represents a
 68    used chunk in the managed memory area.
 69    """)
 70    tree_node = property(_rbheap.rtems_rbheap_chunk_tree_node_get, _rbheap.rtems_rbheap_chunk_tree_node_set, doc=r"""
 71    Tree node for chunks that represent a part of the managed memory area.
 72    These chunks are either free or used.
 73    """)
 74    begin = property(_rbheap.rtems_rbheap_chunk_begin_get, _rbheap.rtems_rbheap_chunk_begin_set, doc=r"""
 75    Begin address of the chunk.  The address alignment it specified in the
 76    'rtems_rbheap_control'.
 77    """)
 78    size = property(_rbheap.rtems_rbheap_chunk_size_get, _rbheap.rtems_rbheap_chunk_size_set, doc=r"""Size of the chunk in bytes.""")
 79
 80    def __init__(self):
 81        r"""__init__(rtems_rbheap_chunk self) -> rtems_rbheap_chunk"""
 82        _rbheap.rtems_rbheap_chunk_swiginit(self, _rbheap.new_rtems_rbheap_chunk())
 83    __swig_destroy__ = _rbheap.delete_rtems_rbheap_chunk
 84
 85# Register rtems_rbheap_chunk in _rbheap:
 86_rbheap.rtems_rbheap_chunk_swigregister(rtems_rbheap_chunk)
 87class rtems_rbheap_control(object):
 88    r"""Red-black heap control."""
 89
 90    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
 91    __repr__ = _swig_repr
 92    free_chunk_chain = property(_rbheap.rtems_rbheap_control_free_chunk_chain_get, _rbheap.rtems_rbheap_control_free_chunk_chain_set, doc=r"""Chain of free chunks in the managed memory area.""")
 93    spare_descriptor_chain = property(_rbheap.rtems_rbheap_control_spare_descriptor_chain_get, _rbheap.rtems_rbheap_control_spare_descriptor_chain_set, doc=r"""
 94    Chain of free chunk descriptors.  Descriptors are consumed during
 95    allocation and may be produced during free if contiguous chunks can be
 96    coalesced.  In case of descriptor starvation the 'extend_descriptors'
 97    handler will be called.
 98    """)
 99    chunk_tree = property(_rbheap.rtems_rbheap_control_chunk_tree_get, _rbheap.rtems_rbheap_control_chunk_tree_set, doc=r"""Tree of chunks representing the state of the managed memory area.""")
100    alignment = property(_rbheap.rtems_rbheap_control_alignment_get, _rbheap.rtems_rbheap_control_alignment_set, doc=r"""Minimum chunk begin alignment in bytes.""")
101    extend_descriptors = property(_rbheap.rtems_rbheap_control_extend_descriptors_get, _rbheap.rtems_rbheap_control_extend_descriptors_set, doc=r"""Handler to extend the available chunk descriptors.""")
102    handler_arg = property(_rbheap.rtems_rbheap_control_handler_arg_get, _rbheap.rtems_rbheap_control_handler_arg_set, doc=r"""User specified argument handler for private handler data.""")
103
104    def __init__(self):
105        r"""__init__(rtems_rbheap_control self) -> rtems_rbheap_control"""
106        _rbheap.rtems_rbheap_control_swiginit(self, _rbheap.new_rtems_rbheap_control())
107    __swig_destroy__ = _rbheap.delete_rtems_rbheap_control
108
109# Register rtems_rbheap_control in _rbheap:
110_rbheap.rtems_rbheap_control_swigregister(rtems_rbheap_control)
111
112def rtems_rbheap_initialize(control, area_begin, area_size, alignment, extend_descriptors, handler_arg):
113    r"""
114    Initializes the red-black tree heap *control*.
115
116    :param out]: control The red-black tree heap.
117    :type area_begin: void, in
118    :param area_begin: The managed memory area begin.
119    :type area_size: uintptr_t, in
120    :param area_size: The managed memory area size.
121    :type alignment: uintptr_t, in
122    :param alignment: The minimum chunk alignment.
123    :type extend_descriptors: void, in
124    :param extend_descriptors: The handler to extend the available chunk
125        descriptors.
126    :type handler_arg: void, in
127    :param handler_arg: The handler argument.
128    """
129    return _rbheap.rtems_rbheap_initialize(control, area_begin, area_size, alignment, extend_descriptors, handler_arg)
130
131def rtems_rbheap_allocate(control, size):
132    r"""
133    Allocates a chunk of memory of at least *size* bytes from the
134    red-black tree heap *control*.
135
136    The chunk begin is aligned by the value specified in
137    rtems_rbheap_initialize().
138
139    :param out]: control The red-black tree heap.
140    :type size: int, in
141    :param size: The requested chunk size in bytes.
142    """
143    return _rbheap.rtems_rbheap_allocate(control, size)
144
145def rtems_rbheap_free(control, ptr):
146    r"""
147    Frees a chunk of memory *ptr* allocated from the red-black tree heap
148    *control*.
149
150    :param out]: control The red-black tree heap.
151    :type ptr: void, in
152    :param ptr: The pointer to the chunk of memory.
153    """
154    return _rbheap.rtems_rbheap_free(control, ptr)
155
156def rtems_rbheap_get_spare_descriptor_chain(control):
157    r"""
158    rtems_rbheap_get_spare_descriptor_chain(rtems_rbheap_control control) -> rtems_chain_control *
159
160    Parameters
161    ----------
162    control: rtems_rbheap_control *
163
164    """
165    return _rbheap.rtems_rbheap_get_spare_descriptor_chain(control)
166
167def rtems_rbheap_add_to_spare_descriptor_chain(control, chunk):
168    r"""
169    rtems_rbheap_add_to_spare_descriptor_chain(rtems_rbheap_control control, rtems_rbheap_chunk chunk)
170
171    Parameters
172    ----------
173    control: rtems_rbheap_control *
174    chunk: rtems_rbheap_chunk *
175
176    """
177    return _rbheap.rtems_rbheap_add_to_spare_descriptor_chain(control, chunk)
178
179def rtems_rbheap_set_extend_descriptors(control, extend_descriptors):
180    r"""
181    rtems_rbheap_set_extend_descriptors(rtems_rbheap_control control, rtems_rbheap_extend_descriptors extend_descriptors)
182
183    Parameters
184    ----------
185    control: rtems_rbheap_control *
186    extend_descriptors: rtems_rbheap_extend_descriptors
187
188    """
189    return _rbheap.rtems_rbheap_set_extend_descriptors(control, extend_descriptors)
190
191def rtems_rbheap_get_handler_arg(control):
192    r"""
193    rtems_rbheap_get_handler_arg(rtems_rbheap_control control) -> void *
194
195    Parameters
196    ----------
197    control: rtems_rbheap_control const *
198
199    """
200    return _rbheap.rtems_rbheap_get_handler_arg(control)
201
202def rtems_rbheap_set_handler_arg(control, handler_arg):
203    r"""
204    rtems_rbheap_set_handler_arg(rtems_rbheap_control control, void * handler_arg)
205
206    Parameters
207    ----------
208    control: rtems_rbheap_control *
209    handler_arg: void *
210
211    """
212    return _rbheap.rtems_rbheap_set_handler_arg(control, handler_arg)
213
214def rtems_rbheap_extend_descriptors_never(control):
215    r"""Chunk descriptor extend handler that does nothing."""
216    return _rbheap.rtems_rbheap_extend_descriptors_never(control)
217
218def rtems_rbheap_extend_descriptors_with_malloc(control):
219    r"""Chunk descriptor extend handler that uses malloc()."""
220    return _rbheap.rtems_rbheap_extend_descriptors_with_malloc(control)
221
222def rtems_rbheap_is_chunk_free(chunk):
223    
224    return _rbheap.rtems_rbheap_is_chunk_free(chunk)
class rtems_rbheap_chunk:
58class rtems_rbheap_chunk(object):
59    r"""Red-black heap chunk descriptor."""
60
61    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
62    __repr__ = _swig_repr
63    chain_node = property(_rbheap.rtems_rbheap_chunk_chain_node_get, _rbheap.rtems_rbheap_chunk_chain_node_set, doc=r"""
64    This chain node can be used in two chains
65     - the chain of spare chunk descriptors and
66     - the chain of free chunks in the managed memory area.
67
68    In case this chain node is not part of a chain, the chunk represents a
69    used chunk in the managed memory area.
70    """)
71    tree_node = property(_rbheap.rtems_rbheap_chunk_tree_node_get, _rbheap.rtems_rbheap_chunk_tree_node_set, doc=r"""
72    Tree node for chunks that represent a part of the managed memory area.
73    These chunks are either free or used.
74    """)
75    begin = property(_rbheap.rtems_rbheap_chunk_begin_get, _rbheap.rtems_rbheap_chunk_begin_set, doc=r"""
76    Begin address of the chunk.  The address alignment it specified in the
77    'rtems_rbheap_control'.
78    """)
79    size = property(_rbheap.rtems_rbheap_chunk_size_get, _rbheap.rtems_rbheap_chunk_size_set, doc=r"""Size of the chunk in bytes.""")
80
81    def __init__(self):
82        r"""__init__(rtems_rbheap_chunk self) -> rtems_rbheap_chunk"""
83        _rbheap.rtems_rbheap_chunk_swiginit(self, _rbheap.new_rtems_rbheap_chunk())
84    __swig_destroy__ = _rbheap.delete_rtems_rbheap_chunk

Red-black heap chunk descriptor.

rtems_rbheap_chunk()
81    def __init__(self):
82        r"""__init__(rtems_rbheap_chunk self) -> rtems_rbheap_chunk"""
83        _rbheap.rtems_rbheap_chunk_swiginit(self, _rbheap.new_rtems_rbheap_chunk())

__init__(rtems_rbheap_chunk self) -> rtems_rbheap_chunk

thisown
61    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

The membership flag

chain_node
tree_node
begin
size
class rtems_rbheap_control:
 88class rtems_rbheap_control(object):
 89    r"""Red-black heap control."""
 90
 91    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
 92    __repr__ = _swig_repr
 93    free_chunk_chain = property(_rbheap.rtems_rbheap_control_free_chunk_chain_get, _rbheap.rtems_rbheap_control_free_chunk_chain_set, doc=r"""Chain of free chunks in the managed memory area.""")
 94    spare_descriptor_chain = property(_rbheap.rtems_rbheap_control_spare_descriptor_chain_get, _rbheap.rtems_rbheap_control_spare_descriptor_chain_set, doc=r"""
 95    Chain of free chunk descriptors.  Descriptors are consumed during
 96    allocation and may be produced during free if contiguous chunks can be
 97    coalesced.  In case of descriptor starvation the 'extend_descriptors'
 98    handler will be called.
 99    """)
100    chunk_tree = property(_rbheap.rtems_rbheap_control_chunk_tree_get, _rbheap.rtems_rbheap_control_chunk_tree_set, doc=r"""Tree of chunks representing the state of the managed memory area.""")
101    alignment = property(_rbheap.rtems_rbheap_control_alignment_get, _rbheap.rtems_rbheap_control_alignment_set, doc=r"""Minimum chunk begin alignment in bytes.""")
102    extend_descriptors = property(_rbheap.rtems_rbheap_control_extend_descriptors_get, _rbheap.rtems_rbheap_control_extend_descriptors_set, doc=r"""Handler to extend the available chunk descriptors.""")
103    handler_arg = property(_rbheap.rtems_rbheap_control_handler_arg_get, _rbheap.rtems_rbheap_control_handler_arg_set, doc=r"""User specified argument handler for private handler data.""")
104
105    def __init__(self):
106        r"""__init__(rtems_rbheap_control self) -> rtems_rbheap_control"""
107        _rbheap.rtems_rbheap_control_swiginit(self, _rbheap.new_rtems_rbheap_control())
108    __swig_destroy__ = _rbheap.delete_rtems_rbheap_control

Red-black heap control.

rtems_rbheap_control()
105    def __init__(self):
106        r"""__init__(rtems_rbheap_control self) -> rtems_rbheap_control"""
107        _rbheap.rtems_rbheap_control_swiginit(self, _rbheap.new_rtems_rbheap_control())

__init__(rtems_rbheap_control self) -> rtems_rbheap_control

thisown
91    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

The membership flag

free_chunk_chain
spare_descriptor_chain
chunk_tree
alignment
extend_descriptors
handler_arg
def rtems_rbheap_initialize( control, area_begin, area_size, alignment, extend_descriptors, handler_arg):
113def rtems_rbheap_initialize(control, area_begin, area_size, alignment, extend_descriptors, handler_arg):
114    r"""
115    Initializes the red-black tree heap *control*.
116
117    :param out]: control The red-black tree heap.
118    :type area_begin: void, in
119    :param area_begin: The managed memory area begin.
120    :type area_size: uintptr_t, in
121    :param area_size: The managed memory area size.
122    :type alignment: uintptr_t, in
123    :param alignment: The minimum chunk alignment.
124    :type extend_descriptors: void, in
125    :param extend_descriptors: The handler to extend the available chunk
126        descriptors.
127    :type handler_arg: void, in
128    :param handler_arg: The handler argument.
129    """
130    return _rbheap.rtems_rbheap_initialize(control, area_begin, area_size, alignment, extend_descriptors, handler_arg)

Initializes the red-black tree heap control.

Parameters
  • out]: control The red-black tree heap.
  • area_begin: The managed memory area begin.
  • area_size: The managed memory area size.
  • alignment: The minimum chunk alignment.
  • extend_descriptors: The handler to extend the available chunk descriptors.
  • handler_arg: The handler argument.
def rtems_rbheap_allocate(control, size):
132def rtems_rbheap_allocate(control, size):
133    r"""
134    Allocates a chunk of memory of at least *size* bytes from the
135    red-black tree heap *control*.
136
137    The chunk begin is aligned by the value specified in
138    rtems_rbheap_initialize().
139
140    :param out]: control The red-black tree heap.
141    :type size: int, in
142    :param size: The requested chunk size in bytes.
143    """
144    return _rbheap.rtems_rbheap_allocate(control, size)

Allocates a chunk of memory of at least size bytes from the red-black tree heap control.

The chunk begin is aligned by the value specified in rtems_rbheap_initialize().

Parameters
  • out]: control The red-black tree heap.
  • size: The requested chunk size in bytes.
def rtems_rbheap_free(control, ptr):
146def rtems_rbheap_free(control, ptr):
147    r"""
148    Frees a chunk of memory *ptr* allocated from the red-black tree heap
149    *control*.
150
151    :param out]: control The red-black tree heap.
152    :type ptr: void, in
153    :param ptr: The pointer to the chunk of memory.
154    """
155    return _rbheap.rtems_rbheap_free(control, ptr)

Frees a chunk of memory ptr allocated from the red-black tree heap control.

Parameters
  • out]: control The red-black tree heap.
  • ptr: The pointer to the chunk of memory.
def rtems_rbheap_get_spare_descriptor_chain(control):
157def rtems_rbheap_get_spare_descriptor_chain(control):
158    r"""
159    rtems_rbheap_get_spare_descriptor_chain(rtems_rbheap_control control) -> rtems_chain_control *
160
161    Parameters
162    ----------
163    control: rtems_rbheap_control *
164
165    """
166    return _rbheap.rtems_rbheap_get_spare_descriptor_chain(control)

rtems_rbheap_get_spare_descriptor_chain(rtems_rbheap_control control) -> rtems_chain_control *

Parameters

control: rtems_rbheap_control *

def rtems_rbheap_add_to_spare_descriptor_chain(control, chunk):
168def rtems_rbheap_add_to_spare_descriptor_chain(control, chunk):
169    r"""
170    rtems_rbheap_add_to_spare_descriptor_chain(rtems_rbheap_control control, rtems_rbheap_chunk chunk)
171
172    Parameters
173    ----------
174    control: rtems_rbheap_control *
175    chunk: rtems_rbheap_chunk *
176
177    """
178    return _rbheap.rtems_rbheap_add_to_spare_descriptor_chain(control, chunk)

rtems_rbheap_add_to_spare_descriptor_chain(rtems_rbheap_control control, rtems_rbheap_chunk chunk)

Parameters

control: rtems_rbheap_control * chunk: rtems_rbheap_chunk *

def rtems_rbheap_set_extend_descriptors(control, extend_descriptors):
180def rtems_rbheap_set_extend_descriptors(control, extend_descriptors):
181    r"""
182    rtems_rbheap_set_extend_descriptors(rtems_rbheap_control control, rtems_rbheap_extend_descriptors extend_descriptors)
183
184    Parameters
185    ----------
186    control: rtems_rbheap_control *
187    extend_descriptors: rtems_rbheap_extend_descriptors
188
189    """
190    return _rbheap.rtems_rbheap_set_extend_descriptors(control, extend_descriptors)

rtems_rbheap_set_extend_descriptors(rtems_rbheap_control control, rtems_rbheap_extend_descriptors extend_descriptors)

Parameters

control: rtems_rbheap_control * extend_descriptors: rtems_rbheap_extend_descriptors

def rtems_rbheap_get_handler_arg(control):
192def rtems_rbheap_get_handler_arg(control):
193    r"""
194    rtems_rbheap_get_handler_arg(rtems_rbheap_control control) -> void *
195
196    Parameters
197    ----------
198    control: rtems_rbheap_control const *
199
200    """
201    return _rbheap.rtems_rbheap_get_handler_arg(control)

rtems_rbheap_get_handler_arg(rtems_rbheap_control control) -> void *

Parameters

control: rtems_rbheap_control const *

def rtems_rbheap_set_handler_arg(control, handler_arg):
203def rtems_rbheap_set_handler_arg(control, handler_arg):
204    r"""
205    rtems_rbheap_set_handler_arg(rtems_rbheap_control control, void * handler_arg)
206
207    Parameters
208    ----------
209    control: rtems_rbheap_control *
210    handler_arg: void *
211
212    """
213    return _rbheap.rtems_rbheap_set_handler_arg(control, handler_arg)

rtems_rbheap_set_handler_arg(rtems_rbheap_control control, void * handler_arg)

Parameters

control: rtems_rbheap_control * handler_arg: void *

def rtems_rbheap_extend_descriptors_never(control):
215def rtems_rbheap_extend_descriptors_never(control):
216    r"""Chunk descriptor extend handler that does nothing."""
217    return _rbheap.rtems_rbheap_extend_descriptors_never(control)

Chunk descriptor extend handler that does nothing.

def rtems_rbheap_extend_descriptors_with_malloc(control):
219def rtems_rbheap_extend_descriptors_with_malloc(control):
220    r"""Chunk descriptor extend handler that uses malloc()."""
221    return _rbheap.rtems_rbheap_extend_descriptors_with_malloc(control)

Chunk descriptor extend handler that uses malloc().

def rtems_rbheap_is_chunk_free(chunk):
223def rtems_rbheap_is_chunk_free(chunk):
224    
225    return _rbheap.rtems_rbheap_is_chunk_free(chunk)