Add License to VES library
[demo.git] / vnfs / VES / code / evel_library / double_list.h
1 #ifndef DOUBLE_LIST_INCLUDED
2 #define DOUBLE_LIST_INCLUDED
3
4 /**************************************************************************//**
5  * @file
6  * A simple double-linked list.
7  *
8  * @note  No thread protection so you will need to use appropriate
9  * synchronization if use spans multiple threads.
10  *
11  * License
12  * -------
13  *
14  * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
15  *
16  * Licensed under the Apache License, Version 2.0 (the "License");
17  * you may not use this file except in compliance with the License.
18  * You may obtain a copy of the License at
19  *        http://www.apache.org/licenses/LICENSE-2.0
20  *
21  * Unless required by applicable law or agreed to in writing, software
22  * distributed under the License is distributed on an "AS IS" BASIS,
23  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24  * See the License for the specific language governing permissions and
25  * limitations under the License.
26  *
27  ****************************************************************************/
28
29 typedef struct dlist_item
30 {
31   struct dlist_item * previous;
32   struct dlist_item * next;
33   void * item;
34 } DLIST_ITEM;
35
36 /**************************************************************************//**
37  * Double-linked list structure
38  *****************************************************************************/
39 typedef struct dlist
40 {
41   DLIST_ITEM * head;
42   DLIST_ITEM * tail;
43 } DLIST;
44
45
46 void dlist_initialize(DLIST * list);
47 void * dlist_pop_last(DLIST * list);
48 void dlist_push_first(DLIST * list, void * item);
49 void dlist_push_last(DLIST * list, void * item);
50 DLIST_ITEM * dlist_get_first(DLIST * list);
51 DLIST_ITEM * dlist_get_last(DLIST * list);
52 DLIST_ITEM * dlist_get_next(DLIST_ITEM * item);
53 int dlist_is_empty(DLIST * list);
54 int dlist_count(DLIST * list);
55
56 #endif