1 |
#ifndef __G3FLIST_H |
2 |
#define __G3FLIST_H |
3 |
|
4 |
#ifdef __cplusplus |
5 |
extern "C" { |
6 |
#endif |
7 |
|
8 |
#include <stdio.h> |
9 |
|
10 |
#include "g3vector.h" |
11 |
|
12 |
|
13 |
#define G3FL_STARTCAP 50 |
14 |
#define G3FL_ID(fl,id) (fl->comp_size*id) |
15 |
#define G3FL_GETID(fl,e) ((e-fl->list)/fl->comp_size) |
16 |
|
17 |
typedef struct g3FList { |
18 |
int size; |
19 |
int cap; |
20 |
int comp_size; |
21 |
int ipos; |
22 |
g3Float* list; |
23 |
} g3FList; |
24 |
|
25 |
#define g3fl_get_size(fl) (fl->size) |
26 |
#define g3fl_get_comp_size(fl) (fl->comp_size) |
27 |
|
28 |
int g3fl_init(g3FList* fl,int cs); |
29 |
g3FList* g3fl_create(int cs); |
30 |
void g3fl_free(g3FList* fl); |
31 |
|
32 |
int g3fl_copy(g3FList* dst,g3FList* src); |
33 |
|
34 |
void g3fl_clear(g3FList* fl); |
35 |
|
36 |
int g3fl_read(g3FList* fl,FILE* fp); |
37 |
g3Float* g3fl_append_new(g3FList* fl); |
38 |
int g3fl_append(g3FList* fl,g3Float* el); |
39 |
g3Float* g3fl_get(g3FList* fl,int id); |
40 |
g3Float* g3fl_get_copy(g3FList* fl,int id); |
41 |
int g3fl_remove(g3FList* fl,int id); |
42 |
int g3fl_remove_last(g3FList* fl); |
43 |
|
44 |
g3Float* g3fl_begin(g3FList* fl); |
45 |
g3Float* g3fl_next(g3FList* fl); |
46 |
void g3fl_rewind(g3FList* fl); |
47 |
|
48 |
int g3fl_sort(g3FList* fl,int cnum); |
49 |
|
50 |
|
51 |
|
52 |
|
53 |
#ifdef __cplusplus |
54 |
} |
55 |
#endif |
56 |
|
57 |
#endif |