idle: Add doxygen documentation.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
5f56118c04
commit
59ffd5cbdf
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/**
|
||||
* @file
|
||||
* Copyright 2013 (c) Anna Schumaker.
|
||||
*/
|
||||
#include <core/idle.h>
|
||||
|
|
|
@ -1,23 +1,47 @@
|
|||
/*
|
||||
/**
|
||||
* @file
|
||||
* Copyright 2013 (c) Anna Schumaker.
|
||||
*/
|
||||
#ifndef OCARINA_CORE_IDLE_H
|
||||
#define OCARINA_CORE_IDLE_H
|
||||
|
||||
/**
|
||||
* Namespace for controlling idle tasks.
|
||||
*/
|
||||
namespace idle
|
||||
{
|
||||
|
||||
/**
|
||||
* Base class for creating new IdleTasks.
|
||||
*/
|
||||
class IdleBase {
|
||||
protected:
|
||||
/**
|
||||
* Add the IdleBase to the idle queue.
|
||||
*/
|
||||
void schedule();
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor for the IdleBase class.
|
||||
*/
|
||||
IdleBase();
|
||||
|
||||
/**
|
||||
* IdleBase destructor.
|
||||
*/
|
||||
virtual ~IdleBase();
|
||||
|
||||
/**
|
||||
* Run the idle task.
|
||||
*/
|
||||
virtual void run() = 0;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Generic IdleTask class.
|
||||
*/
|
||||
template <class T>
|
||||
class IdleTask : public IdleBase {
|
||||
private:
|
||||
|
@ -25,19 +49,46 @@ namespace idle
|
|||
T data;
|
||||
|
||||
public:
|
||||
/**
|
||||
* IdleTask constructor.
|
||||
* @param func Function to call when running this task.
|
||||
* @param data Data to pass to the function.
|
||||
*/
|
||||
IdleTask(void (*)(T &), T);
|
||||
|
||||
/**
|
||||
* IdleTask destructor.
|
||||
*/
|
||||
~IdleTask();
|
||||
|
||||
/**
|
||||
* Run the IdleTask.
|
||||
*/
|
||||
void run();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Create a new IdleTask and add it to the queue.
|
||||
* @param func Function to call when running the new task.
|
||||
* @param data Data to pass to the function.
|
||||
*/
|
||||
template <class T>
|
||||
static inline void schedule(void (*func)(T &), T param)
|
||||
{
|
||||
new IdleTask<T>(func, param);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the next task on the idle queue.
|
||||
* @return True if there are still tracks on the queue, false otherwise.
|
||||
*/
|
||||
bool run_task();
|
||||
|
||||
/**
|
||||
* Call to find the progress of the idle queue.
|
||||
* @return A fraction representing the idle queue progress.
|
||||
*/
|
||||
float get_progress();
|
||||
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/**
|
||||
* @file
|
||||
* Copyright 2013 (c) Anna Schumaker.
|
||||
*
|
||||
* DO NOT INCLUDE THIS FILE DIRECTLY. THIS IS A TEMPLATE DEFINITION FILE
|
||||
|
|
Loading…
Reference in New Issue