AuroraRuntime/Source/IO/Loop/LSHandle.hpp

48 lines
1.3 KiB
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: LSHandle.hpp
Date: 2021-10-1
Author: Reece
***/
#pragma once
#include "WaitSingle.hpp"
namespace Aurora::IO::Loop
{
#if defined(AURORA_IS_MODERNNT_DERIVED)
static constexpr auto kInvalidHandle = (const AuUInt)-1;
#else
static constexpr auto kInvalidHandle = -1;
#endif
struct LSHandle : virtual WaitSingleGeneric
{
LSHandle();
LSHandle(AuUInt handle);
LSHandle(AuUInt handleRd, AuUInt handleWr);
virtual bool OnTrigger(AuUInt handle) override;
virtual const AuList<AuUInt> &GetHandles() override;
virtual AuUInt GetHandle() override;
virtual bool Singular() override;
#if defined(AURORA_IS_POSIX_DERIVED)
virtual const AuList<AuUInt> &GetWriteHandles() override;
virtual AuUInt GetWriteHandle() override;
void UpdateWriteHandle(AuUInt handle);
#endif
virtual ELoopSource GetType() override;
bool HasValidHandle();
void UpdateReadHandle(AuUInt handle);
protected:
AuUInt handle {kInvalidHandle};
#if defined(AURORA_IS_POSIX_DERIVED)
AuUInt handleWr {kInvalidHandle};
#endif
};
}