Python: document writer.Event
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 10 Dec 2014 18:25:07 +0000 (13:25 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 17 Feb 2015 21:13:50 +0000 (16:13 -0500)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
bindings/python/writer.py

index 85494bd799cab76fb9a92d6a7399a55c2dd8ddf1..567d9266f8d4b356b6e522c5578b5734c09b0cc2 100644 (file)
@@ -1622,9 +1622,18 @@ class EventClass:
 
 
 class Event:
+    """
+    Events are specific instances of event classes
+    (:class:`EventClass`), which means they may contain actual,
+    concrete field values.
+    """
+
     def __init__(self, event_class):
         """
-        Create a new event of the given event class.
+        Creates an event linked with the :class:`EventClass`
+        *event_class*.
+
+        :exc:`ValueError` is raised on error.
         """
 
         if not isinstance(event_class, EventClass):
@@ -1641,7 +1650,7 @@ class Event:
     @property
     def event_class(self):
         """
-        Get the event's class.
+        :class:`EventClass` object to which this event is linked.
         """
 
         event_class_native = nbt._bt_ctf_event_get_class(self._e)
@@ -1656,8 +1665,8 @@ class Event:
 
     def clock(self):
         """
-        Get a clock from event. Returns None if the event's class
-        is not registered to a stream class.
+        :class:`Clock` object used by this object, or ``None`` if
+        the event class is not registered to a stream class.
         """
 
         clock_instance = nbt._bt_ctf_event_get_clock(self._e)
@@ -1672,7 +1681,24 @@ class Event:
 
     def payload(self, field_name):
         """
-        Get a field from event.
+        Returns the :class:`Field` object named *field_name* in this
+        event.
+
+        The returned field object is created using the event class'
+        field declaration named *field_name*.
+
+        The return type is one of:
+
+        * :class:`IntegerField`
+        * :class:`FloatingPointField`
+        * :class:`EnumerationField`
+        * :class:`StringField`
+        * :class:`ArrayField`
+        * :class:`SequenceField`
+        * :class:`StructureField`
+        * :class:`VariantField`
+
+        :exc:`TypeError` is raised on error.
         """
 
         native_instance = nbt._bt_ctf_event_get_payload(self._e,
@@ -1685,7 +1711,21 @@ class Event:
 
     def set_payload(self, field_name, value_field):
         """
-        Set a manually created field as an event's payload.
+        Set the event's field named *field_name* to the manually
+        created :class:`Field` object *value_field*.
+
+        *value_field*'s type must be one of:
+
+        * :class:`IntegerField`
+        * :class:`FloatingPointField`
+        * :class:`EnumerationField`
+        * :class:`StringField`
+        * :class:`ArrayField`
+        * :class:`SequenceField`
+        * :class:`StructureField`
+        * :class:`VariantField`
+
+        :exc:`ValueError` is raised on error.
         """
 
         if not isinstance(value, Field):
This page took 0.02557 seconds and 4 git commands to generate.