bt2: add user attributes property support
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 14 Aug 2019 07:18:56 +0000 (03:18 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 15 Aug 2019 15:41:44 +0000 (11:41 -0400)
commit5783664e46332216fd38a7b287258a7c9543af57
treed7c6ea20312521cc5f050120a0cb845b196deacf
parent48be9a9176ef8d3a81390d43769093d91e9d5227
bt2: add user attributes property support

This patch adds user attributes property support to the appropriate
`bt2` objects to wrap the equivalent library functions.

The following objects now have a read-only `user_attributes` property
which returns a map value object:

* `_ClockClass`
* `_EventClass`
* `_FieldClass`
* `_Stream`
* `_StreamClass`
* `_StructureFieldClassMember`
* `_Trace`
* `_TraceClass`
* `_VariantFieldClassOption`

You can set the user attributes of those objects at creation time, when
calling the creation method, or when appending a structure field class
member or a variant field class option for `_StructureFieldClassMember`
and `_VariantFieldClassOption`.

To make the `_user_attributes` property of `_StructureFieldClassMember`
and `_VariantFieldClassOption` above possible, I made them wrap a real
BT pointer and keep a reference on the owning field class, making all
the properties make a call to the library instead of the object just
containing them.

In `test_field_class.py`, because there's now a common property to test
for each field class, the new `_TestFieldClass` mixin does that,
requiring a _create_default_field_class() method which accepts custom
positional and keyword arguments to create a specific default field
class to test.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I1d58f1b386e4a367f038f1dda9c2e58738794a66
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1923
Tested-by: jenkins <jenkins@lttng.org>
15 files changed:
src/bindings/python/bt2/bt2/clock_class.py
src/bindings/python/bt2/bt2/component.py
src/bindings/python/bt2/bt2/event_class.py
src/bindings/python/bt2/bt2/field_class.py
src/bindings/python/bt2/bt2/stream.py
src/bindings/python/bt2/bt2/stream_class.py
src/bindings/python/bt2/bt2/trace.py
src/bindings/python/bt2/bt2/trace_class.py
tests/bindings/python/bt2/test_clock_class.py
tests/bindings/python/bt2/test_event_class.py
tests/bindings/python/bt2/test_field_class.py
tests/bindings/python/bt2/test_stream.py
tests/bindings/python/bt2/test_stream_class.py
tests/bindings/python/bt2/test_trace.py
tests/bindings/python/bt2/test_trace_class.py
This page took 0.02665 seconds and 4 git commands to generate.