ocarina/include/task.h
Bryan Schumaker 258875bdb8 libsaria: Move header files out of include/libsaria/
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>
2012-09-12 08:15:31 -04:00

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 */