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 /**--------------------------------------------------------------------------------------------------
6 \brief Stores objects in a first-in, first out queue based Buffer with push and pop functions
7 **/
8 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>>
9 class QueueBuffer : protected Buffer<t_type, t_index_type, t_memory_allocator, t_memory_manager>
10 {
11 public:
12 constexpr QueueBuffer()
13 : Buffer<t_type, t_index_type, t_memory_allocator, t_memory_manager>()
14 , m_start(0)
15 , m_end(0)
16 {}
17 constexpr QueueBuffer(const QueueBuffer& buffer)
18 : Buffer<t_type, t_index_type, t_memory_allocator, t_memory_manager>(buffer)
19 , m_start(buffer.m_start)
20 , m_end(buffer.m_end)
21 {}
23 : Buffer<t_type, t_index_type, t_memory_allocator, t_memory_manager>(buffer)
24 , m_start(0)
25 , m_end(buffer.size())
26 {}
27 constexpr QueueBuffer(QueueBuffer&& buffer) noexcept
29 , m_start(buffer.m_start)
30 , m_end(buffer.m_end)
31 {}
32
34 : Buffer<t_type, t_index_type, t_memory_allocator, t_memory_manager>(size)
35 , m_start(0)
36 , m_end(0)
37 {}
62 void clear()
63 {
64 m_start = m_end;
65 }
66 void pop()
67 {
68 m_start++;
69 checkMove();
70 }
71 /**--------------------------------------------------------------------------------------------------
72 Constructor.
73
74 Author: Tyler Parke
75
76 Date: 2017-11-19
77
78 Parameters:
79 parameter1 - The first parameter.
80 **/
81
86
87 /**--------------------------------------------------------------------------------------------------
88 Constructor.
89
90 Author: Tyler Parke
91
92 Date: 2017-11-19
93
94 Parameters:
95 parameter1 - The first parameter.
96 **/
97
98 [[nodiscard]] decltype(auto) front() const
99 {
101 }
102
103 bool empty() const
104 {
105 return m_end == m_start;
106 }
107 [[nodiscard]] constexpr static t_type Type() { return Buffer<t_type, t_index_type, t_memory_allocator, t_memory_manager>::Type(); }
108
109 [[nodiscard]] constexpr t_memory_manager& memoryInterface()
110 {
112 }
113 [[nodiscard]] constexpr const t_memory_manager& memoryInterface() const
114 {
116 }
117 inline QueueBuffer& operator=(const QueueBuffer& buffer) noexcept
118 {
119 m_start = buffer.m_start;
120 m_end = buffer.m_end;
122 return *this;
123 }
124 inline QueueBuffer& operator=(QueueBuffer&& buffer) noexcept
125 {
126 m_start = buffer.m_start;
127 m_end = buffer.m_end;
129 return *this;
130 }
131 inline const t_type& operator[](t_index_type value) const noexcept
132 {
134 }
135 inline t_type& operator[](t_index_type value) noexcept
136 {
138 }
139 uint04 size() const
140 {
141 return m_end - m_start;
142 }
143 inline const t_type& last() const
144 {
146 }
151 protected:
162 protected:
165 };
166}
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
constexpr Buffer()
Definition Buffer.hpp:61
Buffer & operator=(const Buffer &buffer)
Definition Buffer.hpp:932
void add(t_type &&object)
Adds object to the end of the buffer.
Definition Buffer.hpp:186
constexpr t_memory_manager & memoryInterface()
Definition Buffer.hpp:1031
void removeAllIndex(t_index_type start, t_index_type end)
Definition Buffer.hpp:716
static constexpr t_type Type()
Definition Buffer.hpp:1029
decltype(auto) get(t_index_type index)
Definition Buffer.hpp:541
Stores objects in a first-in, first out queue based Buffer with push and pop functions.
Definition QueueBuffer.hpp:10
constexpr QueueBuffer(QueueBuffer &&buffer) noexcept
Definition QueueBuffer.hpp:27
QueueBuffer & operator=(const QueueBuffer &buffer) noexcept
Definition QueueBuffer.hpp:117
QueueBuffer & operator=(QueueBuffer &&buffer) noexcept
Definition QueueBuffer.hpp:124
constexpr t_memory_manager & memoryInterface()
Definition QueueBuffer.hpp:109
void checkMove()
Definition QueueBuffer.hpp:152
void pop()
Definition QueueBuffer.hpp:66
t_type & operator[](t_index_type value) noexcept
Definition QueueBuffer.hpp:135
constexpr const t_memory_manager & memoryInterface() const
Definition QueueBuffer.hpp:113
constexpr QueueBuffer(const Buffer< t_type, t_memory_allocator, t_memory_manager > &buffer)
Definition QueueBuffer.hpp:22
t_type & last()
Definition QueueBuffer.hpp:147
constexpr QueueBuffer()
Definition QueueBuffer.hpp:12
bool empty() const
Definition QueueBuffer.hpp:103
static constexpr t_type Type()
Definition QueueBuffer.hpp:107
decltype(auto) front() const
Definition QueueBuffer.hpp:98
uint04 size() const
Definition QueueBuffer.hpp:139
const t_type & last() const
Definition QueueBuffer.hpp:143
constexpr QueueBuffer(const QueueBuffer &buffer)
Definition QueueBuffer.hpp:17
uint04 m_start
Definition QueueBuffer.hpp:163
void clear()
Definition QueueBuffer.hpp:62
const t_type & operator[](t_index_type value) const noexcept
Definition QueueBuffer.hpp:131
uint04 m_end
Definition QueueBuffer.hpp:164
void push(t_type &&object)
Definition QueueBuffer.hpp:38
void push(const t_type &object)
Definition QueueBuffer.hpp:50
decltype(auto) front()
Definition QueueBuffer.hpp:82
QueueBuffer(uint04 size)
Definition QueueBuffer.hpp:33
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:96