class point_adjusted_callees_iterator

An iterator over the callee procedures ( procedure ) from a specific point, taking into account any translations incurred by csonar_replace_*() calls and the FUNCTION_MAP configuration file variable.

Calls may be direct or indirect.

Initialize with point.adjusted_callees().

Use as you would any other Python iterator. For example:

# set up point pt, then...
for e in pt.adjusted_callees():
    print('procedure: ', e)

point_adjusted_callees_iterator Details

class cs.point_adjusted_callees_iterator

An iterator over the callee procedures ( procedure ) from a specific point, taking into account any translations incurred by csonar_replace_*() calls and the FUNCTION_MAP configuration file variable.

__eq__(other)

Iterator equality.

Parameters:other (point_adjusted_callees_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.
>>> 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()=='bar')
>>> cs = next(pt for pt in proc.call_sites()
...           if pt.callee().name()=='mymalloc')
>>> callee_iterA = cs.adjusted_callees()
>>> callee_iterB = cs.adjusted_callees()
>>> callee_iterA == callee_iterB
True
>>> for callee in callee_iterA:
...     if callee.name()=='mymalloc':
...        print(callee)
...        break
...
mymalloc
>>> callee_iterA == callee_iterB
False
__iter__()

Get the iterator object.

Return type:point_adjusted_callees_iterator
Returns: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()=='bar')
>>> cs = next(pt for pt in proc.call_sites()
...           if pt.callee().name()=='mymalloc')
>>> for callee in cs.adjusted_callees(): # iteration managed by point_adjusted_callees_iterator.__iter__()
...                                      # and point_adjusted_callees_iterator.__next__()
...    print(callee.name())
...
mymalloc
__ne__(other)

Iterator inequality.

Parameters:other (point_adjusted_callees_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.
>>> 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()=='bar')
>>> cs = next(pt for pt in proc.call_sites()
...           if pt.callee().name()=='mymalloc')
>>> callee_iterA = cs.adjusted_callees()
>>> callee_iterB = cs.adjusted_callees()
>>> callee_iterA != callee_iterB
False
>>> for callee in callee_iterA:
...    if callee.name()=='mymalloc':
...       break
...
>>> callee_iterA != callee_iterB
True
__next__()

Iterator dereference operator.

Return type:

procedure

Returns:

The element at the current iterator position.

Raises:
  • Side effects: Modifies self.

The typical use is implicit:

>>> for item in myiter:
...   (do something to item)
>>> 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()=='bar')
>>> cs = next(pt for pt in proc.call_sites()
...              if pt.callee().name()=='mymalloc')
>>> for callee in cs.adjusted_callees(): # iteration managed by point_adjusted_callees_iterator.__iter__()
...                                      # and point_adjusted_callees_iterator.__next__()
...    print(callee.name())
...
mymalloc
__repr__()

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

Return type:str
Returns:The string representation.
>>> barfn = next(f for f in project.current().procedures() if f.name()=='bar')
>>> barcs0 = barfn.call_sites_vector()[0]
>>> it = barcs0.adjusted_callees()
>>> repr(it)
'<cs.point_adjusted_callees_iterator begin>'
__str__()

Get a simple string representation of the iterator.

Return type:str
Returns:The string representation.
>>> barfn = next(f for f in project.current().procedures() if f.name()=='bar')
>>> barcs0 = barfn.call_sites_vector()[0]
>>> it = barcs0.adjusted_callees()
>>> str(it)
'<cs.point_adjusted_callees_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.
>>> barfn = next(f for f in project.current().procedures() if f.name()=='bar')
>>> barcs0 = barfn.call_sites_vector()[0]
>>> it = barcs0.adjusted_callees()
>>> next(it)
<cs.procedure bar>
>>> it.at_end()
True