%pythoncode%{
-# Based on enum bt_clock_type in clock-type.h
+# Based on enum bt_clock_type in clock-type.h
class ClockType:
CLOCK_CYCLES = 0
CLOCK_REAL = 1
%rename("_bt_ctf_field_get_error") bt_ctf_field_get_error(void);
%rename("_bt_ctf_get_decl_event_name") bt_ctf_get_decl_event_name(const struct
bt_ctf_event_decl *event);
+%rename("_bt_ctf_get_decl_event_id") bt_ctf_get_decl_event_id(const struct
+ bt_ctf_event_decl *event);
%rename("_bt_ctf_get_decl_field_name") bt_ctf_get_decl_field_name(
const struct bt_ctf_field_decl *field);
%rename("_bt_ctf_get_decl_from_def") bt_ctf_get_decl_from_def(
const struct bt_definition *bt_ctf_get_variant(const struct bt_definition *field);
int bt_ctf_field_get_error(void);
const char *bt_ctf_get_decl_event_name(const struct bt_ctf_event_decl *event);
+uint64_t bt_ctf_get_decl_event_id(const struct bt_ctf_event_decl *event);
const char *bt_ctf_get_decl_field_name(const struct bt_ctf_field_decl *field);
const struct bt_declaration *bt_ctf_get_decl_from_def(const struct bt_definition *field);
const struct bt_declaration *bt_ctf_get_decl_from_field_decl(const struct bt_ctf_field_decl *field);
class EventDeclaration(object):
"""Event declaration class. Do not instantiate."""
+ MAX_UINT64 = 0xFFFFFFFFFFFFFFFF
def __init__(self):
raise NotImplementedError("EventDeclaration cannot be instantiated")
"""Return the name of the event or None on error"""
return _bt_ctf_get_decl_event_name(self._ed)
+ @property
+ def id(self):
+ """Return the event-ID of the event or -1 on error"""
+ id = _bt_ctf_get_decl_event_id(self._ed)
+ if id == self.MAX_UINT64:
+ id = -1
+ return id
+
@property
def fields(self):
"""
"""
@length.setter
def length(self, length_field):
- if not isinstance(length, CTFWriter.IntegerField):
+ if not isinstance(length_field, CTFWriter.IntegerField):
raise TypeError("Invalid length field.")
- ret = _bt_ctf_field_sequence_set_length(self._f, length._f)
+ ret = _bt_ctf_field_sequence_set_length(self._f, length_field._f)
if ret < 0:
raise ValueError("Could not set sequence length.")
def set_payload(self, field_name, value_field):
if not isinstance(value, CTFWriter.Field):
raise TypeError("Invalid value type.")
- ret = _bt_ctf_event_set_payload(self._e, str(field_name), value._f)
+ ret = _bt_ctf_event_set_payload(self._e, str(field_name), value_field._f)
if ret < 0:
raise ValueError("Could not set event field payload.")
Increase the current packet's discarded event count.
"""
def append_discarded_events(self, event_count):
- ret = _bt_ctf_stream_append_discarded_events(self._s, event_count)
- if ret < 0:
- raise ValueError("Could not append discarded events.")
+ _bt_ctf_stream_append_discarded_events(self._s, event_count)
"""
Append "event" to the stream's current packet. The stream's associated clock