AuroraRuntime/Source/IO/AuIOHandle.hpp
2023-08-15 14:46:21 +01:00

69 lines
1.7 KiB
C++

/***
Copyright (C) 2023 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AuIOHandle.hpp
Date: 2023-7-28
Author: Reece
***/
#pragma once
namespace Aurora::IO::IPC
{
struct IPCPipeImpl;
}
namespace Aurora::IO
{
struct AFileHandle : IIOHandle
{
virtual ~AFileHandle();
bool InitFromHandle(AuSPtr<IIOHandle> pHandle) override;
bool InitFromCopy(AuUInt64 uOSHandle) override;
bool InitFromMove(AuUInt64 uOSHandle) override;
bool InitFromPair(AuUInt64 uOSReadHandle,
AuUInt64 uOSWriteHandle) override;
bool InitFromPairMove(AuOptionalEx<AuUInt64> uOSReadHandle,
AuOptionalEx<AuUInt64> uOSWriteHandle) override;
AuUInt64 GetOSHandle() override;
AuOptionalEx<AuUInt64> GetOSHandleSafe() override;
AuUInt64 GetOSReadHandle() override;
AuOptionalEx<AuUInt64> GetOSReadHandleSafe() override;
AuUInt64 GetOSWriteHandle() override;
AuOptionalEx<AuUInt64> GetOSWriteHandleSafe() override;
bool IsValid() override;
bool HasUniqueWriteHandle() override;
bool IsAsync() override;
AuString GetPath() override;
AuOptionalEx<AuUInt64> uOSWriteHandle;
AuOptionalEx<AuUInt64> uOSReadHandle;
AuSPtr<IIOHandle> pThat;
bool bIsAsync {};
AuString path;
IPC::IPCPipeImpl *pIPCPipe {};
bool bDirectIO {};
protected:
// Implement me:
// bool InitFromPath(HandleCreate create) override;
static AuUInt64 DupHandle(AuUInt64 uOSHandle, bool bWriteAccess);
static void CloseHandle(AuUInt64 uOSHandle);
};
}