/**
 * @file list.h
 *
 * @brief List functions (header).
 *
 * Copyright 2007-2008, Freie Universitaet Berlin. All rights reserved.
 * Please refer to the COPYING file for detailed licensing information.
 *
 * @author Georg Wittenburg
 *
 * $Id: list.h 2685 2008-06-25 16:38:56Z wittenbu $
 */

#ifndef UTIL_LIST_H
#define UTIL_LIST_H

#include "../types.h"

void list_alloc(list_t** list);
void list_free(list_t** list);
void list_add(list_t* list, void* data);
void list_insert_where(list_t* list, void* data, bool(*matches)(const void*, const void*));
void list_remove(list_t* list, const void* data);
bool list_contains(const list_t* list, const void* data);
void* list_get(const list_t* list, unsigned int index);
unsigned int list_size(const list_t* list);
bool list_empty(const list_t* list);
void* list_head(const list_t* list);
void* list_tail(const list_t* list);
void* list_find(const list_t* list, const void* data, bool(*matches)(const void*, const void*));
void list_print(const list_t* list, void(*print_data)(const void*));
void list_map(const list_t* list, void(*function)(const void*));
void list_sort(list_t* list, bool(*greater_than)(const void*, const void*));
void list_to_array(const list_t* list, void* array, size_t data_item_size);
void list_from_array(list_t* list, const void* array, size_t data_item_size, size_t array_size);

#endif	// UTIL_LIST_H
