class point_adjusted_callees_no_reroute_iterator¶
An iterator over the callee procedures ( procedure ) from a specific point, ignoring 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_no_reroute().
Use as you would any other Python iterator. For example:
# set up point pt, then...
for e in pt.adjusted_callees_no_reroute():
print('procedure: ', e)
point_adjusted_callees_no_reroute_iterator Members¶
| Constructors | none |
| Methods | __eq__(), __iter__(), __ne__(), __next__(), __repr__(), __str__(), at_end() |
point_adjusted_callees_no_reroute_iterator Details¶
-
class
cs.point_adjusted_callees_no_reroute_iterator¶ An iterator over the callee procedures (
procedure) from a specific point, ignoring any translations incurred bycsonar_replace_*()calls and the FUNCTION_MAP configuration file variable.-
__eq__(other)¶ Iterator equality.
Parameters: other ( point_adjusted_callees_no_reroute_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()=='bar') >>> cs = next(pt for pt in proc.call_sites() ... if pt.callee().name()=='mymalloc') >>> callee_iterA = cs.adjusted_callees_no_reroute() >>> callee_iterB = cs.adjusted_callees_no_reroute() >>> callee_iterA == callee_iterB True >>> for callee in callee_iterA: ... if callee.name()=='mymalloc': ... break ... >>> callee_iterA == callee_iterB False
-
__iter__()¶ Get the iterator object.
Return type: point_adjusted_callees_no_reroute_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()=='bar') >>> cs = next(pt for pt in proc.call_sites() ... if pt.callee().name()=='mymalloc') >>> for callee in cs.adjusted_callees_no_reroute(): # iteration managed by point_adjusted_callees_no_reroute_iterator.__iter__() ... # and point_adjusted_callees_no_reroute_iterator.__next__() ... print(callee.name()) ... mymalloc
-
__ne__(other)¶ Iterator inequality.
Parameters: other ( point_adjusted_callees_no_reroute_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()=='bar') >>> cs = next(pt for pt in proc.call_sites() ... if pt.callee().name()=='mymalloc') >>> callee_iterA = cs.adjusted_callees_no_reroute() >>> callee_iterB = cs.adjusted_callees_no_reroute() >>> 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: Returns: The element at the current iterator position.
Raises: result.ERROR_INVALID_PHASE_FOR_OPERATIONif the iterator was initialized before the beginning of the serial depth-first traversal.result.ERROR_NOT_A_CALL_SITEif the iterator was initialized with respect to a point that is not a call site, or with respect to a direct call site whose calleeprocedurecould not be determined.StopIteration
- 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_no_reroute(): # iteration managed by point_adjusted_callees_no_reroute_iterator.__iter__() ... # and point_adjusted_callees_no_reroute_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(p for p in project.current().procedures() if p.name()=='bar') >>> barcs0 = barfn.call_sites_vector()[0] >>> it = barcs0.adjusted_callees_no_reroute() >>> repr(it) '<cs.point_adjusted_callees_no_reroute_iterator begin>'
-
__str__()¶ Get a simple string representation of the iterator.
Return type: str Returns: The string representation. >>> barfn = next(p for p in project.current().procedures() if p.name()=='bar') >>> barcs0 = barfn.call_sites_vector()[0] >>> it = barcs0.adjusted_callees_no_reroute() >>> str(it) '<cs.point_adjusted_callees_no_reroute_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.>>> barfn = next(p for p in project.current().procedures() if p.name()=='bar') >>> barcs0 = barfn.call_sites_vector()[0] >>> it = barcs0.adjusted_callees_no_reroute() >>> it.at_end() False >>> next(it) <cs.procedure bar> >>> it.at_end() True
-