Public Member Functions | |
def | __init__ |
def | isInitialized |
def | initialize |
def | __setitem__ |
def | __getitem__ |
Public Attributes | |
alg | |
defaultPath | |
data | |
Private Member Functions | |
def | _key2path |
Static Private Attributes | |
_statsSvc = None |
Definition at line 8 of file iStatsSvc.py.
def DybPython::iStatsSvc::iStatsSvc::__init__ | ( | self, | ||
alg, | ||||
path = "" | ||||
) |
Definition at line 11 of file iStatsSvc.py.
00011 : 00012 self.alg = alg # Reference to the algorithm which created this handle 00013 self.defaultPath = path # Default path for this algorithm 00014 self.data = {} # Shortcuts to items in StatisticsSvc for this alg 00015 return 00016 def isInitialized(self):
def DybPython::iStatsSvc::iStatsSvc::isInitialized | ( | self | ) |
Definition at line 17 of file iStatsSvc.py.
00017 : 00018 if self.__class__._statsSvc == None: 00019 return False 00020 return True 00021 def initialize(self):
def DybPython::iStatsSvc::iStatsSvc::initialize | ( | self | ) |
Definition at line 22 of file iStatsSvc.py.
00022 : 00023 if not self.isInitialized(): 00024 statsSvc = self.alg.svc("IStatisticsSvc","StatisticsSvc") 00025 if statsSvc == None: 00026 self.alg.error("Failed to initialize statistics service") 00027 else: 00028 # Initialize for all instances of iStatsSvc 00029 self.__class__._statsSvc = statsSvc 00030 return 00031 def _key2path(self,key):
def DybPython::iStatsSvc::iStatsSvc::_key2path | ( | self, | ||
key | ||||
) | [private] |
Definition at line 32 of file iStatsSvc.py.
00032 : 00033 if key[0] != '/': 00034 key = self.defaultPath + '/' + key 00035 return key 00036 def __setitem__(self,key,value):
def DybPython::iStatsSvc::iStatsSvc::__setitem__ | ( | self, | ||
key, | ||||
value | ||||
) |
Definition at line 37 of file iStatsSvc.py.
00037 : 00038 self.alg.debug('iStatsSvc.__setitem__(%s,%s)'%(key,value)) 00039 if not self.isInitialized(): self.initialize() 00040 key = self._key2path(key) 00041 if self.data.has_key(key): 00042 raise KeyError, 'key "%s" already set'%key 00043 self.__class__._statsSvc.put(key,value) 00044 self.data[key] = value 00045 return 00046 def __getitem__(self,key):
def DybPython::iStatsSvc::iStatsSvc::__getitem__ | ( | self, | ||
key | ||||
) |
Definition at line 47 of file iStatsSvc.py.
00047 : 00048 self.alg.debug('iStatsSvc.__getitem__(%s)'%(key)) 00049 if not self.isInitialized(): self.initialize() 00050 key = self._key2path(key) 00051 if self.data.has_key(key): 00052 return self.data[self._key2path(key)] 00053 return self.__class__._statsSvc.get(key) return self.__class__._statsSvc.get(key)
DybPython::iStatsSvc::iStatsSvc::_statsSvc = None [static, private] |
Definition at line 10 of file iStatsSvc.py.
Definition at line 12 of file iStatsSvc.py.
Definition at line 13 of file iStatsSvc.py.
Definition at line 14 of file iStatsSvc.py.