API Documentation
Loading...
Searching...
No Matches
QueueBuffer.hpp
Go to the documentation of this file.
1#pragma once
2#include <NDEVR/Buffer.h>
3namespace NDEVR
4{
5 template<class t_type, class t_index_type = uint04, class t_memory_allocator = ObjectAllocator<ObjectInfo<t_type>::Primitive, t_index_type>, class t_memory_manager = BufferAllocator<t_type ,t_index_type, false>>
6 class QueueBuffer : protected Buffer<t_type, t_index_type, t_memory_allocator, t_memory_manager>
7 {
8 public:
9 constexpr QueueBuffer()
10 : Buffer<t_type, t_index_type, t_memory_allocator, t_memory_manager>()
11 , m_start(0)
12 , m_end(0)
13 {}
14 constexpr QueueBuffer(const QueueBuffer& buffer)
15 : Buffer<t_type, t_index_type, t_memory_allocator, t_memory_manager>(buffer)
16 , m_start(buffer.m_start)
17 , m_end(buffer.m_end)
18 {}
20 : Buffer<t_type, t_index_type, t_memory_allocator, t_memory_manager>(buffer)
21 , m_start(0)
22 , m_end(buffer.size())
23 {}
24 constexpr QueueBuffer(QueueBuffer&& buffer) noexcept
26 , m_start(buffer.m_start)
27 , m_end(buffer.m_end)
28 {}
29
31 : Buffer<t_type, t_index_type, t_memory_allocator, t_memory_manager>(size)
32 , m_start(0)
33 , m_end(0)
34 {}
59 void clear()
60 {
61 m_start = m_end;
62 }
63 void pop()
64 {
65 m_start++;
66 checkMove();
67 }
68 /**--------------------------------------------------------------------------------------------------
69 Fn: Buffer::decltype(auto) get(uint04 index)
70
71 Constructor.
72
73 Author: Tyler Parke
74
75 Date: 2017-11-19
76
77 Parameters:
78 parameter1 - The first parameter.
79 *-----------------------------------------------------------------------------------------------**/
80
85
86 /**--------------------------------------------------------------------------------------------------
87 Fn: Buffer::decltype(auto) get(uint04 index) const
88
89 Constructor.
90
91 Author: Tyler Parke
92
93 Date: 2017-11-19
94
95 Parameters:
96 parameter1 - The first parameter.
97 *-----------------------------------------------------------------------------------------------**/
98
99 [[nodiscard]] decltype(auto) front() const
100 {
102 }
103
104 bool empty() const
105 {
106 return m_end == m_start;
107 }
108 [[nodiscard]] constexpr static t_type Type() { return Buffer<t_type, t_index_type, t_memory_allocator, t_memory_manager>::Type(); }
109
110 [[nodiscard]] constexpr t_memory_manager& memoryInterface()
111 {
113 }
114 [[nodiscard]] constexpr const t_memory_manager& memoryInterface() const
115 {
117 }
118 inline QueueBuffer& operator=(const QueueBuffer& buffer) noexcept
119 {
120 m_start = buffer.m_start;
121 m_end = buffer.m_end;
123 return *this;
124 }
125 inline QueueBuffer& operator=(QueueBuffer&& buffer) noexcept
126 {
127 m_start = buffer.m_start;
128 m_end = buffer.m_end;
130 return *this;
131 }
132 inline const t_type& operator[](t_index_type value) const noexcept
133 {
135 }
136 inline t_type& operator[](t_index_type value) noexcept
137 {
139 }
140 uint04 size() const
141 {
142 return m_end - m_start;
143 }
144 inline const t_type& last() const
145 {
147 }
152 protected:
163 protected:
166 };
167}
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
constexpr Buffer()
Definition Buffer.hpp:66
Buffer & operator=(const Buffer &buffer)
Definition Buffer.hpp:1773
void add(t_type &&object)
Definition Buffer.hpp:199
constexpr t_memory_manager & memoryInterface()
Definition Buffer.hpp:2074
void removeAllIndex(t_index_type start, t_index_type end)
Definition Buffer.hpp:1205
static constexpr t_type Type()
Definition Buffer.hpp:2072
decltype(auto) get(t_index_type index)
Definition Buffer.hpp:857
Definition QueueBuffer.hpp:7
constexpr QueueBuffer(QueueBuffer &&buffer) noexcept
Definition QueueBuffer.hpp:24
QueueBuffer & operator=(const QueueBuffer &buffer) noexcept
Definition QueueBuffer.hpp:118
QueueBuffer & operator=(QueueBuffer &&buffer) noexcept
Definition QueueBuffer.hpp:125
constexpr t_memory_manager & memoryInterface()
Definition QueueBuffer.hpp:110
void checkMove()
Definition QueueBuffer.hpp:153
void pop()
Definition QueueBuffer.hpp:63
t_type & operator[](t_index_type value) noexcept
Definition QueueBuffer.hpp:136
constexpr const t_memory_manager & memoryInterface() const
Definition QueueBuffer.hpp:114
constexpr QueueBuffer(const Buffer< t_type, t_memory_allocator, t_memory_manager > &buffer)
Definition QueueBuffer.hpp:19
t_type & last()
Definition QueueBuffer.hpp:148
constexpr QueueBuffer()
Definition QueueBuffer.hpp:9
bool empty() const
Definition QueueBuffer.hpp:104
static constexpr t_type Type()
Definition QueueBuffer.hpp:108
decltype(auto) front() const
Definition QueueBuffer.hpp:99
uint04 size() const
Definition QueueBuffer.hpp:140
const t_type & last() const
Definition QueueBuffer.hpp:144
constexpr QueueBuffer(const QueueBuffer &buffer)
Definition QueueBuffer.hpp:14
uint04 m_start
Definition QueueBuffer.hpp:164
void clear()
Definition QueueBuffer.hpp:59
const t_type & operator[](t_index_type value) const noexcept
Definition QueueBuffer.hpp:132
uint04 m_end
Definition QueueBuffer.hpp:165
void push(t_type &&object)
Definition QueueBuffer.hpp:35
void push(const t_type &object)
Definition QueueBuffer.hpp:47
decltype(auto) front()
Definition QueueBuffer.hpp:81
QueueBuffer(uint04 size)
Definition QueueBuffer.hpp:30
Definition ACIColor.h:37
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120