next up previous index
Next: Required Method compute() Up: Implementation Previous: Implementation   Index


Creating a Variable Object

An instance of an existing variable class is created using the method get_variable() of the class VariableFactory. It takes as arguments the variable name and the dataset which the variable belongs to. It performs template matching of the name and invokes the constructor of the corresponding variable. If there were any templates replaced by SSS or DDD, they are passed to the constructor in order as they appear in the name. It then calls the Variable method set_dataset() which sets the given dataset as a class attribute dataset of the variable. Thus, using the Variable method get_dataset() each variable object has an access to its ``owner'' dataset.

The VariableFactory method get_variable() returns an instance of the created variable class.

Variable objects are created automatically within the dataset method compute_variables() and stored in attribute boxes (Section 22.1.6).


next up previous index
Next: Required Method compute() Up: Implementation Previous: Implementation   Index
info (at) urbansim.org