forked from KaisenAmin/c_std
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tuple.h
46 lines (36 loc) · 1.11 KB
/
tuple.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
/**
* @author Amin Tahmasebi
* @date 2024
* @class Tuple
*/
#ifndef TUPLE_H_
#define TUPLE_H_
#define TUPLE_LOGGING_ENABLE
#include <stdbool.h>
#include <stddef.h>
#include <stdarg.h>
typedef struct {
void* data;
size_t size;
} TupleElement;
typedef struct {
TupleElement* elements;
size_t size;
} Tuple;
Tuple* tuple_create(size_t size);
Tuple* tuple_make_tuple(size_t num, ...);
Tuple* tuple_tie(size_t num, ...);
Tuple* tuple_forward_as_tuple(size_t num, ...);
void tuple_deallocate(Tuple* tuple);
void tuple_swap(Tuple* a, Tuple* b);
bool tuple_set(Tuple* tuple, size_t index, void* data, size_t size);
bool tuple_is_equal(const Tuple* t1, const Tuple* t2);
bool tuple_is_less(const Tuple* t1, const Tuple* t2);
bool tuple_is_greater(const Tuple* t1, const Tuple* t2);
bool tuple_is_not_equal(const Tuple* t1, const Tuple* t2);
bool tuple_is_greater_or_equal(const Tuple* t1, const Tuple* t2);
bool tuple_is_less_or_equal(const Tuple* t1, const Tuple* t2);
bool tuple_is_empty(Tuple* t);
void* tuple_get(const Tuple* tuple, size_t index, size_t* outSize);
size_t tuple_size(const Tuple* tuple);
#endif