StormByte-Buffer 4.0.0
C++26 buffer module of the StormByte suite
Loading...
Searching...
No Matches
typedefs.hxx
Go to the documentation of this file.
1/*
2 * Copyright (C) 2024-2026 David C. Manuelda (StormBytePP)
3 *
4 * This file is part of StormByte-Buffer.
5 *
6 * StormByte-Buffer original source is dual-licensed:
7 *
8 * 1. GNU Lesser General Public License v3.0 (or later)
9 * You may redistribute and/or modify this file under the terms of the
10 * GNU Lesser General Public License as published by the Free Software
11 * Foundation, either version 3 of the License, or (at your option)
12 * any later version.
13 *
14 * 2. Commercial license
15 * Alternatively, this file may be used under the terms of a commercial
16 * license agreement with the copyright holder
17 * (David C. Manuelda <StormByte@gmail.com>).
18 *
19 * Both licenses apply only to original StormByte-Buffer source in this
20 * repository. They do not cover other StormByte modules or any third-party
21 * material shipped with this repository (including everything under
22 * thirdparty/, and in particular the bundled StormByte-Logger tree and
23 * the rest of the StormByte suite it vendors), which remains under its own
24 * license.
25 *
26 * Neither license grants any patent rights. Any patent licenses required
27 * to use this software or third-party components must be obtained separately
28 * from the patent holders.
29 *
30 * StormByte-Buffer is distributed in the hope that it will be useful,
31 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 * GNU Lesser General Public License for more details.
34 *
35 * You should have received a copy of the GNU Lesser General Public License
36 * version 3 along with StormByte-Buffer. If not, see
37 * <https://www.gnu.org/licenses/lgpl-3.0.html>.
38 *
39 * SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-StormByte-Commercial
40 */
41
42#pragma once
43
44#include <StormByte/type_traits/safe.hxx>
45
47#include <StormByte/byte_size.hxx>
48#include <StormByte/platform.h>
49#include <StormByte/type_traits.hxx>
50
51#include <string_view>
52
57namespace StormByte {
62 namespace Buffer {
67 namespace IO {
98
135
141 [[nodiscard]] STORMBYTE_FORCE_INLINE constexpr std::string_view ToString(Status status) noexcept {
142 switch (status) {
143 case Status::Ok: return "Ok";
144 case Status::End: return "End";
145 case Status::Error: return "Error";
146 case Status::Failed: return "Failed";
147 case Status::TryAgain: return "TryAgain";
148 }
149 return {};
150 }
151
157 [[nodiscard]] STORMBYTE_FORCE_INLINE constexpr std::string_view ToString(State state) noexcept {
158 switch (state) {
159 case State::Idle: return "Idle";
160 case State::Missing: return "Missing";
161 case State::Directory: return "Directory";
162 case State::Permission: return "Permission";
163 case State::NotWritable: return "NotWritable";
164 case State::Fault: return "Fault";
165 case State::Unavailable: return "Unavailable";
166 }
167 return {};
168 }
169
190
196 [[nodiscard]] STORMBYTE_FORCE_INLINE constexpr std::string_view ToString(Location location) noexcept {
197 switch (location) {
198 case Location::Local: return "Local";
199 case Location::Remote: return "Remote";
200 }
201 return {};
202 }
203
224
229 namespace Drainer {
251
266
272 [[nodiscard]] STORMBYTE_FORCE_INLINE constexpr std::string_view ToString(Status status) noexcept {
273 switch (status) {
274 case Status::Started: return "Started";
275 case Status::Paused: return "Paused";
276 case Status::Stopped: return "Stopped";
277 }
278 return {};
279 }
280
286 [[nodiscard]] STORMBYTE_FORCE_INLINE constexpr std::string_view ToString(Operation operation) noexcept {
287 switch (operation) {
288 case Operation::Toggle: return "Toggle";
289 case Operation::Flush: return "Flush";
290 }
291 return {};
292 }
293 }
294 }
295 }
296}
297
General exception for buffer errors.
Definition exception.hxx:166
STORMBYTE_DECLARE_MAYBE_SAFE(class StormByte::System::Device::Access)
Status and operations of a Bridge pump thread.
Status
Whether the Bridge worker is pumping.
Definition typedefs.hxx:237
@ Started
Worker may pull when there is room.
Definition typedefs.hxx:241
@ Stopped
No backend.
Definition typedefs.hxx:249
@ Paused
Worker does not pull.
Definition typedefs.hxx:245
Operation
Verbs for Bridge::Drainer.
Definition typedefs.hxx:256
@ Flush
Push what is already held.
Definition typedefs.hxx:264
@ Toggle
Switch between Started and Paused.
Definition typedefs.hxx:260
STORMBYTE_FORCE_INLINE constexpr std::string_view ToString(Status status) noexcept
Enumerator name of status.
Definition typedefs.hxx:272
Buffered binary sources and sinks.
Location
Where the bytes of a file-like source or sink live.
Definition typedefs.hxx:180
@ Local
Path is a filesystem path on this machine.
Definition typedefs.hxx:184
@ Remote
Path names a non-local target.
Definition typedefs.hxx:188
Status
Outcome of a single I/O call.
Definition typedefs.hxx:76
@ End
Origin exhausted; Result::count may be short.
Definition typedefs.hxx:84
@ Error
Origin failed during the call; buffers untouched.
Definition typedefs.hxx:88
@ Ok
The call completed as requested (see Result::count).
Definition typedefs.hxx:80
@ Failed
Illegal call or dead session; buffers untouched.
Definition typedefs.hxx:92
@ TryAgain
Not accepted; buffers untouched.
Definition typedefs.hxx:96
STORMBYTE_FORCE_INLINE constexpr std::string_view ToString(Status status) noexcept
Enumerator name of status.
Definition typedefs.hxx:141
State
Session state of a coordinated reader or writer.
Definition typedefs.hxx:105
@ Missing
Last Open: path or parent does not exist.
Definition typedefs.hxx:113
@ Fault
Origin I/O error mid-transfer.
Definition typedefs.hxx:129
@ Unavailable
Construction, after Close, or origin gone.
Definition typedefs.hxx:133
@ Idle
Armed.
Definition typedefs.hxx:109
@ Directory
Last Open: path is a directory.
Definition typedefs.hxx:117
@ NotWritable
Last Open or mid-write: cannot write.
Definition typedefs.hxx:125
@ Permission
Last Open: exists; read open denied.
Definition typedefs.hxx:121
Buffer module of the StormByte suite.
Root namespace of the StormByte C++ suite.
#define STORMBYTE_FORCE_INLINE
Per-call status plus how many bytes this call transferred.
Definition typedefs.hxx:214
Status status
Outcome of the call.
Definition typedefs.hxx:218
StormByte::ByteSize count
Bytes transferred this call.
Definition typedefs.hxx:222
#define STORMBYTE_BUFFER_PUBLIC
Definition visibility.h:54