49d48
< import inspect
69a69,78
> allParams = {}
>
> class MetaParamValue(type):
> def __new__(mcls, name, bases, dct):
> cls = super(MetaParamValue, mcls).__new__(mcls, name, bases, dct)
> assert name not in allParams
> allParams[name] = cls
> return cls
>
>
72a82
> __metaclass__ = MetaParamValue
122,131c132,136
< try:
< ptype = SimObject.allClasses[self.ptype_str]
< if not isinstance(ptype, type):
< raise NameError
< self.ptype = ptype
< return ptype
< except NameError:
< raise
< #raise TypeError, \
< # "Param qualifier '%s' is not a type" % self.ptype_str
---
> ptype = SimObject.allClasses[self.ptype_str]
> assert issubclass(ptype, SimObject.SimObject)
> self.ptype = ptype
> return ptype
>
162a168
> __metaclass__ = MetaParamValue
220d225
< caller_frame = inspect.currentframe().f_back
223,228c228,229
< ptype = eval(self.ptype_str,
< caller_frame.f_globals, caller_frame.f_locals)
< if not isinstance(ptype, type):
< raise TypeError, \
< "Param qualifier is not a type: %s" % ptype
< except NameError:
---
> ptype = allParams[self.ptype_str]
> except KeyError:
303c304
< class CheckedIntType(type):
---
> class CheckedIntType(MetaParamValue):
427c428
< class MetaRange(type):
---
> class MetaRange(MetaParamValue):
668c669
< class MetaEnum(type):
---
> class MetaEnum(MetaParamValue):