API Reference for Enthought Tool Suite 3.2.0

Contains and generates all the class tree information.

On initialization of the instance, nothing is done. The classes are obtained using the list of modules (or a single module) that is used to initialize the instance. One must then call the create method to generate the tree structure. The instance of the class also can be treated as an iterator which iterates over the nodes of the tree.

There are two ways in which the tree hierarchy is stored. A dictionary mapping class names to the tree node and a tree represented as a list of lists containing the nodes. The tree is organized based on a concept of an inheritance level. A class that has no parent classes (no base classes) is said to be at level zero. If a class inherits successively from 7 classes, it is at level 6. An example of inheritance for a vtkFoo class is given below:

vtkFoo -> vtkBar -> vtkObject -> vtkObjectBase

Here, vtkObjectBase has an inheritance level of 0 and vtkFoo a level of 3. One can traverse the tree by using the level as an index and find all the classes at a particular level.

Here is some example usage of this class:

>>> import vtk
>>> t = ClassTree(vtk)
>>> t.create()
>>> print t.get_node('vtkObject').name
vtkObject
>>> print t.get_node('vtkObject').parents[0].name
vtkObjectBase
>>> print len(t.tree[0])
1
>>> t.tree[0][0].name
vtkObjectBase

Method summary

Methods

© Copyright 2002-2009 Enthought, Inc.