## SwamiControlEvent SwamiControlEvent |

## Synopsis

                        SwamiControlEvent;
    #define             SWAMI_TYPE_CONTROL_EVENT
    #define             SWAMI_CONTROL_EVENT_VALUE           (event)
    GType               swami_control_event_get_type        (void);
    SwamiControlEvent * swami_control_event_new             (gboolean stamp);
    void                swami_control_event_free            (SwamiControlEvent *event);
    SwamiControlEvent * swami_control_event_duplicate       (const SwamiControlEvent *event);
    SwamiControlEvent * swami_control_event_transform       (SwamiControlEvent *event,
                                                             GType valtype,
                                                             SwamiValueTransform trans,
                                                             gpointer data);
    void                swami_control_event_stamp           (SwamiControlEvent *event);
    void                swami_control_event_set_origin      (SwamiControlEvent *event,
                                                             SwamiControlEvent *origin);
    SwamiControlEvent * swami_control_event_ref             (SwamiControlEvent *event);
    void                swami_control_event_unref           (SwamiControlEvent *event);
    void                swami_control_event_active_ref      (SwamiControlEvent *event);
    void                swami_control_event_active_unref    (SwamiControlEvent *event);

## Description

## Details

### SwamiControlEvent

    typedef struct {
      struct timeval tick;		/* tick time */
      SwamiControlEvent *origin;	/* origin event or %NULL if is origin */
      GValue value;			/* value for this event */
      int active;			/* active propagation count */
      int refcount;			/* reference count */
    } SwamiControlEvent;

### SWAMI_TYPE_CONTROL_EVENT

    #define SWAMI_TYPE_CONTROL_EVENT (swami_control_event_get_type ())

### SWAMI_CONTROL_EVENT_VALUE()

    #define SWAMI_CONTROL_EVENT_VALUE(event) (&((event)->value))

### swami_control_event_get_type ()

    GType               swami_control_event_get_type        (void);

### swami_control_event_new ()

    SwamiControlEvent * swami_control_event_new             (gboolean stamp);

Create a new control event structure.

`stamp` : | `TRUE` to time stamp the new event (can be done later with `swami_control_event_stamp()`.
Returns : | New control event with a refcount of 1 which the caller owns. Keep in mind that a SwamiControlEvent is not a GObject, so it does its own refcounting with `swami_control_event_ref()` and `swami_control_event_unref()`.

### swami_control_event_free ()

    void                swami_control_event_free            (SwamiControlEvent *event);

Frees a Swami control event structure. Normally this function should not be used, `swami_control_event_unref()` should be used instead to allow for multiple users of a SwamiControlEvent. Calling this function bypasses reference counting, so make sure you know what you are doing if you use this.

`event` : | Swami control event structure to free

### swami_control_event_duplicate ()

    SwamiControlEvent * swami_control_event_duplicate       (const SwamiControlEvent *event);

Duplicate a control event. The refcount and active count are not duplicated, but the tick, origin and value are.

`event` : | Swami control event structure
Returns : | New duplicate control event

### swami_control_event_transform ()

    SwamiControlEvent * swami_control_event_transform       (SwamiControlEvent *event,
                                                             GType valtype,
                                                             SwamiValueTransform trans,
                                                             gpointer data);

Like `swami_control_event_duplicate()` but transforms the event's value using the `trans` function to the type indicated by `valtype`.

`event` : | Swami control event structure
`valtype` : | The type for the new value (or 0 to use the `event` value type)
`trans` : | Value transform function
`data` : | User data passed to transform function
Returns : | New transformed control event (caller owns creator's reference)

### swami_control_event_stamp ()

    void                swami_control_event_stamp           (SwamiControlEvent *event);

Stamps an event with the current tick count.

`event` : | Event to stamp

### swami_control_event_set_origin ()

    void                swami_control_event_set_origin      (SwamiControlEvent *event,
                                                             SwamiControlEvent *origin);

Set the origin of an event. Should only be set once since its not multi-thread locked.

`event` : | Event structure
`origin` : | Origin event or `NULL` if `event` is its own origin

### swami_control_event_ref ()

    SwamiControlEvent * swami_control_event_ref             (SwamiControlEvent *event);

Increment the reference count of an event.

`event` : | Event structure
Returns : | The same referenced `event` as a convenience.

### swami_control_event_unref ()

    void                swami_control_event_unref           (SwamiControlEvent *event);

Decrement the reference count of an event. If the reference count reaches 0 the event will be freed.

`event` : | Event structure

### swami_control_event_active_ref ()

    void                swami_control_event_active_ref      (SwamiControlEvent *event);

Increment the active propagation reference count.

`event` : | Event structure

### swami_control_event_active_unref ()

    void                swami_control_event_active_unref    (SwamiControlEvent *event);

Decrement the active propagation reference count.

`event` : | Event object