// Copyright (c) 2022, 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 <OgnEndsWithDatabase.h>

#include <algorithm>

namespace omni
{
namespace graph
{
namespace nodes
{

class OgnEndsWith
{
public:
    static bool compute(OgnEndsWithDatabase& db)
    {
        auto const& suffix = db.inputs.suffix();
        auto const& value = db.inputs.value();
        auto iters = std::mismatch(suffix.rbegin(), suffix.rend(), value.rbegin(), value.rend());
        db.outputs.isSuffix() = (iters.first == suffix.rend());
        return true;
    }
};

REGISTER_OGN_NODE();

} // nodes
} // graph
} // omni
