92997f17955728629cd4a5958f58cf1b96b07ed5
1 # The MIT License (MIT)
3 # Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
5 # Permission is hereby granted, free of charge, to any person obtaining a copy
6 # of this software and associated documentation files (the "Software"), to deal
7 # in the Software without restriction, including without limitation the rights
8 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 # copies of the Software, and to permit persons to whom the Software is
10 # furnished to do so, subject to the following conditions:
12 # The above copyright notice and this permission notice shall be included in
13 # all copies or substantial portions of the Software.
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 from bt2
import native_bt
, utils
27 def get_greatest_operative_mip_version(
28 component_descriptors
, log_level
=bt2
.LoggingLevel
.NONE
30 utils
._check
_log
_level
(log_level
)
31 comp_descr_set_ptr
= native_bt
.component_descriptor_set_create()
33 if comp_descr_set_ptr
is None:
34 raise bt2
._MemoryError('cannot create component descriptor set object')
36 if len(component_descriptors
) == 0:
37 raise ValueError('no component descriptors')
40 for descr
in component_descriptors
:
41 if type(descr
) is not bt2
.ComponentDescriptor
:
42 raise TypeError("'{}' is not a component descriptor".format(descr
))
44 base_cc_ptr
= descr
.component_class
._bt
_component
_class
_ptr
()
47 if descr
.params
is not None:
48 params_ptr
= descr
.params
._ptr
50 status
= native_bt
.bt2_component_descriptor_set_add_descriptor_with_init_method_data(
51 comp_descr_set_ptr
, base_cc_ptr
, params_ptr
, descr
.obj
53 utils
._handle
_func
_status
(
54 status
, 'cannot add descriptor to component descriptor set'
57 status
, version
= native_bt
.get_greatest_operative_mip_version(
58 comp_descr_set_ptr
, log_level
61 if status
== native_bt
.__BT
_FUNC
_STATUS
_NO
_MATCH
:
64 utils
._handle
_func
_status
(status
, 'cannot get greatest operative MIP version')
67 native_bt
.component_descriptor_set_put_ref(comp_descr_set_ptr
)
70 def get_maximal_mip_version():
71 return native_bt
.get_maximal_mip_version()
This page took 0.030506 seconds and 3 git commands to generate.