2018-06-04 22:26:48 +00:00
|
|
|
//
|
|
|
|
// Created by Antoine Bartuccio on 22/05/2018.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef LO41_LIST_H
|
|
|
|
#define LO41_LIST_H
|
|
|
|
|
|
|
|
#include "../Objects.h"
|
|
|
|
|
|
|
|
typedef struct o_Element Element;
|
|
|
|
|
|
|
|
#include "Element.h"
|
|
|
|
|
|
|
|
#define WRONG_ELEMENT CRASH("This element is not within the list\n")
|
|
|
|
|
|
|
|
struct o_List {
|
2018-06-04 22:34:30 +00:00
|
|
|
PRIVATE Element *head;
|
|
|
|
PRIVATE Element *tail;
|
|
|
|
PRIVATE int size;
|
|
|
|
|
2018-06-05 11:43:45 +00:00
|
|
|
PUBLIC Element *(*get_head)(_THIS(List));
|
|
|
|
PUBLIC Element *(*get_tail)(_THIS(List));
|
|
|
|
PUBLIC int (*get_size)(_THIS(List));
|
|
|
|
PUBLIC void (*clear)(_THIS(List));
|
|
|
|
PUBLIC void (*remove_head)(_THIS(List));
|
|
|
|
PUBLIC void (*remove_tail)(_THIS(List));
|
|
|
|
|
|
|
|
|
|
|
|
DESTRUCTOR(List);
|
2018-06-04 22:26:48 +00:00
|
|
|
};
|
|
|
|
|
2018-06-05 11:43:45 +00:00
|
|
|
FRIENDLY(head, Element)
|
|
|
|
FRIENDLY(tail, Element)
|
|
|
|
FRIENDLY(size, Element)
|
|
|
|
|
2018-06-04 22:26:48 +00:00
|
|
|
List *$_init_List();
|
|
|
|
|
|
|
|
#endif //LO41_LIST_H
|