private int[] ExtractCombinedDimensions(ref AttributeExtCollection attrColl, IdlArrayAttribute innerAttribute) { attrColl = attrColl.RemoveAttribute(innerAttribute); IList dimensionAttributes; attrColl = attrColl.RemoveAssociatedAttributes(innerAttribute.OrderNr, out dimensionAttributes); int[] dimensions = new int[2 + dimensionAttributes.Count]; // 1 for this dimension, 1 for the old first dimension + those for the dimensionAttributes dimensions[0] = m_length; dimensions[1] = innerAttribute.FirstDimensionSize; for (int i = 0; i < dimensionAttributes.Count; i++) { dimensions[((IdlArrayDimensionAttribute)dimensionAttributes[i]).DimensionNr + 1] = ((IdlArrayDimensionAttribute)dimensionAttributes[i]).DimensionSize; // shift rigth } return dimensions; }
private int[] DetermineIdlArrayDimensions(Type clsType, IdlArrayAttribute arrayAttr, ref AttributeExtCollection modifiedAttributes) { // get all the array dimensions, first is inside the IDLArrayAttribute; others are separate int[] dimensions = new int[clsType.GetArrayRank()]; if (dimensions.Length < 1) { throw new INTERNAL(5643, CompletionStatus.Completed_MayBe); // should never occur } dimensions[0] = arrayAttr.FirstDimensionSize; if (dimensions.Length > 1) { IList dimensionAttrs; modifiedAttributes = modifiedAttributes.RemoveAssociatedAttributes(arrayAttr.OrderNr, out dimensionAttrs); if (dimensionAttrs.Count != dimensions.Length - 1) { throw new INTERNAL(5644, CompletionStatus.Completed_MayBe); // should never occur } for (int i = 0; i < dimensionAttrs.Count; i++) { IdlArrayDimensionAttribute arrayDim = ((IdlArrayDimensionAttribute)dimensionAttrs[i]); dimensions[arrayDim.DimensionNr] = arrayDim.DimensionSize; } } return dimensions; }