2023-12-28 16:49:11 +00:00
|
|
|
/***
|
|
|
|
Copyright (C) 2023 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
|
|
|
|
File: CompletionGroupLoopSource.cpp
|
|
|
|
Date: 2023-12-28
|
|
|
|
Author: Reece
|
|
|
|
***/
|
|
|
|
#include <Source/RuntimeInternal.hpp>
|
|
|
|
#include <Aurora/IO/IOExperimental.hpp>
|
|
|
|
#include "CompletionGroup.hpp"
|
|
|
|
#include "CompletionGroupLoopSource.hpp"
|
|
|
|
|
|
|
|
namespace Aurora::IO::CompletionGroup
|
|
|
|
{
|
|
|
|
CompletionGroupLoopSource::CompletionGroupLoopSource(CompletionGroup *pParent, bool bAnd) :
|
|
|
|
pParent(pParent),
|
|
|
|
bIsAnd(bAnd),
|
|
|
|
Loop::LSEvent()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
bool CompletionGroupLoopSource::IsSignaled()
|
|
|
|
{
|
|
|
|
if (!Loop::LSEvent::IsSignaled())
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2024-01-11 12:19:54 +00:00
|
|
|
this->pParent->DoIOTick(false);
|
2023-12-28 16:49:11 +00:00
|
|
|
|
|
|
|
if (this->bIsAnd)
|
|
|
|
{
|
|
|
|
return !this->pParent->HasItemsActive();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CompletionGroupLoopSource::OnTrigger(AuUInt handle)
|
|
|
|
{
|
|
|
|
if (!Loop::LSEvent::OnTrigger(handle))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2024-01-11 12:19:54 +00:00
|
|
|
this->pParent->DoIOTick(false);
|
2023-12-28 16:49:11 +00:00
|
|
|
|
|
|
|
if (this->bIsAnd)
|
|
|
|
{
|
2024-03-05 21:50:45 +00:00
|
|
|
if (!this->pParent->HasItemsActive())
|
|
|
|
{
|
|
|
|
this->pParent->ResetAnd();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2023-12-28 16:49:11 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CompletionGroupLoopSource::DoInit(bool bSignaledAlready)
|
|
|
|
{
|
|
|
|
return this->TryInit(bSignaledAlready, true, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
Loop::ELoopSource CompletionGroupLoopSource::GetType()
|
|
|
|
{
|
|
|
|
return Loop::ELoopSource::eSourceCompletionGroup;
|
|
|
|
}
|
|
|
|
}
|