Basic Queue
parent
90b12dac78
commit
8aa071eb85
|
@ -10,20 +10,22 @@
|
|||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
struct CapturePoint {
|
||||
namespace BLT {
|
||||
struct CapturePoint {
|
||||
long point;
|
||||
};
|
||||
};
|
||||
|
||||
struct CaptureInterval {
|
||||
struct CaptureInterval {
|
||||
CapturePoint start;
|
||||
CapturePoint end;
|
||||
};
|
||||
};
|
||||
|
||||
template<class MAP_TYPE>
|
||||
class Profiler {
|
||||
template<class MAP_TYPE>
|
||||
class Profiler {
|
||||
private:
|
||||
MAP_TYPE* intervals;
|
||||
MAP_TYPE* points = new MAP_TYPE<std::string_view, CaptureInterval>();
|
||||
};
|
||||
MAP_TYPE intervals;
|
||||
MAP_TYPE points;
|
||||
};
|
||||
}
|
||||
|
||||
#endif //BLT_PROFILER_H
|
||||
|
|
|
@ -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
|
|
@ -4,3 +4,7 @@
|
|||
* See LICENSE file for license detail
|
||||
*/
|
||||
#include <blt/profiling/profiler.h>
|
||||
|
||||
namespace BLT {
|
||||
|
||||
}
|
|
@ -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 {
|
||||
|
||||
}
|
Loading…
Reference in New Issue