示例#1
0
 // Find the hardwareId for the first instance of a given function class
 internal virtual string imm_getFirstHardwareId(string className)
 {
     if (!_yctx._BaseType.ContainsKey(className))
     {
         YFunctionType ft = imm_getFnByType(className);
         YPEntry       yp = ft.imm_getFirstYPEntry();
         if (yp == null)
         {
             return(null);
         }
         return(yp.HardwareId);
     }
     else
     {
         // using an abstract baseType
         YPEntry.BaseClass baseType = _yctx._BaseType[className];
         foreach (YFunctionType subClassType in _fnByType.Values)
         {
             YPEntry yp = subClassType.imm_getFirstYPEntry();
             if (yp != null && yp.getBaseClass().Equals(baseType))
             {
                 return(yp.HardwareId);
             }
         }
         return(null);
     }
 }
示例#2
0
 // Find the hardwareId for the next instance of a given function class
 internal virtual string imm_getNextHardwareId(string className, string hwid)
 {
     if (!_yctx._BaseType.ContainsKey(className))
     {
         YFunctionType ft = imm_getFnByType(className);
         YPEntry       yp = ft.imm_getNextYPEntry(hwid);
         if (yp == null)
         {
             return(null);
         }
         return(yp.HardwareId);
     }
     else
     {
         // enumeration of an abstract class
         YPEntry.BaseClass baseType  = _yctx._BaseType[className];
         string            prevclass = YAPIContext.imm_functionClass(hwid);
         YPEntry           res       = imm_getFnByType(prevclass).imm_getNextYPEntry(hwid);
         if (res != null)
         {
             return(res.HardwareId);
         }
         foreach (string altClassName in _fnByType.Keys)
         {
             if (!prevclass.Equals(""))
             {
                 if (!altClassName.Equals(prevclass))
                 {
                     continue;
                 }
                 prevclass = "";
                 continue;
             }
             YFunctionType functionType = _fnByType[altClassName];
             res = functionType.imm_getFirstYPEntry();
             if (res != null && res.getBaseClass().Equals(baseType))
             {
                 return(res.HardwareId);
             }
         }
         return(null);
     }
 }