#ifndef __JobList__H
#define __JobList__H

#include "WimpLib:std.h"
#include <stdbool.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef enum
{ EJobAction_Continue // Continue the job on the next NULL Event.
, EJobAction_Stop     // Stop this job and remove it from the job list.
} EJobAction;

typedef struct JobList JobList;

typedef EJobAction (*Job_Exec)(void* pOwner, EJobAction action, void* pParams);

JobList* New_JobList(void) throws(mem);
void Delete_JobList(JobList*);
int JobList_Count(const JobList*);

void JobList_Add(JobList*, bool bReplace, void* pOwner, void* pParams, Job_Exec fn) throws(mem);
void JobList_Remove(JobList*, void* pOwner, void* pParams, Job_Exec fn);
void JobList_RemoveAll(JobList*, void* pOwner);

bool JobList_HasJobs(const JobList* This, const void* pOwner);

bool JobList_Exec(JobList*);

#ifdef __cplusplus
}
#endif

#endif
