os/graphics/graphicscomposition/openwfcompositionengine/common/include/owflinkedlist.h
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/graphicscomposition/openwfcompositionengine/common/include/owflinkedlist.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,140 @@
1.4 +/* Copyright (c) 2009 The Khronos Group Inc.
1.5 + * Portions copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies)
1.6 + *
1.7 + * Permission is hereby granted, free of charge, to any person obtaining a
1.8 + * copy of this software and/or associated documentation files (the
1.9 + * "Materials"), to deal in the Materials without restriction, including
1.10 + * without limitation the rights to use, copy, modify, merge, publish,
1.11 + * distribute, sublicense, and/or sell copies of the Materials, and to
1.12 + * permit persons to whom the Materials are furnished to do so, subject to
1.13 + * the following conditions:
1.14 + *
1.15 + * The above copyright notice and this permission notice shall be included
1.16 + * in all copies or substantial portions of the Materials.
1.17 + *
1.18 + * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1.19 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1.20 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1.21 + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
1.22 + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
1.23 + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
1.24 + * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
1.25 + */
1.26 +
1.27 +#ifndef OWFLLIST_H_
1.28 +#define OWFLLIST_H_
1.29 +
1.30 +#include "owfpool.h"
1.31 +#include "owftypes.h"
1.32 +
1.33 +
1.34 +#ifdef __cplusplus
1.35 +extern "C"
1.36 +{
1.37 +#endif
1.38 +
1.39 +/*!
1.40 + * Allocates new node from the node pool
1.41 + *
1.42 + * \param pool Node pool
1.43 + * \param data Data to store in the node
1.44 + *
1.45 + * \return New node containing data or NULL
1.46 + */
1.47 +OWF_API_CALL OWF_NODE*
1.48 +OWF_Node_Create(OWF_POOL* pool, void* data);
1.49 +
1.50 +/*!
1.51 + * Returns node to pool it was allocated from.
1.52 + *
1.53 + * \param node Node to "destroy"
1.54 + */
1.55 +OWF_API_CALL void
1.56 +OWF_Node_Destroy(OWF_NODE* node);
1.57 +
1.58 +/*!
1.59 + * Returns list's tail node.
1.60 + *
1.61 + * \param root List root
1.62 + *
1.63 + * \return List's tail (last) node
1.64 + */
1.65 +OWF_API_CALL OWF_NODE*
1.66 +OWF_List_Tail(OWF_NODE* root);
1.67 +
1.68 +/*!
1.69 + * Append node to list.
1.70 + *
1.71 + * \param root List root
1.72 + *
1.73 + * \return New list root node
1.74 + */
1.75 +OWF_API_CALL OWF_NODE*
1.76 +OWF_List_Append(OWF_NODE* root, OWF_NODE* node);
1.77 +
1.78 +/*!
1.79 + * Insert node to list front. I.e. current root becomes
1.80 + * 2nd in the list and so on.
1.81 + *
1.82 + * \param root List root
1.83 + * \param node Node to insert
1.84 + *
1.85 + * \return New list root (inserted node)
1.86 + */
1.87 +OWF_API_CALL OWF_NODE*
1.88 +OWF_List_Insert(OWF_NODE* root, OWF_NODE* node);
1.89 +
1.90 +/*!
1.91 + * Inserts node into list, immediately after node "pred".
1.92 + *
1.93 + * \param pred Node after which the newcomer should be placed.
1.94 + * \param node Node to add.
1.95 + */
1.96 +OWF_API_CALL void
1.97 +OWF_List_InsertAfter(OWF_NODE* pred, OWF_NODE* node);
1.98 +
1.99 +/*!
1.100 + * Searches the list for data ptr. Returns the node
1.101 + * that contains pointer to data, or NULL if no such node
1.102 + * can be found from the list.
1.103 + *
1.104 + * \param root List root
1.105 + * \param data Data pointer
1.106 + *
1.107 + * \return Node containing the data ptr or NULL.
1.108 + */
1.109 +OWF_API_CALL OWF_NODE*
1.110 +OWF_List_Contains(OWF_NODE* root, void* data);
1.111 +
1.112 +/*!
1.113 + * Remove node from list. Obs! The node isn't freed,
1.114 + * but only removed from the list. It's up to caller
1.115 + * to take care of destroying the node i.e. returning
1.116 + * it to pool or releasing the memory otherwise allocated
1.117 + * to it.
1.118 + *
1.119 + * \param root List root
1.120 + * \param node Node to remove from list
1.121 + *
1.122 + * \return New list root after removal
1.123 + */
1.124 +OWF_API_CALL OWF_NODE*
1.125 +OWF_List_Remove(OWF_NODE* root, OWF_NODE* node);
1.126 +
1.127 +/*!
1.128 + * Remove all nodes from the list. Equals to
1.129 + * while (list) list = OWF_List_Remove(list, list);
1.130 + *
1.131 + * \param root List root
1.132 + *
1.133 + * \return NULL.
1.134 + */
1.135 +OWF_API_CALL OWF_NODE*
1.136 +OWF_List_Clear(OWF_NODE* root);
1.137 +
1.138 +#ifdef __cplusplus
1.139 +}
1.140 +#endif
1.141 +
1.142 +
1.143 +#endif