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)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 15 Aug 2019 15:41:44 +0000 (11:41 -0400)
commitead8c3d49f4ee6b8b826062bd88b943a23f5faf0
tree3233a8e05771a695e7dc8fd68728c633b0aa9065
parent43a94dc939c1222729d90286b651c5ecc8d2f149
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.024785 seconds and 4 git commands to generate.