-
Notifications
You must be signed in to change notification settings - Fork 0
/
objPosDLinkedList.h
63 lines (49 loc) · 1.48 KB
/
objPosDLinkedList.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
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef OBJPOSDLINKEDLIST_H
#define OBJPOSDLINKEDLIST_H
#include "objPosList.h"
#include "objPos.h"
class objPos;
class DNode
{
public:
objPos data;
DNode* next;
DNode* prev;
DNode()
{
data = objPos(0,0,0,0,0);
next = nullptr;
prev = nullptr;
}
};
// Public inheritance - using ObjPosList interface
class objPosDLinkedList : public objPosList
{
// Singly linked list with header and tail pointer
private:
DNode* listHead;
DNode* listTail;
DNode* persistHead;
int listSize;
public:
objPosDLinkedList();
virtual ~objPosDLinkedList(); // polymorphic destructor
// Once inheriting interface (Pure Abstract Class), must provide concrete implementation
// for all the interface functions.
int getSize();
bool isEmpty();
void insertHead(const objPos &thisPos);
void insertTail(const objPos &thisPos);
void insert(const objPos &thisPos, int index);
objPos getHead() const;
objPos getTail() const;
objPos get(int index) const;
objPos getNext();
void resetReadPos();
void set(const objPos &thisPos, int index);
objPos removeHead();
objPos removeTail();
objPos remove(int index);
void printList() const;
};
#endif