class point_set_iterator¶
Iterator over the point elements of a point_set .
Use a point_set_iterator to iterate over a point_set . For example:
for e in my_point_set:
print('point: ', e)
point_set_iterator Members¶
| Constructors | none |
| Methods | __eq__(), __iter__(), __ne__(), __next__(), __repr__(), __str__(), at_end() |
point_set_iterator Details¶
-
class
cs.point_set_iterator¶ Iterator over the
pointelements of apoint_set.-
__eq__(other)¶ Iterator equality.
Parameters: other ( point_set_iterator) –Return type: bool Returns: Trueif and only ifselfandotherare at the same position. Behavior is undefined ifselfandotherare not iterating over the same collection.>>> cu = next(c for c in project.current().compunits() if c.name().endswith('apitest.cpp')) >>> proc = next(p for p in cu.procedures() if p.name()=='foo') >>> pts = proc.points() >>> pt_iterA = iter(pts) >>> pt_iterB = iter(pts) >>> pt_iterA == pt_iterB True >>> for pt in pt_iterA: ... if pt.get_kind() == point_kind.EXPRESSION: ... break ... >>> pt_iterA == pt_iterB False
-
__iter__()¶ Get the iterator object.
Return type: point_set_iteratorReturns: self.>>> cu = next(c for c in project.current().compunits() if c.name().endswith('apitest.cpp')) >>> proc = next(p for p in cu.procedures() if p.name()=='foo') >>> for pt in iter(proc.points()): # iteration managed by point_set_iterator.__iter() ... # and point_set_iterator.__next__() ... if pt.get_kind() == point_kind.EXPRESSION: ... print(pt) ... [expression] a = _Z3bariPvi$result4 [expression] b = _Z3bariPvi$result5 [expression] p = _Z8mymalloci$result6 [expression] *p = b [expression] $temp13 = "bar" [expression] foo$return = $temp13 [expression] j = _Z3bariPvi$result7 [expression] s.j = j [expression] $temp11 = $temp10 [expression] $temp12 = "foo" [expression] foo$return = $temp12
-
__ne__(other)¶ Iterator inequality.
Parameters: other ( point_set_iterator) – The iterator to compare against.Return type: bool Returns: Falseif and only ifselfandotherare at the same position. Behavior is undefined ifselfandotherare not iterating over the same collection.>>> cu = next(c for c in project.current().compunits() if c.name().endswith('apitest.cpp')) >>> proc = next(p for p in cu.procedures() if p.name()=='foo') >>> pts = proc.points() >>> pt_iterA = iter(pts) >>> pt_iterB = iter(pts) >>> pt_iterA != pt_iterB False >>> for pt in pt_iterA: ... if pt.get_kind() == point_kind.EXPRESSION: ... break ... >>> pt_iterA != pt_iterB True
-
__next__()¶ Iterator dereference operator.
Return type: pointReturns: The element at the current iterator position. Raises: StopIteration- Side effects: Modifies
self.
The typical use is implicit:
>>> for item in myiter: ... (do something to item)
>>> proc = project.current().find_procedure('mymalloc(int)') >>> for pt in proc.callers(): # implicit use of point_set.__iter__(); point_set_iterator.__next__() ... fl = pt.file_line() ... print(fl[0].normalized_name().split('/')[-1], fl[1]) apitest.cpp 37 apitest.cpp 15
- Side effects: Modifies
-
__repr__()¶ Get a representation of the iterator that includes information useful for debugging.
Return type: str Returns: The string representation. >>> v0 = point_set() >>> v1 = iter(v0) >>> repr(v1) '<cs.point_set_iterator begin>'
-
__str__()¶ Get a simple string representation of the iterator.
Return type: str Returns: The string representation. >>> v0 = point_set() >>> v1 = iter(v0) >>> str(v1) '<cs.point_set_iterator begin>'
-
at_end()¶ Check: is the iterator at the end of the structure?
Return type: bool Returns: Trueif the iterator is at the end of the structure (there are no more elements to iterate over),Falseotherwise.>>> v0 = point_set() >>> v1 = iter(v0) >>> v1.at_end() True
-