-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb.h
More file actions
54 lines (44 loc) · 1.1 KB
/
db.h
File metadata and controls
54 lines (44 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef _DB_H
#define _DB_H
#include "student.h"
/**
* Database structure type.
*/
typedef struct {
student_t *data; /** The list of students **/
size_t lsize; /** The logical size of the list **/
size_t psize; /** The physical size of the list **/
} database_t;
/**
* Add a student to the database.
* TODO: implement this function.
**/
void db_add(database_t *db, student_t s);
/**
* Delete a student from the database.
* TODO: implement this function.
**/
void db_delete(database_t *db, student_t *s);
/**
* Save the content of a database_t to the specified file.
* TODO: implement this function
**/
void db_save(database_t *db, const char *path);
/**
* Load the content of a database of students from a file.
* TODO: implement this function.
**/
void db_load(database_t *db, const char *path);
/**
* Initialise a database_t structure.
* Typical use:
* ```
* database_t db;
* db_init(&db);
* ```
* TODO: implement this function.
**/
void db_init(database_t *db);
void db_update(database_t *db, student_t *old, student_t *updated);
void db_empty(database_t *db);
#endif