Merge branch 'master' into bindings/python
Return event fields by field name

Since a field may be present both in an event and its stream's scope,
this returns a list which contains all the fields by the name. The
examples are also changed to match this new API.

Signed-off-by: Xiaona Han <xiaonahappy13@163.com>
Acked-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Remove the unnecessary underscore prefix

When getting the fields of an event by name, it is not necessary
to add an underscore prefix. This removes the underscore prefix of
the field names in the examples.

Signed-off-by: Xiaona Han <xiaonahappy13@163.com>
Acked-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Support getting the value of enums

Use 'get_enum_str' to get the string matching the current enumeration.

Signed-off-by: Xiaona Han <xiaonahappy13@163.com>
Acked-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Add a generic get_value() implementation

Use get_value to get a field's value. Currently it does not support
compound types. Also it does not support floating point, since getting
a float's value is not implemented in babeltrace now.

Edit by Jérémie Galarneau: Arrays' value should not be returned using
get_char_array(). Implemented get_array_element_at() which returns a
Definition object corresponding to the array's element.

Exposed the bt_array_index function in the Python bindings

Signed-off-by: Xiaona Han <xiaonahappy13@163.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Support for the sequence type

Add support for getting a sequence's value in the python binding.

Signed-off-by: Xiaona Han <xiaonahappy13@163.com>
Acked-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Add a python bindings sequence test

This example is meant to test whether we can get a sequence's values in
the python binding well or not. It is used in conjunction with the
sequence test in the dir tests/ctf-traces/succeed/sequence.

Signed-off-by: Xiaona Han <xiaonahappy13@163.com>
Acked-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Remove Python 2 specific examples

These examples rely on the cairoplot module which is not compatible with
Python 3.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: Throw a FieldError exception when get_value() fails

Throw an exception whenever bt_ctf_field_get_error() reports an error.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Add support for floating point fields in the python bindings

get_value() now returns a floating point field's value.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Add support for variant fields in the python bindings

get_value() now returns the variant's selected field's value
when called on a variant.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Add support for structure fields in the Python bindings

get_value() returns a dictionary when the field is a structure.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: Python bindings array access functions write out of bounds

The array access functions in the Python complements are writing
past the last element to add a NULL pointer and then using it from the
Python code to detect the end of the array. This may cause stability
issues.

This changes the functions to return multiple values (array and length)
in Python using SWIG's built-in OUTPUT typemaps.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Rename the ctf class to CTFReader

This prevents name collisions with the upcoming CTFWriter classes.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Rename and move type_id class out of the CTFReader class

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Add CTF Writer Python bindings

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Add a usage example for the CTF Writer Python bindings

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Don't generate Python bindings by default

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>