AuroraRuntime/Source/IO/IPC/AuIPCPipeReader.cpp

54 lines
1.1 KiB
C++

/***
Copyright (C) 2023 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AuIPCPipeReader.cpp
Date: 2023-10-21
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>
#include "IPC.hpp"
#include "AuIPCHandle.hpp"
#include "AuIPCPipeReader.hpp"
namespace Aurora::IO::IPC
{
IPCPipeReader::IPCPipeReader(IPCPipe *pPipe) :
pParent(pPipe)
{
}
EStreamError IPCPipeReader::IsOpen()
{
if (this->pParent->AsReadChannelHasData()->IsSignaled())
{
return EStreamError::eErrorNone;
}
auto pOpenChannel = this->pParent->AsReadChannelIsOpen();
if (!pOpenChannel &&
pOpenChannel->IsSignaled())
{
return EStreamError::eErrorNone;
}
return EStreamError::eErrorStreamNotOpen;
}
EStreamError IPCPipeReader::Read(const Memory::MemoryViewStreamWrite &parameters)
{
parameters.outVariable = 0;
if (this->pParent->Read(parameters, true))
{
return EStreamError::eErrorNone;
}
return EStreamError::eErrorStreamInterrupted;
}
void IPCPipeReader::Close()
{
}
}