Basic Queue

v1
Brett 2022-12-26 00:31:00 -05:00
parent 90b12dac78
commit 8aa071eb85
4 changed files with 93 additions and 16 deletions

View File

@ -10,6 +10,7 @@
#include <string> #include <string>
#include <string_view> #include <string_view>
namespace BLT {
struct CapturePoint { struct CapturePoint {
long point; long point;
}; };
@ -22,8 +23,9 @@ struct CaptureInterval {
template<class MAP_TYPE> template<class MAP_TYPE>
class Profiler { class Profiler {
private: private:
MAP_TYPE* intervals; MAP_TYPE intervals;
MAP_TYPE* points = new MAP_TYPE<std::string_view, CaptureInterval>(); MAP_TYPE points;
}; };
}
#endif //BLT_PROFILER_H #endif //BLT_PROFILER_H

61
include/blt/std/queues.h Normal file
View File

@ -0,0 +1,61 @@
/*
* Created by Brett on 26/12/22.
* Licensed under GNU General Public License V3.0
* See LICENSE file for license detail
*/
#ifndef BLT_QUEUES_H
#define BLT_QUEUES_H
namespace BLT {
template<typename T>
struct node {
T t;
node* next;
};
template<typename T>
class flat_queue {
};
template<typename T>
class node_queue {
private:
node<T>* head;
public:
void insert(T t) {
auto newNode = new node<T>(t, nullptr);
if (head == nullptr)
head = newNode;
else {
newNode->next = head;
head = newNode;
}
}
[[nodiscard]] T front() const {
return head->t;
}
void pop() {
auto nextNode = head->next;
delete(head);
head = nextNode;
}
~node_queue() {
auto next = head;
while (next != nullptr){
auto nextNode = next->next;
delete(next);
next = nextNode;
}
}
};
}
#endif //BLT_QUEUES_H

View File

@ -4,3 +4,7 @@
* See LICENSE file for license detail * See LICENSE file for license detail
*/ */
#include <blt/profiling/profiler.h> #include <blt/profiling/profiler.h>
namespace BLT {
}

10
src/blt/std/queues.cpp Normal file
View File

@ -0,0 +1,10 @@
/*
* Created by Brett on 26/12/22.
* Licensed under GNU General Public License V3.0
* See LICENSE file for license detail
*/
#include <blt/std/queues.h>
namespace BLT {
}