bt2: add bit array field class and field support
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 13 Aug 2019 23:35:12 +0000 (19:35 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 4 Sep 2019 15:58:21 +0000 (11:58 -0400)
commit6b29f2d4334a358bac1114686881f1309ecfa8f0
treed42534e38e56faa2a2ce0751bf40da0cd8b5c50a
parentadec7d09ca42a12083e464404cf0478cde0652c4
bt2: add bit array field class and field support

This patch adds bit array field class and field support to the Python
bindings.

A bit array field class has a `length` property (number of bits in the
array).

As of this patch, a bit array field is not a Python sequence. It could
become in the future however. The way to access a bit array field's
value is the `value_as_integer` property which simply wraps the
corresponding library functions.

A bit array field is not considered a numeric field. Its _spec_eq()
method only compares if the other object is also a bit array fields.

I did not implement the __bool__() operator because it will need to
satisfy the Python sequence protocol (length is not 0, which in fact is
always the case with a bit array field), should we decide as such in the
future. I implemented the __len__() operator however which is
straightforward.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I2e90e1444151bf5169a8df70c53664096cceb6c4
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1918
Tested-by: jenkins <jenkins@lttng.org>
src/bindings/python/bt2/bt2/__init__.py
src/bindings/python/bt2/bt2/field.py
src/bindings/python/bt2/bt2/field_class.py
src/bindings/python/bt2/bt2/trace_class.py
tests/bindings/python/bt2/test_field.py
tests/bindings/python/bt2/test_field_class.py
tests/bindings/python/bt2/test_package.py
This page took 0.025219 seconds and 4 git commands to generate.