Пример #1
0
        public static sinter_Variable makeNewVariable(sinter_Sim sim, string path)
        {
            sinter_Variable retVar = null;

            sinter.sinter_Variable.sinter_IOType vartype = sim.guessTypeFromSim(path);
            if (vartype == sinter.sinter_Variable.sinter_IOType.si_DOUBLE ||
                vartype == sinter.sinter_Variable.sinter_IOType.si_INTEGER ||
                vartype == sinter.sinter_Variable.sinter_IOType.si_STRING)
            {
                sinter_Variable previewVar    = new sinter_Variable();
                string[]        addressString = new string[1] {
                    path
                };
                previewVar.init(sim, vartype, addressString);
                previewVar.initializeUnits(sim);
                previewVar.initializeDescription(sim);
                retVar = previewVar;
            }
            else if (vartype == sinter.sinter_Variable.sinter_IOType.si_DOUBLE_VEC ||
                     vartype == sinter.sinter_Variable.sinter_IOType.si_INTEGER_VEC ||
                     vartype == sinter.sinter_Variable.sinter_IOType.si_STRING_VEC)
            {
                sinter_Vector previewVar    = new sinter_Vector();
                string[]      addressString = new string[1] {
                    path
                };
                previewVar.init(sim, vartype, addressString);
                previewVar.initializeUnits(sim);
                previewVar.initializeDescription(sim);
                retVar = previewVar;
            }
            return(retVar);
        }
Пример #2
0
 private void addIO(sinter_Variable.sinter_IOMode iomode, sinter_Variable.sinter_IOType type, string name, string desc, string[] addStrings, int[] bounds)
 {
     if (type == sinter_Variable.sinter_IOType.si_TABLE)
     {
         sinter_Table thisTable = new sinter_Table();
         if (bounds == null || bounds.Length < 2)
         {
             thisTable.init(name, iomode, desc, addStrings, 0, 0);
         }
         else
         {
             thisTable.init(name, iomode, desc, addStrings, bounds[0], bounds[1]);
         }
         addTable(thisTable);
     }
     else if (type == sinter_Variable.sinter_IOType.si_DOUBLE_VEC ||
              type == sinter_Variable.sinter_IOType.si_INTEGER_VEC ||
              type == sinter_Variable.sinter_IOType.si_STRING_VEC)
     {
         sinter_Vector o = new sinter_Vector();
         if (bounds == null || bounds.Length < 1)
         {
             o.init(name, iomode, type, desc, addStrings, 0);
         }
         else
         {
             o.init(name, iomode, type, desc, addStrings, bounds[0]);
         }
         addVariable(o);
     }
     else
     {
         sinter_Variable o = new sinter_Variable();
         o.init(name, iomode, type, desc, addStrings);
         if (o.isSetting)
         {
             addSetting(o);
         }
         else
         {
             addVariable(o);
         }
     }
 }