Example #1
0
 def remove(self, item):
     SHMOBJ.protect(self)
     np = py2shmobj.shmlist_first(self.addr)
     while np:
         (p,datatype,datalen) = py2shmobj.shmlnode_get(np)
         obj = typed_ptr(p,datatype)
         if obj == item:
             py2shmobj.shmlist_remove(self.addr, np)
             return None
         np = py2shmobj.shmlist_next(self.addr,np)
Example #2
0
 def count(self, arg):
     SHMOBJ.protect(self)
     count = 0
     np = py2shmobj.shmlist_first(self.addr)
     while np:
         (p,datatype,datalen) = py2shmobj.shmlnode_get(np)
         obj = typed_ptr(p,datatype)
         if obj == arg:
             count += 1
         np = py2shmobj.shmlist_next(self.addr,np)
     return count
Example #3
0
 def delete(self, shallow=False):
     SHMOBJ.protect(self)
     np = py2shmobj.shmlist_first(self.addr)
     while np:
         if not shallow:
             (p,datatype,datalen) = py2shmobj.shmlnode_get(np)
             if p:
                 val = typed_ptr(p,datatype)
                 if type(val) in [SHMLST, SHMDCT]:
                     val.delete(shallow=shallow)
                 elif isinstance(val, SHMOBJ):
                     val.delete()
         next = py2shmobj.shmlist_next(self.addr,np)
         py2shmobj.shmlist_remove(self.addr, np)
         py2shmobj.shmobj_del(np)
         np = next
     SHMOBJ.delete(self)
Example #4
0
 def __iter__(self):
     self.node = py2shmobj.shmlist_first(self.list)
     return self
Example #5
0
 def __init__(self, shmlist):
     self.list = shmlist.get_ptr()
     self.node = py2shmobj.shmlist_first(self.list)