Beispiel #1
0
    def type(self):
        """
        Field type (one of :class:`babeltrace.common.CTFTypeId`
        constants).
        """

        return nbt._bt_ctf_field_type(self._fd)
Beispiel #2
0
    def type(self):
        """
        Field type (one of :class:`babeltrace.common.CTFTypeId`
        constants).
        """

        return nbt._bt_ctf_field_type(self._fd)
Beispiel #3
0
def _create_field_declaration(declaration_ptr, name, scope):
    """
    Private field declaration factory.
    """

    if declaration_ptr is None:
        raise ValueError("declaration_ptr must be valid")
    if scope not in _scopes:
        raise ValueError("Invalid scope provided")

    type = nbt._bt_ctf_field_type(declaration_ptr)
    declaration = None

    if type == common.CTFTypeId.INTEGER:
        declaration = IntegerFieldDeclaration.__new__(IntegerFieldDeclaration)
    elif type == common.CTFTypeId.ENUM:
        declaration = EnumerationFieldDeclaration.__new__(
            EnumerationFieldDeclaration)
    elif type == common.CTFTypeId.ARRAY:
        declaration = ArrayFieldDeclaration.__new__(ArrayFieldDeclaration)
    elif type == common.CTFTypeId.SEQUENCE:
        declaration = SequenceFieldDeclaration.__new__(
            SequenceFieldDeclaration)
    elif type == common.CTFTypeId.FLOAT:
        declaration = FloatFieldDeclaration.__new__(FloatFieldDeclaration)
    elif type == common.CTFTypeId.STRUCT:
        declaration = StructureFieldDeclaration.__new__(
            StructureFieldDeclaration)
    elif type == common.CTFTypeId.STRING:
        declaration = StringFieldDeclaration.__new__(StringFieldDeclaration)
    elif type == common.CTFTypeId.VARIANT:
        declaration = VariantFieldDeclaration.__new__(VariantFieldDeclaration)
    else:
        return declaration

    declaration._fd = declaration_ptr
    declaration._s = scope
    declaration._name = name

    return declaration
Beispiel #4
0
def _create_field_declaration(declaration_ptr, name, scope):
    """
    Private field declaration factory.
    """

    if declaration_ptr is None:
        raise ValueError("declaration_ptr must be valid")
    if scope not in _scopes:
        raise ValueError("Invalid scope provided")

    type = nbt._bt_ctf_field_type(declaration_ptr)
    declaration = None

    if type == common.CTFTypeId.INTEGER:
        declaration = IntegerFieldDeclaration.__new__(IntegerFieldDeclaration)
    elif type == common.CTFTypeId.ENUM:
        declaration = EnumerationFieldDeclaration.__new__(EnumerationFieldDeclaration)
    elif type == common.CTFTypeId.ARRAY:
        declaration = ArrayFieldDeclaration.__new__(ArrayFieldDeclaration)
    elif type == common.CTFTypeId.SEQUENCE:
        declaration = SequenceFieldDeclaration.__new__(SequenceFieldDeclaration)
    elif type == common.CTFTypeId.FLOAT:
        declaration = FloatFieldDeclaration.__new__(FloatFieldDeclaration)
    elif type == common.CTFTypeId.STRUCT:
        declaration = StructureFieldDeclaration.__new__(StructureFieldDeclaration)
    elif type == common.CTFTypeId.STRING:
        declaration = StringFieldDeclaration.__new__(StringFieldDeclaration)
    elif type == common.CTFTypeId.VARIANT:
        declaration = VariantFieldDeclaration.__new__(VariantFieldDeclaration)
    else:
        return declaration

    declaration._fd = declaration_ptr
    declaration._s = scope
    declaration._name = name

    return declaration
Beispiel #5
0
    def type(self):
        """Return the type of a field or -1 if unknown."""

        return nbt._bt_ctf_field_type(nbt._bt_ctf_get_decl_from_def(self._d))
Beispiel #6
0
    def type(self):
        """Return the type of a field or -1 if unknown."""

        return nbt._bt_ctf_field_type(nbt._bt_ctf_get_decl_from_def(self._d))