-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinkedList.h
50 lines (40 loc) · 1.5 KB
/
linkedList.h
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
/*
* Name: Aaron Ennis
* Email: ennisa@oregonstate.edu
* Last modified: 31 October 2020
* Description: This is the declaration/interface file for a linked list that
* uses front and back sentinels. This file provides implementation as a deque
* abstract data type.
* NOTE: This is a slightly modified version of a linked list solution I built
* for an assignment in CS261 - Data Structures.
*/
#ifndef LINKED_LIST_H
#define LINKED_LIST_H
#include "command.h"
/* When implementing, this macro can be modified to use whatever
* type is required for the implementation.
*/
#ifndef TYPE
#define TYPE struct Command*
#endif
struct LinkedList;
struct LinkedList* linkedListCreate();
void linkedListDestroy(struct LinkedList* list);
int linkedListSize(struct LinkedList* list);
// Deque interface
int linkedListIsEmpty(struct LinkedList* list);
void linkedListAddFront(struct LinkedList* list, TYPE value);
void linkedListAddBack(struct LinkedList* list, TYPE value);
TYPE linkedListFront(struct LinkedList* list);
TYPE linkedListBack(struct LinkedList* list);
void linkedListRemoveFront(struct LinkedList* list);
void linkedListRemoveBack(struct LinkedList* list);
// List iterator
struct Iterator;
struct Iterator* createIterator(struct LinkedList* list);
void iteratorInit(struct LinkedList* list, struct Iterator* iterator);
int iteratorHasNext(struct Iterator* iterator);
TYPE iteratorNext(struct Iterator* iterator);
void iteratorRemove(struct Iterator* iterator);
void iteratorDestroy(struct Iterator* iterator);
#endif