summaryrefslogtreecommitdiff
path: root/algo1w4d2/Queue.cpp
diff options
context:
space:
mode:
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();
+}
+