-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.h
27 lines (23 loc) · 918 Bytes
/
list.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
#ifndef SHAREDMEMORY_LIST_H
#define SHAREDMEMORY_LIST_H
#include "bytebuffer.h"
#define CREATE_ARRAYLIST(size,type) AllocArrayList(size,NULL,sizeof(type))
#define DEFAULT_ARRAYLIST_SIZE 32
typedef void* Element;
typedef struct ArrayList{
Element Pointer;
int ElementSize;
int Position;
int Capacity;
UINT8 SelfAllocated;
Element(*Get)(struct ArrayList* list, int index);
void(*Set)(struct ArrayList* list, int index, Element element);
void(*Add)(struct ArrayList* list, Element element);
} ARRAYLIST,*PARRAYLIST;
PARRAYLIST AllocArrayList(int InitialSize, void* InitialData, int ElementSize);
Element ARRAYLIST_Get(PARRAYLIST list, int index);
void ARRAYLIST_Set(PARRAYLIST list, int index, Element element);
void ARRAYLIST_Add(PARRAYLIST list, Element element);
void ARRAYLIST_Reset(PARRAYLIST list, int capacity);
void FreeArrayList(PARRAYLIST list);
#endif //SHAREDMEMORY_LIST_H