Public Member Functions | |
def | __init__ |
def | addInt |
def | addFloat |
def | addIntArray |
def | addFloatArray |
def | dump |
def | all_dict |
def | all |
def | __setattr__ |
def | add |
def | get |
Public Attributes | |
classForManaging | |
description | |
getParameter |
Manager for colection of Parameter's
Definition at line 196 of file Models.py.
def UserTagging::Models::ParameterSet::__init__ | ( | self | ) |
Definition at line 199 of file Models.py.
00199 : 00200 self.classForManaging = (Int, Float, IntArray, FloatArray) 00201 # description = {name: class} for bookkeeping the attribute 00202 self.description = {} 00203 self.getParameter = self.get # make alias 00204 00205 # ---------------------------------------
def UserTagging::Models::ParameterSet::addInt | ( | self, | ||
paraList | ||||
) |
def UserTagging::Models::ParameterSet::addFloat | ( | self, | ||
paraList | ||||
) |
Definition at line 211 of file Models.py.
00211 : 00212 for para in paraList: 00213 self.__setattr__(para, Float()) 00214 return self 00215 def addIntArray(self, *paraList):
def UserTagging::Models::ParameterSet::addIntArray | ( | self, | ||
paraList | ||||
) |
Definition at line 216 of file Models.py.
00216 : 00217 for para in paraList: 00218 self.__setattr__(para, IntArray()) 00219 return self 00220 def addFloatArray(self, *paraList):
def UserTagging::Models::ParameterSet::addFloatArray | ( | self, | ||
paraList | ||||
) |
def UserTagging::Models::ParameterSet::dump | ( | self | ) |
print all values in the parameter set
Definition at line 227 of file Models.py.
00227 : 00228 '''print all values in the parameter set''' 00229 for paraName, paraClass in self.description.items(): 00230 print paraName, "\t", self.__dict__[paraName] 00231 00232 # =========================================== class DataSet(ObjectSet):
def UserTagging::Manager::ObjectSet::all_dict | ( | self | ) | [inherited] |
return the dictionary of name:object of the managed classes
Definition at line 23 of file Manager.py.
00023 : 00024 '''return the dictionary of name:object of the managed classes''' 00025 return dict((name, self.__dict__[name]) for name in self.description) 00026 00027 # --------------------------------------- def all(self):
def UserTagging::Manager::ObjectSet::all | ( | self | ) | [inherited] |
return a list of objects of the managed classes
Definition at line 28 of file Manager.py.
00028 : 00029 '''return a list of objects of the managed classes''' 00030 return (self.__dict__[name] for name in self.description) 00031 00032 # --------------------------------------- def __setattr__(self, name, value):
def UserTagging::Manager::ObjectSet::__setattr__ | ( | self, | ||
name, | ||||
value | ||||
) | [inherited] |
Definition at line 33 of file Manager.py.
00033 : 00034 '''hook for caching a name of the Object as the class attribute''' 00035 object.__setattr__(self, name, value) 00036 if isinstance(value, self.classForManaging): 00037 # The attribute class is intentionally only intialized once. 00038 # This way, one can intialize an attribute with a specific class 00039 # but can later use intrisic python type to represent this class 00040 # see the implemetation of class ParameterSet for an example 00041 self.description.setdefault(name, value.__class__) 00042 00043 # # --------------------------------------- 00044 # def __getattr__(self, name): 00045 # '''hook for getting the Object given the attribute''' 00046 00047 # ---------------------------------------
def UserTagging::Manager::ObjectSet::add | ( | self, | ||
name, | ||||
anObject | ||||
) | [inherited] |
Add one Object
Definition at line 48 of file Manager.py.
00048 : 00049 """Add one Object""" 00050 if isinstance(anObject, self.classForManaging): 00051 self.__setattr__(name, anObject) 00052 return anObject 00053 raise AttributeError(str(anObject) 00054 + ' is not a ' 00055 + str(self.classForManaging)) 00056 00057 # --------------------------------------- def get(self, name):
def UserTagging::Manager::ObjectSet::get | ( | self, | ||
name | ||||
) | [inherited] |
Get the Object given the name
Definition at line 58 of file Manager.py.
00058 : 00059 """Get the Object given the name""" 00060 try: 00061 objName = self.description[name] 00062 except KeyError: 00063 raise AttributeError('Object ' + name + ' is not defined yet') 00064 return self.__dict__[name] 00065