#ifndef _INDEX_LIST_H_
#define _INDEX_LIST_H_

/*! \file index_list.h
    \brief A random access list ADT.

    You can traverse it like the double linked list in the order, the elements
    got added but access them by index directly.
 */

#include "dll.h"

/*! \brief Initializes the ADT.
    \param n max element count, at 0 the list_head, 0 < elements < n+1
    \return allocated ADT
 */
struct list_head** index_list_init(int n);

/*! \brief Adds a new element at index n */
void index_list_add(struct list_head **a, int n, struct list_head *h);

/*! \brief Removes an element from index n */
struct list_head *index_list_remove(struct list_head **a, int n);

/*! \brief Frees the complete ADT

    Including a.
 */
void index_list_free(struct list_head **a);

#endif
