4#include "../Async/Async.h"
5#include "AsyncStreams.h"
11template <
typename AsyncRequestType>
19 AsyncRequestType request;
27 bool autoCloseDescriptor =
false;
32 void afterRead(
typename AsyncRequestType::Result& result);
33 void finalizeReadableDestruction();
40template <
typename AsyncRequestType>
45 template <
typename DescriptorType>
51 AsyncRequestType request;
59 bool autoCloseDescriptor =
false;
67 void afterWrite(
typename AsyncRequestType::Result& result);
68 void finalizeWritableDestruction();
struct SC_COMPILER_EXPORT Function
Wraps function pointers, member functions and lambdas without ever allocating.
Definition Function.h:19
Definition AsyncStreams.h:52
Holds a Span of AsyncBufferView (allocated by user) holding available memory for the streams.
Definition AsyncStreams.h:163
Asynchronous I/O (files, sockets, timers, processes, fs events, threads wake-up) (see Async) AsyncEve...
Definition Async.h:1285
Async source abstraction emitting data events in caller provided byte buffers.
Definition AsyncStreams.h:214
Definition AsyncRequestStreams.h:13
virtual Result asyncRead() override
Function that every stream must define to implement its custom read operation.
virtual Result asyncDestroyReadable() override
Function that a readable stream can re-implement to release its internal resources.
void setAutoCloseDescriptor(bool value)
Automatically closes descriptor during read stream close event.
Definition AsyncRequestStreams.h:17
Definition AsyncRequestStreams.h:42
virtual Result asyncWrite(AsyncBufferView::ID bufferID, Function< void(AsyncBufferView::ID)> cb) override
Function that every stream must define to implement its custom write operation.
void setAutoCloseDescriptor(bool value)
Automatically closes descriptor during write stream finish event.
Definition AsyncRequestStreams.h:49
virtual bool canEndWritable() override
Allows keeping a writable in ENDING state until it has finished flushing all pending data.
virtual Result asyncDestroyWritable() override
Function that a writable stream can re-implement to release its internal resources.
Base class for all async results (argument of completion callbacks).
Definition Async.h:256
Async destination abstraction where bytes can be written to.
Definition AsyncStreams.h:337
[UniqueHandleDeclaration2Snippet]
Definition File.h:78
Uses an SC::AsyncFileRead to stream data from a file.
Definition AsyncRequestStreams.h:77
Uses an SC::AsyncFileWrite to stream data from a socket.
Definition AsyncRequestStreams.h:89
An ascii string used as boolean result. SC_TRY macro forwards errors to caller.
Definition Result.h:13
Low-level OS socket handle.
Definition Socket.h:153
Uses an SC::AsyncFileWrite to stream data to a file.
Definition AsyncRequestStreams.h:83
Uses an SC::AsyncFileWrite to stream data to a socket.
Definition AsyncRequestStreams.h:95