diff options
author | rcoh <rcoh@mit.edu> | 2010-12-20 15:42:13 -0500 |
---|---|---|
committer | rcoh <rcoh@mit.edu> | 2010-12-20 15:42:13 -0500 |
commit | a1d9b85320c9b07d62470d78ef0c5f9015baf813 (patch) | |
tree | 8df16aec8de793ba0f2e4b330b764a6f6a49f59a /util/ComponentRegistry.py | |
parent | 17577b1b19387b2cefb7ac777ed1323dd36be086 (diff) | |
parent | 2736307c1d6d67868ca54a3df951f9e959efedd0 (diff) |
Merge branch 'master' into pixelregions
Conflicts:
Util.py
pixelmappers/SimpleMapper.py
Diffstat (limited to 'util/ComponentRegistry.py')
-rw-r--r-- | util/ComponentRegistry.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/util/ComponentRegistry.py b/util/ComponentRegistry.py new file mode 100644 index 0000000..f8fe00d --- /dev/null +++ b/util/ComponentRegistry.py @@ -0,0 +1,17 @@ +import pdb +#Registry of all components of the light system +#TODO: pick a graceful failure behavior and implement it +registry = {} +def registerComponent(component, cid=None): + if cid != None: + registry[cid] = component + else: + try: + cid = component['Id'] + registry[cid] = component + except: + raise Exception('Must specify Id, component did not store it') +def removeComponent(cid): + registry.pop(cid) +def getComponent(cid): + return registry[cid] |