summaryrefslogtreecommitdiff
path: root/algo1w4d2/Queue.cpp
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-03-05 20:43:24 +0100
committerlonkaars <loek@pipeframe.xyz>2023-03-05 20:43:24 +0100
commit01bd4791cbeabcf85ea72f91c1edd0af8ac17b1f (patch)
tree5c24611842cfefd1866a1e915c5d55279aae0234 /algo1w4d2/Queue.cpp
parentbdf6588d9154889d897d6b102fc32f49bf92fa7b (diff)
algo1w4d2HEADmaster
Diffstat (limited to 'algo1w4d2/Queue.cpp')
-rw-r--r--algo1w4d2/Queue.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/algo1w4d2/Queue.cpp b/algo1w4d2/Queue.cpp
new file mode 100644
index 0000000..6fd2959
--- /dev/null
+++ b/algo1w4d2/Queue.cpp
@@ -0,0 +1,27 @@
+#include "Queue.h"
+#include "Klant.h"
+
+Queue::Queue() {}
+Queue::~Queue() {
+ while (size() != 0)
+ delete remove().release();
+}
+
+void Queue::insert(const Klant& k) {
+ _queue.push_back(std::unique_ptr<Klant>(new Klant(k)));
+}
+
+std::unique_ptr<Klant> Queue::remove() {
+ std::unique_ptr<Klant> s = std::move(_queue.at(0));
+ _queue.erase(_queue.begin());
+ return s;
+}
+
+Klant* Queue::peek() {
+ return _queue.at(0).get();
+}
+
+unsigned Queue::size() {
+ return _queue.size();
+}
+