Removes NodeableOutNative.h from Gems/ScriptCanvas

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2022-01-06 11:56:29 -08:00
parent 0e2af596b4
commit 48a5280b6d
9 changed files with 0 additions and 179 deletions
@@ -78,26 +78,6 @@ namespace ScriptCanvas
return output;
}
template<typename... t_Args, AZStd::size_t... Is>
Out CreateOutHelper(const AZStd::string& name, const AZStd::vector<AZStd::string>& outputNames, AZStd::index_sequence<Is...>)
{
Out out;
SetDisplayAndParsedName(out, name);
out.outputs.reserve(sizeof...(Is));
int dummy[]{ 0, (out.outputs.emplace_back(CreateOutput<t_Args>(outputNames[Is])), 0)... };
static_cast<void>(dummy); /* avoid warning for unused variable */
return out;
}
template<typename... t_Args>
Out CreateOut(const AZStd::string& name, const AZStd::vector<AZStd::string>& outputNames = {})
{
return CreateOutHelper<t_Args...>(name, outputNames, AZStd::make_index_sequence<sizeof...(t_Args)>());
}
template<typename t_Return, typename... t_Args, AZStd::size_t... Is>
Out CreateOutReturnHelper(const AZStd::string& name, const AZStd::string& returnName, const AZStd::vector<AZStd::string>& outputNames, AZStd::index_sequence<Is...>)
{
@@ -17,7 +17,6 @@
#include <ScriptCanvas/Core/NodeableOut.h>
#include <ScriptCanvas/Execution/Interpreted/ExecutionStateInterpreted.h>
#include <ScriptCanvas/Execution/Interpreted/ExecutionStateInterpretedUtility.h>
#include <ScriptCanvas/Execution/NodeableOut/NodeableOutNative.h>
#include <ScriptCanvas/Grammar/PrimitivesDeclarations.h>
#include <ScriptCanvas/Libraries/Math/MathNodeUtilities.h>
#include <ScriptCanvas/Utils/BehaviorContextUtils.h>
@@ -16,7 +16,6 @@
#include <ScriptCanvas/Core/NodeableOut.h>
#include <ScriptCanvas/Execution/ExecutionState.h>
#include <ScriptCanvas/Execution/ExecutionObjectCloning.h>
#include <ScriptCanvas/Execution/NodeableOut/NodeableOutNative.h>
#include <ScriptCanvas/Grammar/PrimitivesDeclarations.h>
#include <ScriptCanvas/Libraries/Math/MathNodeUtilities.h>
#include <ScriptCanvas/Utils/BehaviorContextUtils.h>
@@ -18,7 +18,6 @@
#include <ScriptCanvas/Core/NodeableOut.h>
#include <ScriptCanvas/Execution/ExecutionState.h>
#include <ScriptCanvas/Execution/Interpreted/ExecutionStateInterpreted.h>
#include <ScriptCanvas/Execution/NodeableOut/NodeableOutNative.h>
#include <ScriptCanvas/Grammar/PrimitivesDeclarations.h>
#include "ExecutionInterpretedOut.h"
@@ -17,7 +17,6 @@
#include <ScriptCanvas/Core/Nodeable.h>
#include <ScriptCanvas/Core/NodeableOut.h>
#include <ScriptCanvas/Execution/ExecutionState.h>
#include <ScriptCanvas/Execution/NodeableOut/NodeableOutNative.h>
#include <ScriptCanvas/Grammar/PrimitivesDeclarations.h>
#include "ExecutionInterpretedAPI.h"
@@ -1,66 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <AzCore/std/allocator.h>
#include <AzCore/std/allocator_static.h>
#include <AzCore/std/typetraits/internal/type_sequence_traits.h>
#include <ScriptCanvas/Core/NodeableOut.h>
namespace ScriptCanvas
{
namespace Execution
{
template<typename Callable, typename Allocator, typename... Args, size_t... IndexSequence>
FunctorOut CreateOutWithArgs(Callable&& callable, Allocator& allocator, AZStd::Internal::pack_traits_arg_sequence<Args...>, std::index_sequence<IndexSequence...>, ReturnTypeIsNotVoid)
{
auto nodeCallWrapper = [callable = AZStd::forward<Callable>(callable)](AZ::BehaviorValueParameter* result, AZ::BehaviorValueParameter* arguments, int numArguments) mutable
{
[[maybe_unused]] constexpr size_t numFunctorArguments = sizeof...(Args);
(void)numArguments;
AZ_Assert(numArguments == numFunctorArguments, "number of arguments doesn't match number of parameters");
AZ_Assert(result, "no null result allowed");
result->StoreResult(AZStd::invoke(callable, *arguments[IndexSequence].GetAsUnsafe<Args>()...));
};
static_assert(!AZStd::is_same_v<Allocator, StackAllocatorType> || sizeof(nodeCallWrapper) <= MaxNodeableOutStackSize, "Lambda is too large to fit within NodebleOut functor");
return FunctorOut(AZStd::move(nodeCallWrapper), allocator);
}
template<typename Callable, typename Allocator, typename... Args, size_t... IndexSequence>
FunctorOut CreateOutWithArgs(Callable&& callable, Allocator& allocator, AZStd::Internal::pack_traits_arg_sequence<Args...>, std::index_sequence<IndexSequence...>, ReturnTypeIsVoid)
{
auto nodeCallWrapper = [callable = AZStd::forward<Callable>(callable)](AZ::BehaviorValueParameter*, AZ::BehaviorValueParameter* arguments, int numArguments) mutable
{
[[maybe_unused]] constexpr size_t numFunctorArguments = sizeof...(Args);
(void)numArguments;
AZ_Assert(numArguments == numFunctorArguments, "number of arguments doesn't match number of parameters");
AZStd::invoke(callable, *arguments[IndexSequence].GetAsUnsafe<Args>()...);
};
static_assert(!AZStd::is_same_v<Allocator, StackAllocatorType> || sizeof(nodeCallWrapper) <= MaxNodeableOutStackSize, "Lambda is too large to fit within NodebleOut functor");
return FunctorOut(AZStd::move(nodeCallWrapper), allocator);
}
template<typename Callable, typename Allocator>
FunctorOut CreateOut(Callable&& callable, Allocator& allocator)
{
using CallableTraits = AZStd::function_traits<AZStd::remove_cvref_t<Callable>>;
return CreateOutWithArgs
( AZStd::forward<Callable&&>(callable)
, allocator
, typename CallableTraits::arg_types{}
, typename CallableTraits::template expand_args<std::index_sequence_for>{}
, typename AZStd::is_void<typename CallableTraits::return_type>::type{});
}
}
}
@@ -111,7 +111,6 @@ set(FILES
Include/ScriptCanvas/Execution/Interpreted/ExecutionStateInterpretedPure.h
Include/ScriptCanvas/Execution/Interpreted/ExecutionStateInterpretedSingleton.h
Include/ScriptCanvas/Execution/Interpreted/ExecutionStateInterpretedUtility.h
Include/ScriptCanvas/Execution/NodeableOut/NodeableOutNative.h
Include/ScriptCanvas/Grammar/AbstractCodeModel.h
Include/ScriptCanvas/Grammar/DebugMap.h
Include/ScriptCanvas/Grammar/ExecutionTraversalListeners.h
@@ -14,7 +14,6 @@
#include <ScriptCanvas/Core/SubgraphInterfaceUtility.h>
#include <ScriptCanvas/Core/Nodeable.h>
#include <ScriptCanvas/Execution/Interpreted/ExecutionInterpretedAPI.h>
#include <ScriptCanvas/Execution/NodeableOut/NodeableOutNative.h>
#include <Source/Framework/ScriptCanvasTestFixture.h>
#include <Source/Framework/ScriptCanvasTestNodes.h>
#include <Source/Framework/ScriptCanvasTestUtilities.h>
@@ -14,7 +14,6 @@
#include <ScriptCanvas/Core/SubgraphInterfaceUtility.h>
#include <ScriptCanvas/Core/Nodeable.h>
#include <ScriptCanvas/Execution/Interpreted/ExecutionInterpretedAPI.h>
#include <ScriptCanvas/Execution/NodeableOut/NodeableOutNative.h>
#include <Source/Framework/ScriptCanvasTestFixture.h>
#include <Source/Framework/ScriptCanvasTestNodes.h>
#include <Source/Framework/ScriptCanvasTestUtilities.h>
@@ -25,92 +24,6 @@ using namespace ScriptCanvasTests;
using namespace TestNodes;
using namespace ScriptCanvas::Execution;
// TEST_F(ScriptCanvasTestFixture, NativeNodeableStack)
// {
// TestNodeableObject nodeable;
// nodeable.Initialize();
//
// bool wasTrueCalled = false;
// bool wasFalseCalled = false;
//
// nodeable.SetExecutionOut
// ( AZ_CRC("BranchTrue", 0xd49f121c)
// , CreateOut
// ([&wasTrueCalled](ExecutionState&, Data::BooleanType condition, const Data::StringType& message)
// {
// EXPECT_TRUE(condition);
// EXPECT_EQ(message, AZStd::string("called the true version!"));
// wasTrueCalled = true;
// }
// , StackAllocatorType{}));
//
// nodeable.SetExecutionOut
// ( AZ_CRC("BranchFalse", 0xaceca8bc)
// , CreateOut
// ([&wasFalseCalled](ExecutionState&, Data::BooleanType condition, const Data::StringType& message, const Data::Vector3Type& vector)
// {
// EXPECT_FALSE(condition);
// EXPECT_EQ(message, AZStd::string("called the false version!"));
// EXPECT_EQ(vector, AZ::Vector3(1, 2, 3));
// wasFalseCalled = true;
// }
// , StackAllocatorType{}));
//
// nodeable.Branch(true);
// nodeable.Branch(false);
//
// EXPECT_TRUE(wasTrueCalled);
// EXPECT_TRUE(wasFalseCalled);
// }
//
// TEST_F(ScriptCanvasTestFixture, NativeNodeableHeap)
// {
// TestNodeableObject nodeable;
// nodeable.Initialize();
//
// AZStd::string routedArg("XYZ");
// AZStd::array<int, 2048> bigArray;
// std::fill(bigArray.begin(), bigArray.end(), 0);
//
// bigArray[0] = 7;
// bigArray[2047] = 7;
//
// EXPECT_EQ(bigArray[0], 7);
// EXPECT_EQ(bigArray[2047], 7);
//
// bool isHeapCalled = false;
//
// nodeable.SetExecutionOut
// ( AZ_CRC("BranchTrue", 0xd49f121c)
// , CreateOut
// ([routedArg, &isHeapCalled, bigArray](ExecutionState&, Data::BooleanType condition, const Data::StringType& message) mutable
// {
// EXPECT_EQ(message, AZStd::string("called the true version!"));
// routedArg = message;
// isHeapCalled = true;
// EXPECT_EQ(bigArray[0], 7);
// EXPECT_EQ(bigArray[2047], 7);
// bigArray[0] = 9;
// bigArray[2047] = 9;
// EXPECT_EQ(bigArray[0], 9);
// EXPECT_EQ(bigArray[2047], 9);
// }
// , HeapAllocatorType{}));
//
//
// bigArray[0] = 8;
// bigArray[2047] = 8;
// EXPECT_EQ(bigArray[0], 8);
// EXPECT_EQ(bigArray[2047], 8);
//
// nodeable.Branch(true);
// EXPECT_TRUE(isHeapCalled);
//
// // just making sure no crash occurs on unconnected outs
// nodeable.Branch(false);
// }
class Grandparent
{
public: