bt2: add user attributes property support
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 14 Aug 2019 07:18:56 +0000 (03:18 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 4 Sep 2019 15:58:21 +0000 (11:58 -0400)
commitb2df57802ba47b7bad14879a6851ce0a13e100b4
tree1ff40f7de54367ad15a1373ca77cdc7da5a5303d
parent7753db0d6dc99750df8e5c940076c7bfa826fb6b
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.028912 seconds and 4 git commands to generate.