"""Support for simplified access to data on nodes of type omni.graph.nodes.ConcatenateFloat3Arrays

Flatten the array of float3 arrays in 'inputArrays' by concatenating all of the array  contents into a single float3 array
in 'outputArray'. The sizes of each of the input  arrays is preserved in the output 'arraySizes'.
"""

import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
import numpy
from typing import Any
class OgnConcatenateFloat3ArraysDatabase(og.Database):
    """Helper class providing simplified access to data on nodes of type omni.graph.nodes.ConcatenateFloat3Arrays

    Class Members:
        node: Node being evaluated

    Attribute Value Properties:
        Inputs:
            inputs.inputArrays
        Outputs:
            outputs.arraySizes
            outputs.outputArray
    """
    # This is an internal object that provides per-class storage of a per-node data dictionary
    PER_NODE_DATA = {}
    # This is an internal object that describes unchanging attributes in a generic way
    # The values in this list are in no particular order, as a per-attribute tuple
    #     Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
    #     Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
    # You should not need to access any of this data directly, use the defined database interfaces
    INTERFACE = og.Database._get_interface([
        ('inputs:inputArrays', 'any', 2, None, 'Array of arrays of float3 values to be flattened', {}, True, None, False, ''),
        ('outputs:arraySizes', 'int[]', 0, None, 'List of sizes of each of the float3 input arrays', {}, True, None, False, ''),
        ('outputs:outputArray', 'float3[]', 0, None, 'Flattened array of float3 values', {}, True, None, False, ''),
    ])
    class ValuesForInputs(og.DynamicAttributeAccess):
        LOCAL_PROPERTY_NAMES = { }
        """Helper class that creates natural hierarchical access to input attributes"""
        def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
            """Initialize simplified access for the attribute data"""
            context = node.get_graph().get_default_graph_context()
            super().__init__(context, node, attributes, dynamic_attributes)
            self._batchedReadAttributes = []
            self._batchedReadValues = []

        @property
        def inputArrays(self) -> og.RuntimeAttribute:
            """Get the runtime wrapper class for the attribute inputs.inputArrays"""
            return og.RuntimeAttribute(self._attributes.inputArrays.get_attribute_data(), self._context, True)

        @inputArrays.setter
        def inputArrays(self, value_to_set: Any):
            """Assign another attribute's value to outputs.inputArrays"""
            if isinstance(value_to_set, og.RuntimeAttribute):
                self.inputArrays.value = value_to_set.value
            else:
                self.inputArrays.value = value_to_set

        def _prefetch(self):
            readAttributes = self._batchedReadAttributes
            newValues = _og._prefetch_input_attributes_data(readAttributes)
            if len(readAttributes) == len(newValues):
                self._batchedReadValues = newValues
    class ValuesForOutputs(og.DynamicAttributeAccess):
        LOCAL_PROPERTY_NAMES = { }
        """Helper class that creates natural hierarchical access to output attributes"""
        def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
            """Initialize simplified access for the attribute data"""
            context = node.get_graph().get_default_graph_context()
            super().__init__(context, node, attributes, dynamic_attributes)
            self.arraySizes_size = None
            self.outputArray_size = None
            self._batchedWriteValues = { }

        @property
        def arraySizes(self):
            data_view = og.AttributeValueHelper(self._attributes.arraySizes)
            return data_view.get(reserved_element_count=self.arraySizes_size)

        @arraySizes.setter
        def arraySizes(self, value):
            data_view = og.AttributeValueHelper(self._attributes.arraySizes)
            data_view.set(value)
            self.arraySizes_size = data_view.get_array_size()

        @property
        def outputArray(self):
            data_view = og.AttributeValueHelper(self._attributes.outputArray)
            return data_view.get(reserved_element_count=self.outputArray_size)

        @outputArray.setter
        def outputArray(self, value):
            data_view = og.AttributeValueHelper(self._attributes.outputArray)
            data_view.set(value)
            self.outputArray_size = data_view.get_array_size()

        def _commit(self):
            _og._commit_output_attributes_data(self._batchedWriteValues)
            self._batchedWriteValues = { }
    class ValuesForState(og.DynamicAttributeAccess):
        """Helper class that creates natural hierarchical access to state attributes"""
        def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
            """Initialize simplified access for the attribute data"""
            context = node.get_graph().get_default_graph_context()
            super().__init__(context, node, attributes, dynamic_attributes)
    def __init__(self, node):
        super().__init__(node)
        dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
        self.inputs = OgnConcatenateFloat3ArraysDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
        dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
        self.outputs = OgnConcatenateFloat3ArraysDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
        dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
        self.state = OgnConcatenateFloat3ArraysDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
