X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bindings%2Fpython%2Fwriter.py;h=d862cd82a4f809c173800379410b4ae9cc9c15cd;hb=4ac159aa28ef36821c55290056fcab6254bb8d41;hp=62ee2fba3405556fbee31471b645cdb43f4070c6;hpb=cf3687b5fb60ad6d20404b3744ac47bb5dce9203;p=babeltrace.git diff --git a/bindings/python/writer.py b/bindings/python/writer.py index 62ee2fba..d862cd82 100644 --- a/bindings/python/writer.py +++ b/bindings/python/writer.py @@ -1324,9 +1324,16 @@ class FloatFieldingPoint(FloatingPointField): class StructureField(Field): + """ + Structure field, based on a + :class:`StructureFieldDeclaration` object. + """ + def field(self, field_name): """ - Get the structure's field corresponding to the provided field name. + Returns the structure :class:`Field` named *field_name*. + + :exc:`ValueError` is raised on error. """ native_instance = nbt._bt_ctf_field_structure_get_field(self._f, @@ -1339,9 +1346,17 @@ class StructureField(Field): class VariantField(Field): + """ + Variant field, based on a + :class:`VariantFieldDeclaration` object. + """ + def field(self, tag): """ - Return the variant's selected field. The "tag" field is the selector enum field. + Returns the :class:`Field` selected by the current label of + *tag* (:class:`EnumerationField`). + + :exc:`ValueError` is raised on error. """ native_instance = nbt._bt_ctf_field_variant_get_field(self._f, tag._f) @@ -1353,9 +1368,17 @@ class VariantField(Field): class ArrayField(Field): + """ + Static array field, based on an + :class:`ArrayFieldDeclaration` object. + """ + def field(self, index): """ - Return the array's field at position "index". + Returns the :class:`Field` at index *index* in this static + array. + + :exc:`IndexError` is raised on error. """ native_instance = nbt._bt_ctf_field_array_get_field(self._f, index) @@ -1367,10 +1390,20 @@ class ArrayField(Field): class SequenceField(Field): + """ + Sequence (dynamic array) field, based on a + :class:`SequenceFieldDeclaration` object. + """ + @property def length(self): """ - Get the sequence's length field (IntegerField). + Sequence length (:class:`IntegerField`). + + Set this attribute to change the sequence length's integer + field (integer must be unsigned). + + :exc:`ValueError` or :exc:`TypeError` are raised on error. """ native_instance = nbt._bt_ctf_field_sequence_get_length(self._f) @@ -1382,10 +1415,6 @@ class SequenceField(Field): @length.setter def length(self, length_field): - """ - Set the sequence's length field (IntegerField). - """ - if not isinstance(length_field, IntegerField): raise TypeError("Invalid length field.") @@ -1399,7 +1428,9 @@ class SequenceField(Field): def field(self, index): """ - Return the sequence's field at position "index". + Returns the :class:`Field` at index *index* in this sequence. + + :exc:`ValueError` is raised on error. """ native_instance = nbt._bt_ctf_field_sequence_get_field(self._f, index)