Search code examples
autosar

AUTOSAR: detect two dimensional array in model


How can I detect if an ImplementationDataTypeElement is an array that has arrays (even through typedefs) in it?

I can detect one dimensional array by detecting if category is "ARRAY" but how do I get the further "definitions"?


Solution

  • If the ImplementationDataTypeElement owned by an ImplementationDataType of category ARRAY is again of category ARRAY than you have a clear indication for a two-dimensional array.

    If the ImplementationDataTypeElement is of category TYPE_REFERENCE then you have to look at the ImplementationDataType that is referenced by means of ImplementationDataTypeElement.swDataDefProps.implementationDataType.

    If the referenced ImplementationDataType is of category ARRAY then this is also an indication for the definition of a two-dimensional array.