annotate LinkedList.h @ 13:54aa96ae8912

Added LinkedList class to project. ALmixer now saves ALmixer_Data instances in a private linked list so when Quit is called, this memory can be cleaned up. This is meant to deal with two problems. First, SDL_sound does something similar which means since I wrap SDL_sound structures, I may be left with dangling pointers if. Second is the obvious auto-cleanup when quiting which is convenient for resetting.
author Eric Wing <ewing . public |-at-| gmail . com>
date Sat, 06 Nov 2010 00:37:29 -0700
parents
children 1c27a52c5b15
rev   line source
13
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
1 #ifndef C_LINKED_LIST_H
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
2 #define C_LINKED_LIST_H
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
3
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
4 /* Set up for C function definitions, even when using C++ */
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
5 #ifdef __cplusplus
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
6 extern "C" {
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
7 #endif
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
8
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
9 #include <stddef.h>
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
10
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
11 typedef struct LinkedListNode LinkedListNode;
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
12 typedef struct LinkedList LinkedList;
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
13
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
14 LinkedList* LinkedList_Create();
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
15
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
16 void LinkedList_Free(LinkedList* linked_list);
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
17
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
18 void* LinkedList_Front(LinkedList* linked_list);
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
19 void* LinkedList_Back(LinkedList* linked_list);
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
20
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
21 unsigned int LinkedList_PushFront(LinkedList* linked_list, void* new_item);
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
22
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
23 unsigned int LinkedList_PushBack(LinkedList* linked_list, void* new_item);
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
24
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
25 void* LinkedList_PopFront(LinkedList* linked_list);
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
26
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
27 void* LinkedList_PopBack(LinkedList* linked_list);
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
28
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
29 size_t LinkedList_Size(LinkedList* linked_list);
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
30
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
31 void LinkedList_Clear(LinkedList* linked_list);
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
32
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
33 void* LinkedListNode_GetData(LinkedListNode* list_node);
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
34
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
35 LinkedListNode* LinkedList_Find(LinkedList* linked_list, void* the_data, LinkedListNode* start_node);
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
36
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
37 unsigned int LinkedList_Remove(LinkedList* linked_list, LinkedListNode* list_node);
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
38
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
39 /* Ends C function definitions when using C++ */
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
40 #ifdef __cplusplus
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
41 }
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
42 #endif
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
43
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
44 #endif /* C_LINKED_LIST_H */
54aa96ae8912 Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
45