class cfg_edge_set_iterator

Iterator over the ( point , edge_label ) elements of a cfg_edge_set .

Use a cfg_edge_set_iterator to iterate over a cfg_edge_set . For example:

for e in my_cfg_edge_set:
    print('cfg_edge: ', e)

cfg_edge_set_iterator Details

class cs.cfg_edge_set_iterator

Iterator over the ( point , edge_label ) elements of a cfg_edge_set .

__eq__(other)

Iterator equality.

Parameters:other (cfg_edge_set_iterator) –
Return type:bool
Returns:True if and only if self and other are at the same position. Behavior is undefined if self and other are not iterating over the same collection.
>>> b = project.current().find_procedure('bar(int, void *, int)')
>>> ctrl_pt = next(pt for pt in b.points() if pt.get_kind()==point_kind.CONTROL_
POINT)
>>> targs = ctrl_pt.cfg_targets()
>>> targ_iterA = iter(targs)
>>> targ_iterB = iter(targs)
>>> targ_iterA == targ_iterB
True
>>> for target in targ_iterA:
...     if target[1].name()=='T':
...         break
...
>>> targ_iterA == targ_iterB
False
__iter__()

Get the iterator object.

Return type:cfg_edge_set_iterator
Returns:self.
>>> b = project.current().find_procedure('bar(int, void *, int)')
>>> cs0targs = b.call_sites_vector()[0].cfg_targets()
>>> iter(cs0targs)                       # cfg_edge_set.__iter__()
<cs.cfg_edge_set_iterator begin>
>>> iter(iter(cs0targs))                 # cfg_edge_set_iterator.__iter__()
<cs.cfg_edge_set_iterator begin>
__ne__(other)

Iterator inequality.

Parameters:other (cfg_edge_set_iterator) – The iterator to compare against.
Return type:bool
Returns:False if and only if self and other are at the same position. Behavior is undefined if self and other are not iterating over the same collection.
>>> b = project.current().find_procedure('bar(int, void *, int)')
>>> ctrl_pt = next(pt for pt in b.points() if pt.get_kind()==point_kind.CONTROL_
POINT)
>>> targs = ctrl_pt.cfg_targets()
>>> targ_iterA = iter(targs)
>>> targ_iterB = iter(targs)
>>> targ_iterA != targ_iterB
False
>>> for target in targ_iterA:
...     if target[1].name()=='T':
...         break
...
>>> targ_iterA != targ_iterB
True
__next__()

Iterator dereference operator.

Return type:(point, edge_label)
Returns: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)
>>> b = project.current().find_procedure('bar(int, void *, int)')
>>> cs0targs = b.call_sites_vector()[0].cfg_targets()
>>> targiter = iter(cs0targs)
>>> next(targiter)
(<cs.point [actual-in] $param_3 = 2>, <cs.edge_label T>)
__repr__()

Get a representation of the iterator that includes information useful for debugging.

Return type:str
Returns:The string representation.
>>> b = project.current().find_procedure('bar(int, void *, int)')
>>> cs0targs = b.call_sites_vector()[0].cfg_targets()
>>> repr(iter(cs0targs))
'<cs.cfg_edge_set_iterator begin>'
__str__()

Get a simple string representation of the iterator.

Return type:str
Returns:The string representation.
>>>>>> b = project.current().find_procedure('bar(int, void *, int)')
>>> cs0targs = b.call_sites_vector()[0].cfg_targets()
>>> str(iter(cs0targs))
'<cs.cfg_edge_set_iterator begin>'
at_end()

Check: is the iterator at the end of the structure?

Return type:bool
Returns:True if the iterator is at the end of the structure (there are no more elements to iterate over), False otherwise.
>>> b = project.current().find_procedure('bar(int, void *, int)')
>>> cs0targs = b.call_sites_vector()[0].cfg_targets()
>>> targiter = iter(cs0targs)
>>> targiter.at_end()
False