AuroraRuntime/Source/Compression/AuBaseStream.hpp
Reece Wilson f43251c8fc [+] AuNet::ISocketChannelEventListener
[+] AuFS::UpdateTimes
[+] AuFS::UpdateFileTimes
[+] AuFS::CompressEx
[*] AuFS::Compress now rejects files that look to be already compressed
[+] AuFS::DecompressEx
[+] AuFS::Create
[+] AuFS::WriteNewFile
[+] AuFS::WriteNewString
[+] AuFs::FileAttrsList
[+] AuFs::FileAttrsGet
[+] AuFs::FileAttrsSet
[+] DirectoryLogger::uMaxLogsOrZeroBeforeCompress
[+] ISocketChannel.AddEventListener
[+] ISocketChannel.AddEventListener
[+] DirectoryLogger.uMaxLogsOrZeroBeforeCompress
[*] Fix UNIX regression
[*] Fix up stream socket channel realloc IPC
[*] Fix shutdown regression in pretty much everything thanks to 8ff81df1's dumbass fix
    (fixes fence regression on shutdown)
[*] Fix DirDeleterEx formatting of reported failed paths
[*] Fix up file not truncated if already exists bugs. Extended and alternative apis added.
[*] Fix ICompressionStream::ReadEx returning the wrong read value
[+] Legacy compression API can now self-correct once newer stream processor objects are added
2023-02-04 19:43:01 +00:00

55 lines
1.7 KiB
C++

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AuBaseStream.hpp
Date: 2022-2-14
Author: Reece
***/
#pragma once
#include "AuIngestableReadBase.hpp"
namespace Aurora::Compression
{
struct BaseStream : ICompressionStream, protected IngestableReadBase
{
inline BaseStream(AuUInt32 bufferSize = 4096 * 64) : _outbufferOwned(bufferSize, true), uBufferSize_(bufferSize)
{
SetBuffer({});
}
inline virtual ~BaseStream()
{}
virtual bool Init(const AuSPtr<IO::IStreamReader> &reader) = 0;
virtual AuUInt32 GetAvailableProcessedBytes() override;
virtual AuStreamReadWrittenPair_t ReadEx(const AuMemoryViewWrite & /*opt*/ destination, bool bIngestUntilEOS) override;
virtual AuUInt32 Read(const AuMemoryViewWrite & /*opt*/ destination) override;
virtual bool GoBackByProcessedN(AuUInt32 dwOffset) override;
virtual bool GoForwardByProcessedN(AuUInt32 dwOffset) override;
virtual AuUInt32 GetInternalBufferSize() override;
bool Write(const void *pDest, AuUInt32 dwLength);
virtual AuStreamReadWrittenPair_t Ingest(AuUInt32 bytesFromUnprocessedInputSource) override;
virtual bool Flush() override;
virtual bool Finish() override;
bool IsValid();
AuSPtr<Memory::ByteBuffer> GetBuffer();
void SetBuffer(const AuSPtr<Memory::ByteBuffer> &pBuffer);
protected:
virtual AuStreamReadWrittenPair_t Ingest_s(AuUInt32 dwBytesFromUnprocessedInputSource) = 0;
AuSPtr<Memory::ByteBuffer> pOutputBuffer_;
Memory::ByteBuffer _outbufferOwned;
AuThreadPrimitives::SpinLock _spinlock;
AuUInt32 uBufferSize_;
};
}