os/graphics/graphicscomposition/openwfcompositionengine/common/include/owflinkedlist.h
First public contribution.
1 /* Copyright (c) 2009 The Khronos Group Inc.
2 * Portions copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies)
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and/or associated documentation files (the
6 * "Materials"), to deal in the Materials without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Materials, and to
9 * permit persons to whom the Materials are furnished to do so, subject to
10 * the following conditions:
12 * The above copyright notice and this permission notice shall be included
13 * in all copies or substantial portions of the Materials.
15 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
37 * Allocates new node from the node pool
39 * \param pool Node pool
40 * \param data Data to store in the node
42 * \return New node containing data or NULL
44 OWF_API_CALL OWF_NODE*
45 OWF_Node_Create(OWF_POOL* pool, void* data);
48 * Returns node to pool it was allocated from.
50 * \param node Node to "destroy"
53 OWF_Node_Destroy(OWF_NODE* node);
56 * Returns list's tail node.
58 * \param root List root
60 * \return List's tail (last) node
62 OWF_API_CALL OWF_NODE*
63 OWF_List_Tail(OWF_NODE* root);
66 * Append node to list.
68 * \param root List root
70 * \return New list root node
72 OWF_API_CALL OWF_NODE*
73 OWF_List_Append(OWF_NODE* root, OWF_NODE* node);
76 * Insert node to list front. I.e. current root becomes
77 * 2nd in the list and so on.
79 * \param root List root
80 * \param node Node to insert
82 * \return New list root (inserted node)
84 OWF_API_CALL OWF_NODE*
85 OWF_List_Insert(OWF_NODE* root, OWF_NODE* node);
88 * Inserts node into list, immediately after node "pred".
90 * \param pred Node after which the newcomer should be placed.
91 * \param node Node to add.
94 OWF_List_InsertAfter(OWF_NODE* pred, OWF_NODE* node);
97 * Searches the list for data ptr. Returns the node
98 * that contains pointer to data, or NULL if no such node
99 * can be found from the list.
101 * \param root List root
102 * \param data Data pointer
104 * \return Node containing the data ptr or NULL.
106 OWF_API_CALL OWF_NODE*
107 OWF_List_Contains(OWF_NODE* root, void* data);
110 * Remove node from list. Obs! The node isn't freed,
111 * but only removed from the list. It's up to caller
112 * to take care of destroying the node i.e. returning
113 * it to pool or releasing the memory otherwise allocated
116 * \param root List root
117 * \param node Node to remove from list
119 * \return New list root after removal
121 OWF_API_CALL OWF_NODE*
122 OWF_List_Remove(OWF_NODE* root, OWF_NODE* node);
125 * Remove all nodes from the list. Equals to
126 * while (list) list = OWF_List_Remove(list, list);
128 * \param root List root
132 OWF_API_CALL OWF_NODE*
133 OWF_List_Clear(OWF_NODE* root);