## UfoTaskIface

UfoTaskIface — Base interface of all tasks

## Functions

gboolean | (*UfoTaskProcessFunc) ()
gboolean | (*UfoTaskGenerateFunc) ()
void | ufo_task_setup ()
guint | ufo_task_get_num_inputs ()
guint | ufo_task_get_num_dimensions ()
UfoTaskMode | ufo_task_get_mode ()
void | ufo_task_get_requisition ()
void | ufo_task_set_json_object_property ()
gboolean | ufo_task_process ()
gboolean | ufo_task_generate ()
void | ufo_task_inputs_stopped_callback ()
gboolean | ufo_task_uses_gpu ()
gboolean | ufo_task_uses_cpu ()
GQuark | ufo_task_error_quark ()

## Signals

void | generated | No Recursion
void | inputs-stopped | No Recursion
void | processed | No Recursion

## Types and Values

#define | UFO_TASK_ERROR
enum | UfoTaskError
enum | UfoTaskMode

## Object Hierarchy

        GInterface
        ╰── UfoTask

## Description

Interface that defines the behaviour of all tasks. Each scheduler uses the same policy to run a task: First, `ufo_task_setup()`, `ufo_task_get_num_inputs()` and `ufo_task_get_num_dimensions()` is called for each tasks. Then in each iteration the task is asked about its size requirements using `ufo_task_get_requisition()` and then executed using `ufo_task_process()` and/or `ufo_task_generate()`.

## Functions

### UfoTaskProcessFunc ()

    gboolean
    (*UfoTaskProcessFunc) (UfoTask *task,
                           UfoBuffer **inputs,
                           UfoBuffer *output,
                           UfoRequisition *requisition);

### UfoTaskGenerateFunc ()

    gboolean
    (*UfoTaskGenerateFunc) (UfoTask *task,
                            UfoBuffer *output,
                            UfoRequisition *requisition);

### ufo_task_setup ()

    void
    ufo_task_setup (UfoTask *task,
                    UfoResources *resources,
                    GError **error);

### ufo_task_get_num_inputs ()

    guint
    ufo_task_get_num_inputs (UfoTask *task);

### ufo_task_get_num_dimensions ()

    guint
    ufo_task_get_num_dimensions (UfoTask *task,
                                 guint input);

### ufo_task_get_mode ()

    UfoTaskMode
    ufo_task_get_mode (UfoTask *task);

### ufo_task_get_requisition ()

    void
    ufo_task_get_requisition (UfoTask *task,
                              UfoBuffer **inputs,
                              UfoRequisition *requisition,
                              GError **error);

### ufo_task_set_json_object_property ()

    void
    ufo_task_set_json_object_property (UfoTask *task,
                                       const gchar *prop_name,
                                       JsonObject *object);

### ufo_task_process ()

    gboolean
    ufo_task_process (UfoTask *task,
                      UfoBuffer **inputs,
                      UfoBuffer *output,
                      UfoRequisition *requisition);

### ufo_task_generate ()

    gboolean
    ufo_task_generate (UfoTask *task,
                       UfoBuffer *output,
                       UfoRequisition *requisition);

### ufo_task_inputs_stopped_callback ()

    void
    ufo_task_inputs_stopped_callback (UfoTask *task);

### ufo_task_uses_gpu ()

    gboolean
    ufo_task_uses_gpu (UfoTask *task);

### ufo_task_uses_cpu ()

    gboolean
    ufo_task_uses_cpu (UfoTask *task);

### ufo_task_error_quark ()

    GQuark
    ufo_task_error_quark (void);

## Types and Values

### UFO_TASK_ERROR

    #define UFO_TASK_ERROR            ufo_task_error_quark()

### enum UfoTaskError

#### Members

UFO_TASK_ERROR_SETUP | Error during setup of a task. |
UFO_TASK_ERROR_GET_REQUISITION | Error while trying to get the size of a |
UFO_TASK_ERROR_COPY | Error during copying of a task. buffer. |

### enum UfoTaskMode

Task modes describe how a task operates considering the input data.

#### Members

UFO_TASK_MODE_INVALID | invalid |
UFO_TASK_MODE_PROCESSOR | one-by-one processing |
UFO_TASK_MODE_GENERATOR | do not receive any data but produce a stream. |
UFO_TASK_MODE_REDUCTOR | receive fininite stream and generate a reduced stream |
UFO_TASK_MODE_SINK | receives data but does not produce any, |
UFO_TASK_MODE_CPU | runs on CPU |
UFO_TASK_MODE_GPU | runs on GPU |
UFO_TASK_MODE_SHARE_DATA | sibling tasks share the same input data |
UFO_TASK_MODE_TYPE_MASK | mask to get type from UfoTaskMode |
UFO_TASK_MODE_PROCESSOR_MASK | mask to get processor from UfoTaskMode |

## Signal Details

### The `“generated”` signal

    void
    user_function (UfoTask *ufotask,
                   gpointer user_data)

Flags: No Recursion

### The `“inputs-stopped”` signal

    void
    user_function (UfoTask *ufotask,
                   gpointer user_data)

Flags: No Recursion

### The `“processed”` signal

    void
    user_function (UfoTask *ufotask,
                   gpointer user_data)

Flags: No Recursion