// Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto.  Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//

#include <OgnBranchDatabase.h>
#include <omni/graph/action/IActionGraph.h>

namespace omni
{
namespace graph
{
namespace action
{

class OgnBranch
{
public:
    static bool compute(OgnBranchDatabase& db)
    {
        auto iActionGraph = getInterface();
        bool condition = db.inputs.condition();

        if (condition)
            iActionGraph->setExecutionEnabled(outputs::execTrue.token(), db.getInstanceIndex());
        else
            iActionGraph->setExecutionEnabled(outputs::execFalse.token(), db.getInstanceIndex());

        return true;
    }
};

REGISTER_OGN_NODE()
} // action
} // graph
} // omni
