Package VisionEgg :: Class ClassWithParameters
[frames] | no frames]

Class ClassWithParameters

source code

object --+
         |
        ClassWithParameters

Base class for any class that uses parameters.

Any class that uses parameters potentially modifiable in realtime
should be a subclass of ClassWithParameters.  This class enforces
type checking and sets default values.

Any subclass of ClassWithParameters can define two class (not
instance) attributes, "parameters_and_defaults" and
"constant_parameters_and_defaults". These are dictionaries where
the key is a string containing the name of the parameter and the
the value is a tuple of length 2 containing the default value and
the type.  For example, an acceptable dictionary would be
{"parameter1" : (1.0, ve_types.Real)}

See the ParameterTypes module for more information about types.



Instance Methods
 
__getstate__(self)
support for being pickled
source code
 
__setstate__(self, dict)
support for being unpickled
source code
 
__init__(self, **kw)
Create self.parameters and set values.
source code
 
is_constant_parameter(self, parameter_name) source code
 
get_specified_type(self, parameter_name) source code
 
verify_parameters(self)
Perform type check on all parameters
source code
 
set(self, **kw)
Set a parameter with type-checked value This is the slow but safe way to set parameters.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables
  parameters_and_defaults = ParameterDefinition({})
  constant_parameters_and_defaults = ParameterDefinition({})
  __safe_for_unpickling__ = True
Properties

Inherited from object: __class__

Method Details

__init__(self, **kw)
(Constructor)

source code 
Create self.parameters and set values.

Overrides: object.__init__

set(self, **kw)

source code 
Set a parameter with type-checked value

This is the slow but safe way to set parameters.  It is recommended to
use this method in all but speed-critical portions of code.