StormByte C++ Library 0.0.9999
StormByte is a comprehensive, cross-platform C++ library aimed at easing system programming, configuration management, logging, and database handling tasks. This library provides a unified API that abstracts away the complexities and inconsistencies of different platforms (Windows, Linux).
Loading...
Searching...
No Matches
producer.hxx
1#pragma once
2
3#include <StormByte/buffer/shared.hxx>
4#include <memory>
5
19namespace StormByte::Buffer {
20 class Consumer; // Forward declaration of the Consumer class
21
43 class STORMBYTE_PUBLIC Producer final {
44 public:
51 Producer() noexcept;
52
60 Producer(const Consumer& consumer);
61
69 Producer(std::shared_ptr<Shared> shared) noexcept;
70
78 Producer(const Simple& simple) noexcept;
79
87 Producer(Simple&& simple) noexcept;
88
94 Producer(const Producer& other) = default;
95
101 Producer(Producer&& other) noexcept = default;
102
108 ~Producer() noexcept = default;
109
115 Producer& operator=(const Producer& other) = default;
116
122 Producer& operator=(Producer&& other) noexcept = default;
123
129 Producer& operator=(const Consumer& consumer) noexcept;
130
135 Producer& operator<<(const Status& status);
136
142 Producer& operator<<(const Simple& buffer);
143
149 Producer& operator<<(Simple&& buffer);
150
156 Producer& operator<<(const std::string& data);
157
163 Producer& operator<<(const Buffer::Data& data);
164
170 Producer& operator<<(Buffer::Data&& data);
171
180 Consumer Consumer() const noexcept;
181
186 void Lock();
187
192 void Reserve(const std::size_t& size);
193
198 void Unlock();
199
205 Write::Status Write(const Simple& buffer);
206
213
219 Write::Status Write(const std::string& data);
220
226 Write::Status Write(const Buffer::Data& data);
227
234
235 private:
236 std::shared_ptr<Shared> m_shared;
237 };
238}
A read-only interface for accessing a shared buffer.
Definition consumer.hxx:37
A write-only interface for accessing a shared buffer.
Definition producer.hxx:43
Producer() noexcept
Default constructor.
A thread-safe version of the Simple buffer.
Definition shared.hxx:41
A lightweight class for storing and manipulating simple byte buffers.
Definition simple.hxx:36
Namespace for buffer-related components in the StormByte library.
Namespace for buffer-related components in the StormByte library.
Definition consumer.hxx:19
std::vector< Byte > Data
Represents collection of bytes stored in the buffer.
Definition typedefs.hxx:139
Status
Defines the status of the buffer during producer/consumer operations.
Definition typedefs.hxx:106
Namespace for write-related utilities in the StormByte library.