Example #1
0
 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;
 }
 /// <summary>
 /// call the appropriate mapping action for a CLSType array
 /// </summary>
 private object CallActionForDNArray(ref Type clsType,
                                     ref AttributeExtCollection modifiedAttributes, 
                                     AttributeExtCollection allAttributes,                                            
                                     MappingAction action) {
     // distinguish the different cases here
     Attribute idlMappingAttr = modifiedAttributes.GetHighestOrderAttribute();
     if (idlMappingAttr is IdlSequenceAttribute) {
         modifiedAttributes = modifiedAttributes.RemoveAttribute(idlMappingAttr);
         int bound = (int)
             ((IdlSequenceAttribute)idlMappingAttr).Bound;
         return action.MapToIdlSequence(clsType, bound, allAttributes, modifiedAttributes);
     } else if (idlMappingAttr is IdlArrayAttribute) {
         IdlArrayAttribute arrayAttr = (IdlArrayAttribute)idlMappingAttr;
         modifiedAttributes = modifiedAttributes.RemoveAttribute(idlMappingAttr);
         int[] dimensions = DetermineIdlArrayDimensions(clsType, arrayAttr, ref modifiedAttributes);
         return action.MapToIdlArray(clsType, dimensions, allAttributes, modifiedAttributes);
     } else {
         Type boxed = GetBoxedArrayType(clsType);
         Type needsBoxingFrom = clsType;
         clsType = boxed; // transform
         return action.MapToIdlBoxedValueType(boxed, needsBoxingFrom);
     }
 }