-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStackInterface.hpp
More file actions
38 lines (29 loc) · 801 Bytes
/
StackInterface.hpp
File metadata and controls
38 lines (29 loc) · 801 Bytes
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
#ifndef _STACK_INTERFACE_
#define _STACK_INTERFACE_
#include <stdexcept>
#include "BaseTypes/Object.hpp"
class StackInterface {
public:
typedef unsigned int size_type;
class StackIsFull : public std::out_of_range {
public:
StackIsFull() noexcept
: std::out_of_range("Stack Size Limit Reached.")
{}
virtual ~StackIsFull() {}
};
class StackIsEmpty : public std::out_of_range {
public:
StackIsEmpty() noexcept
: std::out_of_range("Stack is empty cannot remove anything.")
{}
virtual ~StackIsEmpty() {}
};
StackInterface() {}
virtual ~StackInterface() {}
virtual Object* top() const = 0;
virtual void pop() = 0;
virtual void push(Object *o ) = 0;
virtual size_type size() const = 0;
};
#endif // _STACK_INTERFACE_