// Copyright (c) 2020, 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 "OgnArrayLengthDatabase.h"

namespace omni
{
namespace graph
{
namespace core
{

class OgnArrayLength
{
public:
    // Outputs the length of a specified array attribute in an input prim,
    // or 1 if the attribute is not an array attribute.
    static bool compute(OgnArrayLengthDatabase& db)
    {
        auto bundledAttribute = db.inputs.data().attributeByName(db.inputs.attrName());
        db.outputs.length() = bundledAttribute.isValid() ? bundledAttribute.size() : 0;

        return true;
    }
};

REGISTER_OGN_NODE()

}
}
}
