Ocarina no longer has a header file subdirectory so there is no reason to have a libsaria subdirectory anymore. Putting header files directly in the include/ directory is a bit simpler. Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
55 lines
920 B
C++
55 lines
920 B
C++
#ifndef LIBSARIA_IDLE_TASK_H
|
|
#define LIBSARIA_IDLE_TASK_H
|
|
|
|
#include <fs.h>
|
|
#include <cstddef>
|
|
|
|
class IdleTask
|
|
{
|
|
public:
|
|
IdleTask();
|
|
virtual ~IdleTask() = 0;
|
|
virtual void run_task() = 0;
|
|
virtual bool should_cancel(void *);
|
|
|
|
void queue();
|
|
void queue_front();
|
|
};
|
|
|
|
class IdleCallback : public IdleTask
|
|
{
|
|
private:
|
|
void (*func)();
|
|
public:
|
|
IdleCallback(void (*)());
|
|
~IdleCallback();
|
|
void run_task();
|
|
};
|
|
|
|
class WriteTask : public IdleTask
|
|
{
|
|
private:
|
|
string filepath;
|
|
void (*func)(ofstream &, void *);
|
|
DataState *state;
|
|
void *data;
|
|
public:
|
|
WriteTask(string, void (*)(ofstream &, void *), DataState *, void *);
|
|
~WriteTask();
|
|
bool should_cancel(void *);
|
|
void run_task();
|
|
};
|
|
|
|
class ReadTask : public IdleTask
|
|
{
|
|
private:
|
|
string filepath;
|
|
void (*func)(ifstream &);
|
|
public:
|
|
ReadTask(string, void (*)(ifstream &));
|
|
~ReadTask();
|
|
void run_task();
|
|
};
|
|
|
|
#endif /* LIBSARIA_IDLE_TASK_H */
|