October3d55/M/LowEntryExtStdLib/Source/LowEntryExtendedStandardLib.../Private/Classes/LowEntryExecutionQueue.cpp

47 lines
853 B
C++

// Copyright Low Entry. Apache License, Version 2.0.
#include "LowEntryExecutionQueue.h"
ULowEntryExecutionQueue::ULowEntryExecutionQueue(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) {}
ULowEntryExecutionQueue* ULowEntryExecutionQueue::Create()
{
return NewObject<ULowEntryExecutionQueue>();
}
ULowEntryExecutionQueue* ULowEntryExecutionQueue::Create(const int32 Count, const bool Next)
{
ULowEntryExecutionQueue* Instance = NewObject<ULowEntryExecutionQueue>();
Instance->Count = Count;
Instance->Next = Next;
if (Count > 0)
{
Instance->AddToRoot();
}
return Instance;
}
void ULowEntryExecutionQueue::IncreaseCount()
{
Count++;
if (Count == 1)
{
AddToRoot();
}
}
void ULowEntryExecutionQueue::DecreaseCount()
{
Count--;
if (Count == 0)
{
RemoveFromRoot();
}
if (Count < 0)
{
Count = 0;
}
}