slreportgen.finder.ChartDiagramFinder class
Package: slreportgen.finder
Superclasses:
Create Stateflow chart finder
Description
Finds Stateflow® charts.
Construction
creates a finder that finds by default all uncommented Stateflow chart diagrams in the specified finder
= ChartDiagramFinder(container
)container
. To
constrain the search to specific types of diagrams, use the properties of this
finder.
Note
This finder can operate in either find or iterator mode. In find mode, use its find
method to return the results of a search as an array of results. In iterator mode, use its hasNext
and next
methods to return the results of a search one-by-one. When searching in models that have many model references, use iterator mode. Iterator mode closes a model after compiling and searching it, whereas find mode keeps all the models that it searches open. Having many open models can consume all system memory and slow report generation. Iterator mode is slower than find mode, so use find mode to search models that reference few or no other models.
sets properties using name-value pairs. You can specify multiple name-value pair
arguments in any order.finder
= ChartDiagramFinder(Name=Value
)
Input Arguments
Properties
Methods
results = find(finder)
finds chart diagrams in the
container
specified by the finder. The
finder
is an slreportgen.finder.ChartDiagramFinder
object. results
is an array of
slreportgen.finder.DiagramResult
objects, each of which contains a
chart diagram found by this method. Adding this array to a report or reporter adds
images of the charts that it contains. The reports to which you can add the
results
of this method are reports of type
slreportgen.report.Report
or another reporter object, such as an
slreportgen.report.Chapter
reporter.
tf = hasNext(finder)
determines if the container that the finder
searches contains at least one chart. If the container has at least one chart, the
hasNext
method queues that chart as the next chart that the
next
method will return. The hasNext
method then
returns true
. Use the next
method to obtain that
chart. On subsequent calls, the hasNext
method determines if the
container has a chart that the next
has not yet retrieved. It queues
the chart for the next
method to retrieve and returns
true
. If there are no more charts exist to be retrieved, this
method returns false
. To search a container progressively for charts,
use the hasNext
method with the next
method in a while loop.
Note
If the current result is the last result in the search queue for the current
chart and the AutoCloseModel
property is
true
, this method closes the current chart before it
opens the next chart. Although this increases search time, it reduces memory
consumption when searching a chart that references many other charts. If your
chart does not reference many other charts, to speed up the search, set the
AutoCloseModel
property to false
or
use the find
method.
result = next(result)
returns the next search
result
in the result queue that the hasNext
method created. The search result contains the resulting chart. Adding this
result
object to a report or reporter adds a Diagram reporter
for the chart.
Copy Semantics
Handle. To learn how handle classes affect copy operations, see Copying Objects.
Examples
Find Stateflow Charts
Create a report that includes images of all Stateflow charts in the sldemo_fuelsys
model. Use a separate
chapter for each
chart.
import mlreportgen.report.* import slreportgen.report.* import slreportgen.finder.* model_name = "slrgex_fuelsys"; load_system(model_name); rpt = slreportgen.report.Report("output","pdf"); add(rpt, TitlePage(Title=sprintf("%s Charts",model_name))); add(rpt, TableOfContents); chapter = Chapter("Root System"); add(chapter, Diagram(model_name)); add(rpt,chapter); chapter = Chapter("Charts"); finder = ChartDiagramFinder(model_name); results = find(finder); for result = results section = Section(Title=result.Name); add(section,result); add(chapter,section); end add(rpt, chapter); close(rpt); close_system(model_name); rptview(rpt);