21cb0c61b700719ad113e717c7b6c490ed0b36ea
1 # SPDX-License-Identifier: MIT
3 # Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
5 from bt2
import error
as bt2_error
6 from bt2
import utils
as bt2_utils
7 from bt2
import logging
as bt2_logging
8 from bt2
import native_bt
9 from bt2
import component_descriptor
as bt2_component_descriptor
12 def get_greatest_operative_mip_version(
13 component_descriptors
, log_level
=bt2_logging
.LoggingLevel
.NONE
15 bt2_utils
._check
_log
_level
(log_level
)
16 comp_descr_set_ptr
= native_bt
.component_descriptor_set_create()
18 if comp_descr_set_ptr
is None:
19 raise bt2_error
._MemoryError
("cannot create component descriptor set object")
21 if len(component_descriptors
) == 0:
22 raise ValueError("no component descriptors")
25 for descr
in component_descriptors
:
26 if type(descr
) is not bt2_component_descriptor
.ComponentDescriptor
:
27 raise TypeError("'{}' is not a component descriptor".format(descr
))
29 base_cc_ptr
= descr
.component_class
._bt
_component
_class
_ptr
()
32 if descr
.params
is not None:
33 params_ptr
= descr
.params
._ptr
35 status
= native_bt
.bt2_component_descriptor_set_add_descriptor_with_initialize_method_data(
36 comp_descr_set_ptr
, base_cc_ptr
, params_ptr
, descr
.obj
38 bt2_utils
._handle
_func
_status
(
39 status
, "cannot add descriptor to component descriptor set"
42 status
, version
= native_bt
.get_greatest_operative_mip_version(
43 comp_descr_set_ptr
, log_level
46 if status
== native_bt
.__BT
_FUNC
_STATUS
_NO
_MATCH
:
49 bt2_utils
._handle
_func
_status
(
50 status
, "cannot get greatest operative MIP version"
54 native_bt
.component_descriptor_set_put_ref(comp_descr_set_ptr
)
57 def get_maximal_mip_version():
58 return native_bt
.get_maximal_mip_version()
This page took 0.03184 seconds and 5 git commands to generate.