/
parent_group.h
55 lines (38 loc) · 1.22 KB
/
parent_group.h
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
55
//================
// parent_group.h
//================
// Shared functions for block_map and offset_index.
// Copyright 2024, Sven Bieg (svenbieg@web.de)
// http://github.com/svenbieg/Heap
#ifndef _PARENT_GROUP_H
#define _PARENT_GROUP_H
//=======
// Using
//=======
#include <heap.h>
#include "cluster_group.h"
//==============
// Parent-Group
//==============
typedef struct
{
cluster_group_t header;
size_t item_count;
size_t first;
size_t last;
cluster_group_t* children[CLUSTER_GROUP_SIZE];
}parent_group_t;
//========
// Access
//========
uint16_t parent_group_get_group(parent_group_t* group, size_t* at);
int16_t parent_group_get_nearest_space(parent_group_t* group, int16_t pos);
//==============
// Modification
//==============
void parent_group_append_groups(parent_group_t* group, cluster_group_t* const* append, uint16_t count);
void parent_group_cleanup(heap_handle_t heap, parent_group_t* group);
void parent_group_insert_groups(parent_group_t* group, uint16_t at, cluster_group_t* const* insert, uint16_t count);
void parent_group_remove_group(heap_handle_t heap, parent_group_t* group, uint16_t at);
void parent_group_remove_groups(parent_group_t* group, uint16_t at, uint16_t count);
#endif // _PARENT_GROUP_H