plcopen/structures.py
changeset 98 ec5d7af033d8
parent 93 c3c24b979a4d
child 99 2b18a72dcaf0
equal deleted inserted replaced
97:28337cd092fd 98:ec5d7af033d8
   260 """
   260 """
   261 returns true if the given data type is the same that "reference" meta-type or one of its types.
   261 returns true if the given data type is the same that "reference" meta-type or one of its types.
   262 """
   262 """
   263 
   263 
   264 def IsOfType(test, reference):
   264 def IsOfType(test, reference):
   265     while test != None:
   265     if reference is None:
       
   266         return True
       
   267     while test is not None:
   266         if test == reference:
   268         if test == reference:
   267             return True
   269             return True
   268         test = TypeHierarchy[test]
   270         test = TypeHierarchy[test]
   269     return False
   271     return False
   270 
   272 
   271 """
   273 """
   272 returns list of all types that correspont to the ANY* meta type
   274 returns list of all types that correspont to the ANY* meta type
   273 """
   275 """
   274 def GetSubTypes(reference):
   276 def GetSubTypes(reference):
   275     return [ typename for typename, parenttype in TypeHierarchy_list if typename[:3] != "ANY" and IsOfType(typename, reference)]
   277     return [typename for typename, parenttype in TypeHierarchy_list if typename[:3] != "ANY" and IsOfType(typename, reference)]
   276 
   278 
   277 
   279 
   278 #-------------------------------------------------------------------------------
   280 #-------------------------------------------------------------------------------
   279 #                             Test identifier
   281 #                             Test identifier
   280 #-------------------------------------------------------------------------------
   282 #-------------------------------------------------------------------------------