2013-01-11 01:48:46 +08:00
|
|
|
#ifndef FOUG_C_TASK_CONTROL_H
|
|
|
|
#define FOUG_C_TASK_CONTROL_H
|
|
|
|
|
2013-01-16 00:56:24 +08:00
|
|
|
#include "global.h"
|
2013-01-11 01:48:46 +08:00
|
|
|
#include "memory.h"
|
|
|
|
|
2013-03-03 04:51:08 +08:00
|
|
|
/* foug_task_progress */
|
|
|
|
typedef struct foug_task_progress
|
2013-01-11 01:48:46 +08:00
|
|
|
{
|
2013-03-03 04:51:08 +08:00
|
|
|
foug_real32_t range_min;
|
|
|
|
foug_real32_t range_max;
|
|
|
|
foug_real32_t value;
|
|
|
|
} foug_task_progress_t;
|
2013-01-11 01:48:46 +08:00
|
|
|
|
|
|
|
/* Progress */
|
2013-03-03 04:51:08 +08:00
|
|
|
FOUG_LIB_EXPORT foug_real32_t foug_task_progress_get_value_pc(const foug_task_progress_t* progress);
|
2013-02-21 21:51:29 +08:00
|
|
|
|
2013-03-03 04:51:08 +08:00
|
|
|
/* foug_task_control */
|
|
|
|
typedef struct foug_task_control foug_task_control_t;
|
|
|
|
struct foug_task_control
|
|
|
|
{
|
|
|
|
foug_bool_t is_stop_requested;
|
|
|
|
void* cookie;
|
|
|
|
void (*handle_stop_func)(foug_task_control_t*);
|
|
|
|
void (*handle_progress_update_func)(foug_task_control_t*, const foug_task_progress_t*);
|
|
|
|
};
|
2013-02-21 21:51:29 +08:00
|
|
|
|
2013-03-03 04:51:08 +08:00
|
|
|
FOUG_LIB_EXPORT void foug_task_control_set_progress(foug_task_control_t* ctrl,
|
|
|
|
foug_task_progress_t* progress,
|
|
|
|
foug_real32_t value);
|
2013-01-11 01:48:46 +08:00
|
|
|
|
|
|
|
/* Task stop */
|
2013-01-15 23:45:01 +08:00
|
|
|
FOUG_LIB_EXPORT void foug_task_control_async_stop(foug_task_control_t* ctrl);
|
|
|
|
FOUG_LIB_EXPORT void foug_task_control_handle_stop(foug_task_control_t* ctrl);
|
2013-02-21 21:51:29 +08:00
|
|
|
|
2013-01-11 01:48:46 +08:00
|
|
|
#endif /* FOUG_C_TASK_CONTROL_H */
|