Package EaseXML :: Module classregistry :: Class ClassRegistry
[show private | hide private]
[frames | no frames]

Type ClassRegistry

object --+
         |
        ClassRegistry


We'll be dealing with classes that reference each other, so class C1 may reference C2 (in a join), while C2 references C1 right back. Since classes are created in an order, there will be a point when C1 exists but C2 doesn't. So we deal with classes by name, and after each class is created we try to fix up any references by replacing the names with actual classes.

Here we keep a dictionaries of class names to classes -- note that the classes might be spread among different modules, so since we pile them together names need to be globally unique, to just module unique. Like needSet below, the container dictionary is keyed by the class registry.


Method Summary
  __init__(self, name)
  addClass(self, cls)
Everytime a class is created, we add it to the registry, so that other classes can find it by name.
  addClassCallback(self, className, callback, *args, **kw)
Whenever a name is substituted for the class, you can register a callback that will be called when the needed class is created.
  allClasses(self)
  dump(self)
  getClass(self, className)
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Method Details

addClass(self, cls)

Everytime a class is created, we add it to the registry, so that other classes can find it by name. We also call any callbacks that are waiting for the class.

addClassCallback(self, className, callback, *args, **kw)

Whenever a name is substituted for the class, you can register a callback that will be called when the needed class is created. If it's already been created, the callback will be called immediately.

Generated by Epydoc 2.1 on Sun Dec 12 17:20:24 2004 http://epydoc.sf.net