42 namespace discord_core_internal {
57 using value_type = value_type_new;
58 using pointer = value_type*;
59 using size_type = uint64_t;
72 template<typename value_type2, size_type slice_count> friend class ring_buffer;
78 if (type == ring_buffer_access_type::read) {
128 jsonifier::vector<jsonifier_internal::unwrap_t<value_type>>
arrayValue{};
136 template<
typename value_type_new, u
int64_t slice_count>
class ring_buffer
137 :
public ring_buffer_interface<ring_buffer_interface<jsonifier_internal::unwrap_t<value_type_new>, 1024 * 16>, slice_count> {
141 using const_pointer =
const value_type*;
142 using pointer = value_type*;
143 using size_type = uint64_t;
156 template<typename value_type_newer> DCA_INLINE
void writeData(value_type_newer* data, size_type sizeNew) {
161 size_type writeSize{ sizeNew };
169 DCA_INLINE jsonifier::string_view_base<jsonifier_internal::unwrap_t<value_type>>
readData() {
170 jsonifier::string_view_base<jsonifier_internal::unwrap_t<value_type>> returnData{};
172 returnData = jsonifier::string_view_base<jsonifier_internal::unwrap_t<value_type>>{
base_type::getCurrentTail()->getCurrentTail(),
A template interface for a ring buffer.
size_type tail
The tail position in the buffer.
DCA_INLINE pointer getCurrentTail()
Get a pointer to the current tail position.
DCA_INLINE pointer getCurrentHead()
Get a pointer to the current head position.
DCA_INLINE ring_buffer_interface()
Constructor. initializes the buffer size.
DCA_INLINE void clear()
Clear the buffer by resetting positions.
DCA_INLINE size_type getFreeSpace()
Get the used space in the buffer.
DCA_INLINE size_type getUsedSpace()
Get the used space in the buffer.
DCA_INLINE bool isItEmpty()
Check if the buffer is empty.
size_type head
The head position in the buffer.
jsonifier::vector< jsonifier_internal::unwrap_t< value_type > > arrayValue
The underlying data array.
DCA_INLINE void modifyReadOrWritePosition(ring_buffer_access_type type, size_type sizeNew)
Modify the read or write position of the buffer.
bool isItFull()
Check if the buffer is full.
A template implementation of a ring buffer using ring_buffer_interface.
DCA_INLINE ring_buffer() noexcept=default
Default constructor. initializes the buffer size.
DCA_INLINE void writeData(value_type_newer *data, size_type sizeNew)
Write data into the buffer.
DCA_INLINE jsonifier::string_view_base< jsonifier_internal::unwrap_t< value_type > > readData()
Read data from the buffer.
ring_buffer_access_type
Enum representing different access types for a ring buffer.
The main namespace for the forward-facing interfaces.