libIEC61850  1.1.2
Open-source IEC 61850 MMS/GOOSE/SV server and client library
linked_list.h
Go to the documentation of this file.
1 /*
2  * linked_list.h
3  *
4  * Copyright 2013 Michael Zillgith
5  *
6  * This file is part of libIEC61850.
7  *
8  * libIEC61850 is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * libIEC61850 is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with libIEC61850. If not, see <http://www.gnu.org/licenses/>.
20  *
21  * See COPYING file for the complete license text.
22  */
23 
24 #ifndef LINKED_LIST_H_
25 #define LINKED_LIST_H_
26 
27 #include "libiec61850_common_api.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
44 struct sLinkedList {
45  void* data;
46  struct sLinkedList* next;
47 };
48 
52 typedef struct sLinkedList* LinkedList;
53 
59 LinkedList
60 LinkedList_create(void);
61 
71 void
72 LinkedList_destroy(LinkedList self);
73 
74 
75 typedef void (*LinkedListValueDeleteFunction) (void*);
76 
88 void
89 LinkedList_destroyDeep(LinkedList self, LinkedListValueDeleteFunction valueDeleteFunction);
90 
99 void
100 LinkedList_destroyStatic(LinkedList self);
101 
111 void
112 LinkedList_add(LinkedList self, void* data);
113 
120 bool
121 LinkedList_remove(LinkedList self, void* data);
122 
129 LinkedList
130 LinkedList_get(LinkedList self, int index);
131 
137 LinkedList
138 LinkedList_getNext(LinkedList self);
139 
145 LinkedList
146 LinkedList_getLastElement(LinkedList self);
147 
153 LinkedList
154 LinkedList_insertAfter(LinkedList listElement, void* data);
155 
163 int
164 LinkedList_size(LinkedList self);
165 
166 void*
167 LinkedList_getData(LinkedList self);
168 
169 void
170 LinkedList_printStringList(LinkedList self);
171 
176 #ifdef __cplusplus
177 }
178 #endif
179 
180 #endif /* LINKED_LIST_H_ */
LinkedList LinkedList_get(LinkedList self, int index)
Get the list element specified by index (starting with 0).
void * data
Definition: linked_list.h:45
Reference to a linked list or to a linked list element.
Definition: linked_list.h:44
LinkedList LinkedList_create(void)
Create a new LinkedList object.
LinkedList LinkedList_insertAfter(LinkedList listElement, void *data)
Insert a new element int the list.
struct sLinkedList * next
Definition: linked_list.h:46
void LinkedList_destroy(LinkedList self)
Delete a LinkedList object.
void * LinkedList_getData(LinkedList self)
bool LinkedList_remove(LinkedList self, void *data)
Removed the specified element from the list.
LinkedList LinkedList_getLastElement(LinkedList self)
Get the last element in the list.
void LinkedList_destroyStatic(LinkedList self)
Delete a LinkedList object without freeing the element data.
void LinkedList_printStringList(LinkedList self)
void LinkedList_destroyDeep(LinkedList self, LinkedListValueDeleteFunction valueDeleteFunction)
Delete a LinkedList object.
void LinkedList_add(LinkedList self, void *data)
Add a new element to the list.
LinkedList LinkedList_getNext(LinkedList self)
Get the next element in the list (iterator).
int LinkedList_size(LinkedList self)
Get the size of the list.
void(* LinkedListValueDeleteFunction)(void *)
Definition: linked_list.h:75