4#include "../Foundation/Assert.h"
5#include "AsyncStreams.h"
6#include "Internal/ZLibStream.h"
16 size_t consumedInputBytes = 0;
19 virtual bool canEndWritable()
override;
22template <
typename T_AsyncEventLoop>
27 asyncWork.work.template bind<AsyncZLibTransformStreamT, &AsyncZLibTransformStreamT::work>(*
this);
28 asyncWork.callback.template bind<AsyncZLibTransformStreamT, &AsyncZLibTransformStreamT::afterWork>(*
this);
33 typename T_AsyncEventLoop::LoopWork asyncWork;
35 void setEventLoop(T_AsyncEventLoop& loop) { eventLoop = &loop; }
38 T_AsyncEventLoop* eventLoop =
nullptr;
46 SC_TRY_MSG(eventLoop !=
nullptr,
"AsyncZLibTransformStreamT::setEventLoop not called");
47 return asyncWork.start(*eventLoop);
55 SC_TRY_MSG(eventLoop !=
nullptr,
"AsyncZLibTransformStreamT::setEventLoop not called");
56 return asyncWork.start(*eventLoop);
59 void afterWork(
typename T_AsyncEventLoop::LoopWork::Result&)
63 AsyncTransformStream::afterFinalize(savedOutput, streamEnded);
67 AsyncTransformStream::afterProcess(savedInput, savedOutput);
73 return finalizing ? stream.finalize(savedOutput, streamEnded) : stream.process(savedInput, savedOutput);
76 bool finalizing =
false;
77 bool streamEnded =
false;
#define SC_ASSERT_RELEASE(e)
Assert expression e to be true.
Definition Assert.h:48
#define SC_TRY_MSG(expression, failedMessage)
Checks the value of the given expression and if failed, returns a result with failedMessage to caller...
Definition Result.h:60
struct SC_COMPILER_EXPORT Function
Wraps function pointers, member functions and lambdas without ever allocating.
Definition Function.h:19
Definition AsyncStreams.h:52
A stream that can both produce and consume buffers.
Definition AsyncStreams.h:469
An ascii string used as boolean result. SC_TRY macro forwards errors to caller.
Definition Result.h:13
View over a contiguous sequence of items (pointer + size in elements).
Definition Span.h:29