44#include <StormByte/type_traits/safe.hxx>
48#include <StormByte/logger/log.hxx>
49#include <StormByte/safe/function.hxx>
50#include <StormByte/safe/pointers.hxx>
51#include <StormByte/type_traits.hxx>
91 bool EoF() const noexcept;
142 bool Write(std::string_view text)
const noexcept;
221 template<
typename Callable>
224 requires(std::remove_cvref_t<Callable>& callable,
const PipeInput& input,
229 Pipe(MakeCallback(
std::forward<Callable>(callable))) {}
282 template<typename Callable>
284 using Context = std::remove_cvref_t<Callable>;
286 Context* state =
nullptr;
288 state =
new (block) Context(std::forward<Callable>(callable));
297 (*
static_cast<Context*
>(current))(input, output, log);
298 return StormByte::Safe::Status::Success;
300 [](
const void* current)
noexcept ->
void* {
301 void* cloned =
nullptr;
304 new (cloned) Context(*
static_cast<const Context*
>(current));
308 if (cloned !=
nullptr)
313 [](
void* current)
noexcept {
314 static_cast<Context*
>(current)->~Context();
Synchronous, non-owning stage output borrow with const mutation forwarding.
Definition pipe.hxx:115
PipeOutput(WriteOnly &output) noexcept
Borrow a live stream output.
void SetError() const noexcept
Fail the borrowed output and wake waiters.
bool Write(std::string_view text) const noexcept
Copy length-aware text without a trailing NUL.
bool Write(const StormByte::Safe::Binary &data) const noexcept
Copy bytes to the borrowed writer.
bool IsWritable() const noexcept
Query whether the writer accepts more data.
void Close() const noexcept
Close the borrowed output and wake readers.
bool Write(StormByte::Safe::Binary &&data) const noexcept
Move bytes to the borrowed writer.
One transformation in a Pipeline.
Definition pipe.hxx:199
StormByte::Safe::Function< void(const PipeInput &, const PipeOutput &, const StormByte::Safe::Shared< StormByte::Logger::Log > &)> Callback
Owned callback with borrowed stream endpoints and logger.
Definition pipe.hxx:204
Pipe(Callback callback) noexcept
Adopt an explicitly provided creator-context callback.
Pipe(const Pipe &other)
Copy a Pipe.
~Pipe() noexcept
Release context through its creator callback.
Pipe(Pipe &&other) noexcept
Take a Pipe.
StormByte::Safe::Status Run(const PipeInput &in, const PipeOutput &out, const StormByte::Safe::Shared< StormByte::Logger::Log > &log) const
Run this pipe.
STORMBYTE_FORCE_INLINE Pipe(Callable &&callable)
Own a copyable callable in its creator module.
Definition pipe.hxx:228
Buffer that can be read and not written.
Definition generic.hxx:220
Buffer that can be written and not read.
Definition generic.hxx:497
STORMBYTE_DECLARE_MAYBE_SAFE(class StormByte::System::Device::Access)
Buffer module of the StormByte suite.
void * Allocate(std::size_t bytes)
void Free(void *pointer) noexcept
Root namespace of the StormByte C++ suite.
#define STORMBYTE_BUFFER_PUBLIC
Definition visibility.h:54