Exemplo n.º 1
0
        private void AddSimpleDataTypeDefaultValue(PimDefaultValuesList newDefValuesList, String baseName, Boolean IsArray, String FieldName, int arraySize)
        {
            String additionalInfo = "";

            if ((IsArray))
            {
                if (arraySize > 0)
                {
                    additionalInfo = "[" + arraySize.ToString() + "]";
                }
                else
                {
                    additionalInfo = "*";
                }
            }

            PimDefaultValue defValue = PimFabric.GetInstance().CreatePimDefaultValue();

            defValue.DefaultValue = "";
            defValue.FieldGuid    = Guid.Empty;
            if (baseName.Length > 0)
            {
                defValue.Name = baseName + "." + FieldName + additionalInfo;
            }
            else
            {
                defValue.Name = FieldName + additionalInfo;
            }
            newDefValuesList.Add(defValue);
        }
Exemplo n.º 2
0
        public PimDefaultValuesList CollectAllPimValuesForGrid()
        {
            PimDefaultValuesList defsList = new PimDefaultValuesList();

            foreach (PimInstance pim in this)
            {
                defsList.AddRange(pim.DefaultValues);
            }
            return(defsList);
        }
Exemplo n.º 3
0
 bool FindName(PimDefaultValuesList newDefValuesList, String nameToFind)
 {
     foreach (PimDefaultValue pimDefValue in newDefValuesList)
     {
         if (pimDefValue.Name.Equals(nameToFind))
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 4
0
        public void UpdateDefaultValues()
        {
            this.Name = Defenition.Name;

            PimDefaultValuesList newDefValuesList = new PimDefaultValuesList();

            /* Create new list */
            object datatype = AutosarApplication.GetInstance().GetDataType(Defenition.DatatypeGuid);

            if (datatype != null)
            {
                if ((datatype is BaseDataType) || (datatype is SimpleDataType) || (datatype is EnumDataType) || (datatype is ArrayDataType))
                {
                    AddSimpleDataTypeDefaultValue(newDefValuesList, "", false, Name, 0);
                }
                else if (datatype is ComplexDataType)
                {
                    ComplexDataType compDataType = (ComplexDataType)datatype;
                    foreach (ComplexDataTypeField field in compDataType.Fields)
                    {
                        if (AutosarApplication.GetInstance().IsDataTypeComlex(field.DataTypeGUID))
                        {
                            AddComplexDataTypeFields(newDefValuesList, Name + "." + field.Name, field);
                        }
                        else
                        {
                            AddComplexDataTypeFieldDefaultValue(newDefValuesList, Name, field);
                        }
                    }
                }
            }

            /* Remove unexists */
            for (int i = DefaultValues.Count - 1; i >= 0; i--)
            {
                if (FindName(newDefValuesList, DefaultValues[i].Name) == false)
                {
                    DefaultValues.RemoveAt(i);
                }
            }

            /* Add new */
            {
                foreach (PimDefaultValue pimDefValue in newDefValuesList)
                {
                    if (FindName(DefaultValues, pimDefValue.Name) == false)
                    {
                        DefaultValues.Add(pimDefValue);
                    }
                }
            }
        }
Exemplo n.º 5
0
        private void AddComplexDataTypeFields(PimDefaultValuesList newDefValuesList, String baseName, ComplexDataTypeField field)
        {
            object datatype = AutosarApplication.GetInstance().GetDataType(field.DataTypeGUID);

            ComplexDataType compDataType = (ComplexDataType)datatype;

            foreach (ComplexDataTypeField cmplfield in compDataType.Fields)
            {
                if (AutosarApplication.GetInstance().IsDataTypeComlex(cmplfield.DataTypeGUID))
                {
                    AddComplexDataTypeFields(newDefValuesList, baseName + "." + cmplfield.Name, cmplfield);
                }
                else
                {
                    AddComplexDataTypeFieldDefaultValue(newDefValuesList, baseName, cmplfield);
                }
            }
        }
        void UpdateControls()
        {
            if (component != null)
            {
                componentNameTextBox.Text       = component.Name;
                componentDefenitionTextBox.Text = component.ComponentDefenition.Name;

                /* Pims */
                currentPimDefaultList = component.PerInstanceMemories.CollectAllPimValuesForGrid();

                perInstanceGrid.ItemsSource = null;
                perInstanceGrid.ItemsSource = currentPimDefaultList;

                /* CData */
                currentCDataDefalutList = component.CDataInstances.CollectAllCDataValuesForGrid();

                CDataGrid.ItemsSource = null;
                CDataGrid.ItemsSource = currentCDataDefalutList;
            }
        }
Exemplo n.º 7
0
        private void AddComplexDataTypeFieldDefaultValue(PimDefaultValuesList newDefValuesList, String baseName, ComplexDataTypeField cmplfield)
        {
            String additionalInfo = "";

            if (cmplfield.IsPointer)
            {
                additionalInfo = "*";
            }

            PimDefaultValue defValue = PimFabric.GetInstance().CreatePimDefaultValue();

            defValue.DefaultValue = "";
            defValue.FieldGuid    = cmplfield.GUID;
            if (baseName.Length > 0)
            {
                defValue.Name = baseName + "." + cmplfield.Name + additionalInfo;
            }
            else
            {
                defValue.Name = cmplfield.Name + additionalInfo;
            }
            newDefValuesList.Add(defValue);
        }