sl@0
|
1 |
/* Copyright (c) 2009 The Khronos Group Inc.
|
sl@0
|
2 |
* Portions copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies)
|
sl@0
|
3 |
*
|
sl@0
|
4 |
* Permission is hereby granted, free of charge, to any person obtaining a
|
sl@0
|
5 |
* copy of this software and/or associated documentation files (the
|
sl@0
|
6 |
* "Materials"), to deal in the Materials without restriction, including
|
sl@0
|
7 |
* without limitation the rights to use, copy, modify, merge, publish,
|
sl@0
|
8 |
* distribute, sublicense, and/or sell copies of the Materials, and to
|
sl@0
|
9 |
* permit persons to whom the Materials are furnished to do so, subject to
|
sl@0
|
10 |
* the following conditions:
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* The above copyright notice and this permission notice shall be included
|
sl@0
|
13 |
* in all copies or substantial portions of the Materials.
|
sl@0
|
14 |
*
|
sl@0
|
15 |
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
sl@0
|
16 |
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
sl@0
|
17 |
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
sl@0
|
18 |
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
sl@0
|
19 |
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
sl@0
|
20 |
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
sl@0
|
21 |
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
sl@0
|
22 |
*/
|
sl@0
|
23 |
|
sl@0
|
24 |
#ifndef OWFLLIST_H_
|
sl@0
|
25 |
#define OWFLLIST_H_
|
sl@0
|
26 |
|
sl@0
|
27 |
#include "owfpool.h"
|
sl@0
|
28 |
#include "owftypes.h"
|
sl@0
|
29 |
|
sl@0
|
30 |
|
sl@0
|
31 |
#ifdef __cplusplus
|
sl@0
|
32 |
extern "C"
|
sl@0
|
33 |
{
|
sl@0
|
34 |
#endif
|
sl@0
|
35 |
|
sl@0
|
36 |
/*!
|
sl@0
|
37 |
* Allocates new node from the node pool
|
sl@0
|
38 |
*
|
sl@0
|
39 |
* \param pool Node pool
|
sl@0
|
40 |
* \param data Data to store in the node
|
sl@0
|
41 |
*
|
sl@0
|
42 |
* \return New node containing data or NULL
|
sl@0
|
43 |
*/
|
sl@0
|
44 |
OWF_API_CALL OWF_NODE*
|
sl@0
|
45 |
OWF_Node_Create(OWF_POOL* pool, void* data);
|
sl@0
|
46 |
|
sl@0
|
47 |
/*!
|
sl@0
|
48 |
* Returns node to pool it was allocated from.
|
sl@0
|
49 |
*
|
sl@0
|
50 |
* \param node Node to "destroy"
|
sl@0
|
51 |
*/
|
sl@0
|
52 |
OWF_API_CALL void
|
sl@0
|
53 |
OWF_Node_Destroy(OWF_NODE* node);
|
sl@0
|
54 |
|
sl@0
|
55 |
/*!
|
sl@0
|
56 |
* Returns list's tail node.
|
sl@0
|
57 |
*
|
sl@0
|
58 |
* \param root List root
|
sl@0
|
59 |
*
|
sl@0
|
60 |
* \return List's tail (last) node
|
sl@0
|
61 |
*/
|
sl@0
|
62 |
OWF_API_CALL OWF_NODE*
|
sl@0
|
63 |
OWF_List_Tail(OWF_NODE* root);
|
sl@0
|
64 |
|
sl@0
|
65 |
/*!
|
sl@0
|
66 |
* Append node to list.
|
sl@0
|
67 |
*
|
sl@0
|
68 |
* \param root List root
|
sl@0
|
69 |
*
|
sl@0
|
70 |
* \return New list root node
|
sl@0
|
71 |
*/
|
sl@0
|
72 |
OWF_API_CALL OWF_NODE*
|
sl@0
|
73 |
OWF_List_Append(OWF_NODE* root, OWF_NODE* node);
|
sl@0
|
74 |
|
sl@0
|
75 |
/*!
|
sl@0
|
76 |
* Insert node to list front. I.e. current root becomes
|
sl@0
|
77 |
* 2nd in the list and so on.
|
sl@0
|
78 |
*
|
sl@0
|
79 |
* \param root List root
|
sl@0
|
80 |
* \param node Node to insert
|
sl@0
|
81 |
*
|
sl@0
|
82 |
* \return New list root (inserted node)
|
sl@0
|
83 |
*/
|
sl@0
|
84 |
OWF_API_CALL OWF_NODE*
|
sl@0
|
85 |
OWF_List_Insert(OWF_NODE* root, OWF_NODE* node);
|
sl@0
|
86 |
|
sl@0
|
87 |
/*!
|
sl@0
|
88 |
* Inserts node into list, immediately after node "pred".
|
sl@0
|
89 |
*
|
sl@0
|
90 |
* \param pred Node after which the newcomer should be placed.
|
sl@0
|
91 |
* \param node Node to add.
|
sl@0
|
92 |
*/
|
sl@0
|
93 |
OWF_API_CALL void
|
sl@0
|
94 |
OWF_List_InsertAfter(OWF_NODE* pred, OWF_NODE* node);
|
sl@0
|
95 |
|
sl@0
|
96 |
/*!
|
sl@0
|
97 |
* Searches the list for data ptr. Returns the node
|
sl@0
|
98 |
* that contains pointer to data, or NULL if no such node
|
sl@0
|
99 |
* can be found from the list.
|
sl@0
|
100 |
*
|
sl@0
|
101 |
* \param root List root
|
sl@0
|
102 |
* \param data Data pointer
|
sl@0
|
103 |
*
|
sl@0
|
104 |
* \return Node containing the data ptr or NULL.
|
sl@0
|
105 |
*/
|
sl@0
|
106 |
OWF_API_CALL OWF_NODE*
|
sl@0
|
107 |
OWF_List_Contains(OWF_NODE* root, void* data);
|
sl@0
|
108 |
|
sl@0
|
109 |
/*!
|
sl@0
|
110 |
* Remove node from list. Obs! The node isn't freed,
|
sl@0
|
111 |
* but only removed from the list. It's up to caller
|
sl@0
|
112 |
* to take care of destroying the node i.e. returning
|
sl@0
|
113 |
* it to pool or releasing the memory otherwise allocated
|
sl@0
|
114 |
* to it.
|
sl@0
|
115 |
*
|
sl@0
|
116 |
* \param root List root
|
sl@0
|
117 |
* \param node Node to remove from list
|
sl@0
|
118 |
*
|
sl@0
|
119 |
* \return New list root after removal
|
sl@0
|
120 |
*/
|
sl@0
|
121 |
OWF_API_CALL OWF_NODE*
|
sl@0
|
122 |
OWF_List_Remove(OWF_NODE* root, OWF_NODE* node);
|
sl@0
|
123 |
|
sl@0
|
124 |
/*!
|
sl@0
|
125 |
* Remove all nodes from the list. Equals to
|
sl@0
|
126 |
* while (list) list = OWF_List_Remove(list, list);
|
sl@0
|
127 |
*
|
sl@0
|
128 |
* \param root List root
|
sl@0
|
129 |
*
|
sl@0
|
130 |
* \return NULL.
|
sl@0
|
131 |
*/
|
sl@0
|
132 |
OWF_API_CALL OWF_NODE*
|
sl@0
|
133 |
OWF_List_Clear(OWF_NODE* root);
|
sl@0
|
134 |
|
sl@0
|
135 |
#ifdef __cplusplus
|
sl@0
|
136 |
}
|
sl@0
|
137 |
#endif
|
sl@0
|
138 |
|
sl@0
|
139 |
|
sl@0
|
140 |
#endif
|