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"
|
|
|
|
|
|
|
|
/* foug_task_control : opaque structure */
|
|
|
|
typedef struct _internal_foug_task_control foug_task_control_t;
|
|
|
|
|
|
|
|
/* foug_task_control_manip */
|
|
|
|
typedef void (*foug_task_control_handle_stop_func)(foug_task_control_t*);
|
|
|
|
typedef void (*foug_task_control_handle_progress_update_func)(foug_task_control_t*);
|
2013-01-15 02:30:42 +08:00
|
|
|
typedef struct
|
2013-01-11 01:48:46 +08:00
|
|
|
{
|
|
|
|
foug_task_control_handle_stop_func handle_stop_func;
|
|
|
|
foug_task_control_handle_progress_update_func handle_progress_update_func;
|
|
|
|
} foug_task_control_manip_t;
|
|
|
|
|
2013-01-15 23:45:01 +08:00
|
|
|
FOUG_LIB_EXPORT void foug_task_control_manip_init(foug_task_control_manip_t* manip);
|
2013-01-11 01:48:46 +08:00
|
|
|
|
2013-01-15 23:45:01 +08:00
|
|
|
FOUG_LIB_EXPORT foug_task_control_t* foug_task_control_create(foug_malloc_func_t func,
|
|
|
|
void* data,
|
|
|
|
foug_task_control_manip_t manip);
|
2013-01-11 01:48:46 +08:00
|
|
|
|
|
|
|
/* Range */
|
2013-01-15 23:45:01 +08:00
|
|
|
FOUG_LIB_EXPORT foug_real32_t foug_task_control_get_range_min(const foug_task_control_t* ctrl);
|
|
|
|
FOUG_LIB_EXPORT foug_real32_t foug_task_control_get_range_max(const foug_task_control_t* ctrl);
|
|
|
|
FOUG_LIB_EXPORT void foug_task_control_set_range(foug_task_control_t* ctrl,
|
|
|
|
foug_real32_t min, foug_real32_t max);
|
2013-01-11 01:48:46 +08:00
|
|
|
|
|
|
|
/* Step id */
|
2013-01-15 23:45:01 +08:00
|
|
|
FOUG_LIB_EXPORT int32_t foug_task_control_get_step_id(const foug_task_control_t* ctrl);
|
|
|
|
FOUG_LIB_EXPORT void foug_task_control_set_step_id(foug_task_control_t* ctrl, int32_t step_id);
|
2013-01-11 01:48:46 +08:00
|
|
|
|
|
|
|
/* Progress */
|
2013-01-15 23:45:01 +08:00
|
|
|
FOUG_LIB_EXPORT foug_real32_t foug_task_control_get_progress_as_pc(const foug_task_control_t* ctrl);
|
|
|
|
FOUG_LIB_EXPORT foug_real32_t foug_task_control_get_progress(const foug_task_control_t* ctrl);
|
|
|
|
FOUG_LIB_EXPORT void foug_task_control_set_progress(foug_task_control_t* ctrl, foug_real32_t v);
|
2013-01-11 01:48:46 +08:00
|
|
|
|
2013-01-15 23:45:01 +08:00
|
|
|
FOUG_LIB_EXPORT
|
2013-01-15 02:30:42 +08:00
|
|
|
foug_real32_t foug_task_control_get_progress_update_threshold(const foug_task_control_t* ctrl);
|
2013-01-15 23:45:01 +08:00
|
|
|
FOUG_LIB_EXPORT void foug_task_control_set_progress_update_threshold(foug_task_control_t* ctrl,
|
|
|
|
foug_real32_t v);
|
2013-01-11 01:48:46 +08:00
|
|
|
|
|
|
|
/* Reset */
|
2013-01-15 23:45:01 +08:00
|
|
|
FOUG_LIB_EXPORT void foug_task_control_reset(foug_task_control_t* ctrl);
|
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);
|
|
|
|
FOUG_LIB_EXPORT foug_bool_t foug_task_control_is_stop_requested(const foug_task_control_t* ctrl);
|
2013-01-11 01:48:46 +08:00
|
|
|
|
|
|
|
/* Cookie */
|
2013-01-15 23:45:01 +08:00
|
|
|
FOUG_LIB_EXPORT void* foug_task_control_get_cookie(const foug_task_control_t* ctrl);
|
2013-02-05 19:24:13 +08:00
|
|
|
FOUG_LIB_EXPORT void foug_task_control_set_cookie(foug_task_control_t* ctrl, void* data);
|
2013-01-11 01:48:46 +08:00
|
|
|
|
|
|
|
#endif /* FOUG_C_TASK_CONTROL_H */
|