-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathordering_structure.h
62 lines (57 loc) · 1.46 KB
/
ordering_structure.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
/**
* @file ordering_structure.h
* Definition of an abstract ordering structure class.
*
* You **should not** modify this file for the PA.
*
*/
#ifndef _ORDERING_STRUCTURE_H_
#define _ORDERING_STRUCTURE_H_
/**
* OrderingStructure: represents an interface for a structure that orders
* items placed into it. Your Stack and Queue classes will implement this
* interface.
*
*/
template <class T>
class OrderingStructure
{
public:
/**
* Destructor for the OrderingStructure. Virtual so as to allow
* derived classes to override if necessary.
*/
virtual ~OrderingStructure()
{
// nothing
}
/**
* Adds the given element to the ordering structure.
*
* @param theItem The item to be added.
*/
virtual void add(const T& theItem) = 0;
/**
* Removes an element from the ordering structure. You may assume
* that this function is only called when the ordering structure is
* not empty.
*
* @return An element from the ordering structure.
*/
virtual T remove() = 0;
/**
* Looks at the next element of the ordering structure, but does
* not remove it.
*
* @return The next element on the ordering structure.
*/
virtual T peek() = 0;
/**
* Determines if the ordering structure is empty.
*
* @return Whether or not there are still elements in the ordering
* structure.
*/
virtual bool isEmpty() const = 0;
};
#endif