2022-06-11 23:01:27 +00:00
|
|
|
/***
|
|
|
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
|
|
|
|
File: IOAdapterAsyncStream.hpp
|
|
|
|
Date: 2022-6-6
|
|
|
|
Author: Reece
|
|
|
|
***/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace Aurora::IO
|
|
|
|
{
|
2022-06-21 04:49:36 +00:00
|
|
|
struct IAsyncStreamReader : IStreamReader
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @brief Optional advanced use case.
|
|
|
|
* Begins work given caller provided memory
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
virtual EStreamError BeginRead(const AuSPtr<Memory::MemoryViewWrite> &internalView) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Optional advanced use case.
|
|
|
|
* Dequeues work done by begin read
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
virtual EStreamError Dequeue(AuUInt reqLength, Memory::MemoryViewWrite &out) = 0;
|
|
|
|
};
|
|
|
|
|
2022-06-29 13:56:59 +00:00
|
|
|
struct IAsyncStreamAdapter
|
2022-06-11 23:01:27 +00:00
|
|
|
{
|
|
|
|
virtual bool SetFlushOnWrite(bool value) = 0;
|
|
|
|
|
2022-11-08 21:25:43 +00:00
|
|
|
virtual void ReserveBuffer(AuUInt64 length) = 0;
|
2022-06-11 23:01:27 +00:00
|
|
|
|
2022-11-08 21:25:43 +00:00
|
|
|
virtual AuUInt64 GetReadOffset() = 0;
|
|
|
|
virtual AuUInt64 SetReadOffset(AuUInt64 offset) = 0;
|
2022-06-11 23:01:27 +00:00
|
|
|
|
2022-11-08 21:25:43 +00:00
|
|
|
virtual AuUInt64 GetWriteOffset() = 0;
|
|
|
|
virtual AuUInt64 SetWriteOffset(AuUInt64 offset) = 0;
|
2022-06-11 23:01:27 +00:00
|
|
|
|
2022-06-21 04:49:36 +00:00
|
|
|
virtual AuSPtr<IAsyncStreamReader> ToStreamReader() = 0;
|
2022-06-11 23:01:27 +00:00
|
|
|
virtual AuSPtr<IStreamWriter> ToStreamWriter() = 0;
|
|
|
|
|
|
|
|
virtual AuSPtr<IIOWaitableItem> ToWaitable() = 0;
|
|
|
|
|
|
|
|
virtual bool Reset() = 0;
|
|
|
|
};
|
|
|
|
|
2022-08-29 15:46:46 +00:00
|
|
|
AUKN_SYM AuSPtr<IAsyncStreamAdapter> NewAsyncStreamAdapter(const AuSPtr<IAsyncTransaction> &pTransaction, bool bIsStream);
|
2022-06-11 23:01:27 +00:00
|
|
|
}
|