StudyPlanner/src/planner.h

61 lines
1.1 KiB
C
Raw Normal View History

#ifndef PLANNER
#define PLANNER
#include <stdint.h>
#include <time.h>
/*
* task subject struct used to track different tasks
* create new task with taskNew(name, time_t created, time_t deadline, int
* priority, uint64_t spare)
*
* should be freed by user
*
* used to interface with human and store data
*/
typedef struct Task {
char *name;
time_t created;
time_t deadline;
int priority;
uint64_t spare;
} Task;
/*
* allocates and returns Task (free after use)
* returns NULL on failure
*/
Task *newTask(char *n, time_t c, time_t d, int p, uint64_t sp);
2024-12-11 03:51:32 +01:00
/*
* compare function for Task
*/
int cmpTask(Task *a, Task *b);
/*
* Event struct contains task and planned time frame
*
* used to create timetable
*
* eventNew(task, start, end, spare)
*
*/
typedef struct Event {
Task *task;
time_t plannedStartTime;
time_t plannedEndTime;
uint64_t spare; // spare var
} Event;
/*
* allocates and returns Event (free after use)
* returns NULL on failure
*/
Event *newEvent(Task *t, time_t s, time_t e, uint64_t sp);
2024-12-11 03:51:32 +01:00
/*
* compare function for Event
*/
int cmpEvent(Event *a, Event *b);
int genPlan(Task *head);
#endif // !PLANNER