/usr/include/wombat-c/list.h is in libmama-dev 2.2.2.1-11ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | /* $Id$
*
* OpenMAMA: The open middleware agnostic messaging API
* Copyright (C) 2011 NYSE Technologies, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef LIST_H__
#define LIST_H__
#if defined(__cplusplus)
extern "C" {
#endif
#include "wombat/wincompat.h"
#include <stddef.h> /* for size_t */
#define INVALID_LIST NULL
/**
* List handle.
*/
typedef void* wList;
/*
* Iterator handle.
*/
typedef void* wIterator;
/**
* Callback typedef fucntion for list_for_each()
*
* The signature should be:
* void function (void* element, void* closure)
*/
typedef void (*wListCallback)(wList list, void* element, void* closure);
/**
* Create a list for elements of a specific size. This implementation does not
* allow list elements of different sizes. Returns INVALID_LIST if it fails.
*/
COMMONExpDLL
wList
list_create (size_t elementSize);
/**
* Destroy a list. All of the elements are automatically freed. It is only
* necessary to call list_free() for elements that are not currently on the
* list. The destructor callback gets invoked for every element that remains
* in the list. This can be used to free resources.
*/
COMMONExpDLL
void
list_destroy (wList list, wListCallback destructor, void *closure);
/**
* Allocate an element.
*
* Returns a pointer to the element or NULL if it can not allocate the
* memory.
*/
COMMONExpDLL
void*
list_allocate_element (wList list);
/**
* Free an element created by list_allocate(). This should not be called for
* an element that has been put in the list. If the element is in the list, it
* will not be freed or removed.
*/
COMMONExpDLL
void
list_free_element (wList list, void* element);
/**
* Insert an element at the beginning of the list.
*/
COMMONExpDLL
void
list_push_front (wList list, void* element);
/**
* Put an element on the end of the list.
*
*/
COMMONExpDLL
void
list_push_back (wList list, void* element);
/**
* Allocate a new element and add it to the end of the list
* Same as list_allocate_element() followed by list_push_back()
* Return a pointer to the new element, or NULL if an error occurs
*/
COMMONExpDLL
void*
list_add_element (wList list);
/**
* Insert a list item before the specified item.
*/
COMMONExpDLL
void
list_insert_before (wList list, void* position, void* element);
/**
* Return the first element in the list.
*/
COMMONExpDLL
void*
list_get_head (wList list);
/**
* Return the last element in the list.
*/
COMMONExpDLL
void*
list_get_tail (wList list);
/**
* Return the element after the specified element.
*/
COMMONExpDLL
void*
list_get_next (wList list, void *element);
/**
* Return the element at the specified index
* If index is out-of-bounds, return NULL
* Index is zero-index i.e. index=0 is the first item in the list
*/
COMMONExpDLL
void*
list_get_element_at_index (wList list, int index);
/**
* Remove an element from the front of the list. list_free_element() must be
* called if the element is not placed back on the list.
*/
COMMONExpDLL
void*
list_pop_front (wList list);
/**
* Remove the specified element from the list.
*/
COMMONExpDLL
void
list_remove_element (wList list, void* element);
/**
* Invoke the specified callback for each element in the list passing the
* specified closure. The callback may remove the current element.
*/
COMMONExpDLL
void
list_for_each (wList list, wListCallback cb, void* closure);
/**
* Return the number of entries in the list.
*/
COMMONExpDLL
unsigned long
list_size (wList list);
/**
* Lock the list. Must be followed by unlock. Locks are recursive.
*/
COMMONExpDLL
void
list_lock (wList list);
COMMONExpDLL
void
list_unlock (wList list);
/*
* The list iterator provides a robust and thread-safe, cursor mechanism for
* lists. It treats the list as a cirularly linked list: when it reaches the end
* iterator_next() moves the iterator back to the first element. The iterator
* remains valid event when elements are deleted. If the current element is
* deleted the iterator is moved to the next element. For an empty list the
* iterator's current node is NULL.
*/
/**
* Create an iterator.
*/
COMMONExpDLL
wIterator
list_create_iterator (wList list);
/**
* Return the iterator's current node.
*/
COMMONExpDLL
void*
iterator_current (wIterator iterator);
/**
* Return the current node and advance to the next node.
*/
COMMONExpDLL
void*
iterator_next (wIterator iterator);
/**
* Return the current node and advance to the next node. Return
* to the first node after the last.
*/
COMMONExpDLL
void*
iterator_next_circ (wIterator iterator);
/**
* Insert the specified element before the current element of the iteration.
*/
COMMONExpDLL
void
iterator_insert_before (wIterator iterator, void *element);
/**
* Destroy an iterator.
*
*/
COMMONExpDLL
void
iterator_destroy (wIterator iterator);
/**
* Move the specified element from its current position to the postion before
* the iterator.
*/
COMMONExpDLL
void
iterator_move_element_before (wIterator iterator, void *element);
#if defined(__cplusplus)
}
#endif
#endif /* LIST_H__ */
|