+ 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")
+
+ def __repr__(self):
+ return "({0}) {1} {2}".format(CTFScope.scope_name(self.scope), CTFTypeId.type_name(self.type), self.name)
+
+ @property
+ def name(self):
+ """Return the name of a FieldDeclaration or None on error."""
+ return self._name
+
+ @property
+ def type(self):
+ """
+ Return the FieldDeclaration's type. One of the entries in class
+ CTFTypeId.
+ """
+ return _bt_ctf_field_type(self._fd)
+
+ @property
+ def scope(self):
+ """
+ Return the FieldDeclaration's scope.
+ """
+ return self._s
+
+class IntegerFieldDeclaration(FieldDeclaration):
+ """Do not instantiate."""
+ def __init__(self):
+ raise NotImplementedError("IntegerFieldDeclaration cannot be instantiated")
+
+ @property
+ def signedness(self):
+ """
+ Return the signedness of an integer:
+ 0 if unsigned; 1 if signed; -1 on error.
+ """
+ return _bt_ctf_get_int_signedness(self._fd)
+
+ @property
+ def base(self):
+ """Return the base of an int or a negative value on error."""
+ return _bt_ctf_get_int_base(self._fd)
+
+ @property
+ def byte_order(self):
+ """
+ Return the byte order. One of class ByteOrder's entries.
+ """
+ ret = _bt_ctf_get_int_byte_order(self._fd)
+ if ret == 1234:
+ return ByteOrder.BYTE_ORDER_LITTLE_ENDIAN
+ elif ret == 4321:
+ return ByteOrder.BYTE_ORDER_BIG_ENDIAN
+ else:
+ return ByteOrder.BYTE_ORDER_UNKNOWN
+
+ @property
+ def length(self):
+ """
+ Return the size, in bits, of an int or a negative
+ value on error.
+ """
+ return _bt_ctf_get_int_len(self._fd)