Example #1
0
 def next(self):
     if self.node:
         return_val = self.__val()
         self.node = py2shmobj.shmdict_next(self.dict, self.node)
         return return_val
     else:
         raise StopIteration
Example #2
0
 def clear(self, shallow=False):
     SHMOBJ.protect(self)
     np = py2shmobj.shmdict_first(self.addr)
     while np:
         (p,datatype,datalen) = py2shmobj.shmdnode_get(np)
         if not shallow:
             #DE - for now we assume the key is always a SHMSTR
             kp = py2shmobj.shmdnode_getkey(np)
             py2shmobj.shmobj_del(kp)
             val = typed_ptr(p,datatype)
             if type(val) in [SHMLST, SHMDCT]:
                 val.delete(shallow=shallow)
             elif isinstance(val, SHMOBJ):
                 val.delete()
         next = py2shmobj.shmdict_next(self.addr,np)
         py2shmobj.shmdict_remove(self.addr, np)
         py2shmobj.shmobj_del(np)
         np = next