+ raise NotImplementedError("EventDeclaration cannot be instantiated")
+
+ @property
+ def name(self):
+ """Return the name of the event or None on error"""
+ return _bt_ctf_get_decl_event_name(self._ed)
+
+ @property
+ def fields(self):
+ """
+ Generator returning all FieldDeclarations of an event, going through
+ each scope in the following order:
+ 1) EVENT_FIELDS
+ 2) EVENT_CONTEXT
+ 3) STREAM_EVENT_CONTEXT
+ 4) STREAM_EVENT_HEADER
+ 5) STREAM_PACKET_CONTEXT
+ 6) TRACE_PACKET_HEADER
+ """
+ for scope in _scopes:
+ for declaration in self.fields_scope(scope):
+ yield declaration
+
+ def fields_scope(self, scope):
+ """
+ Generator returning FieldDeclarations of the current event in scope.
+ """
+ ret = _by_python_field_decl_listcaller(self._ed, scope)
+
+ if not isinstance(ret, list):
+ return
+
+ list_ptr, count = ret
+ for i in range(count):
+ field_declaration_ptr = _bt_python_field_decl_one_from_list(list_ptr, i)
+ if field_declaration_ptr is not None:
+ declaration_ptr = _bt_ctf_get_decl_from_field_decl(field_declaration_ptr)
+ field_declaration = _create_field_declaration(declaration_ptr, _bt_ctf_get_decl_field_name(field_declaration_ptr), scope)
+ yield field_declaration
+
+class FieldDeclaration(object):
+ """Field declaration class. Do not instantiate."""
+ def __init__(self):
+ raise NotImplementedError("FieldDeclaration cannot be instantiated")