AuroraRuntime/Source/Compression/BlockCompressor.hpp
2021-10-24 11:19:47 +01:00

40 lines
1.3 KiB
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: BlockCompressor.hpp
Date: 2021-6-17
Author: Reece
***/
#pragma once
namespace Aurora::Compression
{
class BaseCompressionStream : public ICompressionStream
{
public:
BaseCompressionStream(int bufferSize = 4096 * 4) : _outbuffer(bufferSize, true) {}
virtual ~BaseCompressionStream() {}
virtual bool Init(const AuSPtr<IO::IStreamReader> &reader) = 0;
virtual AuStreamReadWrittenPair_t Process(AuUInt32 len) = 0;
virtual void ProcessFlush() = 0;
virtual AuStreamReadWrittenPair_t Ingest(AuUInt32 bytesFromUnprocessedInputSource) override;
virtual void Flush() override;
virtual bool ReadByProcessedN(void * /*opt*/, AuUInt32 minimumDeflated) override;
virtual bool ReadByProcessedN(void * /*opt*/, AuUInt32 minimumDeflated, AuStreamReadWrittenPair_t &pair, bool ingestUntilEOS = true) override;
virtual bool GoBackByProcessedN(AuUInt32 offset) override;
virtual bool GoForwardByProcessedN(AuUInt32 offset) override;
/// @deprecated
virtual AuUInt32 GetInternalBufferSize();
bool Write(const void *a, AuUInt32 length);
protected:
Memory::ByteBuffer _outbuffer;
AuUInt32 _lastCount, _count;
};
}