libutap
0.93
Uppaal Timed Automata Parser
|
Class SignalFlow is for analysing UPPAAL specifications and extracting the timed automata input/output "interface" information which can be treated as a data flow or entity-relationship map of the system. More...
#include <signalflow.h>
Classes | |
struct | less_str |
struct | proc_t |
Public Types | |
typedef std::set< const char *, const less_str > | strs_t |
typedef std::map< const proc_t *, strs_t > | proc2strs_t |
typedef std::map< const char *, strs_t > | str2strs_t |
typedef std::set< proc_t * > | procs_t |
typedef std::map< const char *, procs_t, less_str > | str2procs_t |
typedef std::map< const symbol_t, expression_t > | exprref_t |
Public Member Functions | |
SignalFlow (const char *_title, TimedAutomataSystem &ta) | |
Analyse the system and extract I/O information: More... | |
void | setVerbose (int verbose) |
virtual | ~SignalFlow () |
All strings are from TASystem (don't dispose TASystem before SignalFlow). More... | |
void | printForTron (std::ostream &os) |
Print I/O information in TRON format into given output stream. More... | |
virtual void | printForDot (std::ostream &os, bool ranked, bool erd, bool cEdged) |
Print I/O information in DOT format into given output stream. More... | |
int32_t | visitEmptyStatement (EmptyStatement *stat) override |
System visitor pattern extracts read/write information from UCode. More... | |
int32_t | visitExprStatement (ExprStatement *stat) override |
int32_t | visitForStatement (ForStatement *stat) override |
int32_t | visitIterationStatement (IterationStatement *stat) override |
int32_t | visitWhileStatement (WhileStatement *stat) override |
int32_t | visitDoWhileStatement (DoWhileStatement *stat) override |
int32_t | visitBlockStatement (BlockStatement *stat) override |
int32_t | visitSwitchStatement (SwitchStatement *stat) override |
int32_t | visitCaseStatement (CaseStatement *stat) override |
int32_t | visitDefaultStatement (DefaultStatement *stat) override |
int32_t | visitIfStatement (IfStatement *stat) override |
int32_t | visitBreakStatement (BreakStatement *stat) override |
int32_t | visitContinueStatement (ContinueStatement *stat) override |
int32_t | visitReturnStatement (ReturnStatement *stat) override |
int32_t | visitAssertStatement (UTAP::AssertStatement *stat) override |
![]() | |
virtual | ~StatementVisitor () |
Protected Member Functions | |
bool | checkParams (const symbol_t &s) |
void | addChan (const std::string &, strs_t &, str2procs_t &) |
void | addVar (const symbol_t &, str2strs_t &, str2procs_t &) |
void | visitProcess (instance_t &) |
void | visitExpression (const expression_t &) |
void | pushIO () |
void | popIO () |
virtual void | printProcsForDot (std::ostream &os, bool erd) |
virtual void | printVarsForDot (std::ostream &os, bool ranked, bool erd) |
virtual void | printVarsWriteForDot (std::ostream &os) |
virtual void | printVarsReadForDot (std::ostream &os) |
virtual void | printChansOnEdgesForDot (std::ostream &os) |
virtual void | printChansSeparateForDot (std::ostream &os, bool ranked, bool erd) |
Protected Attributes | |
int | verbosity |
const char * | title |
procs_t | procs |
str2procs_t | receivers |
str2procs_t | transmitters |
strs_t | processes |
strs_t | channels |
strs_t | variables |
proc_t * | cTA |
instance_t * | cP |
const char * | cChan |
std::string | chanString |
bool | inp |
bool | out |
bool | sync |
bool | paramsExpanded |
std::stack< std::pair< bool, bool > > | ioStack |
std::stack< exprref_t > | refparams |
std::stack< exprref_t > | valparams |
Class SignalFlow is for analysing UPPAAL specifications and extracting the timed automata input/output "interface" information which can be treated as a data flow or entity-relationship map of the system.
The result can be processed by the dot (graphviz.org) to produce a "human-readable" picture. The other (tron) format is used in TRON project. Feel free to add more "formats" and/or tune the dot output.
The system must be built by TypeChecker/SystemBuilder before SignalFlow. Simply create using constructor and then use print* methods. The rest of methods are used internally by visitor pattern. Feel free to add new print* methods or inheriting classes.
Author: Marius Mikucionis mariu s@cs .aau. dk
Definition at line 56 of file signalflow.h.
typedef std::map<const symbol_t, expression_t> UTAP::SignalFlow::exprref_t |
Definition at line 78 of file signalflow.h.
typedef std::map<const proc_t*, strs_t> UTAP::SignalFlow::proc2strs_t |
Definition at line 65 of file signalflow.h.
typedef std::set<proc_t*> UTAP::SignalFlow::procs_t |
Definition at line 76 of file signalflow.h.
typedef std::map<const char*, procs_t, less_str> UTAP::SignalFlow::str2procs_t |
Definition at line 77 of file signalflow.h.
typedef std::map<const char*, strs_t> UTAP::SignalFlow::str2strs_t |
Definition at line 67 of file signalflow.h.
typedef std::set<const char*, const less_str> UTAP::SignalFlow::strs_t |
Definition at line 64 of file signalflow.h.
SignalFlow::SignalFlow | ( | const char * | _title, |
TimedAutomataSystem & | ta | ||
) |
Analyse the system and extract I/O information:
Definition at line 50 of file signalflow.cpp.
References UTAP::TimedAutomataSystem::getProcesses(), and visitProcess().
Referenced by popIO().
|
virtual |
All strings are from TASystem (don't dispose TASystem before SignalFlow).
Definition at line 789 of file signalflow.cpp.
References channels, and procs.
Referenced by setVerbose().
|
protected |
Definition at line 394 of file signalflow.cpp.
References cChan, channels, and cTA.
Referenced by visitExpression().
|
protected |
Definition at line 407 of file signalflow.cpp.
References cChan, checkParams(), cTA, UTAP::symbol_t::getName(), and variables.
Referenced by visitExpression().
|
protected |
Definition at line 359 of file signalflow.cpp.
References cP, UTAP::declarations_t::frame, UTAP::frame_t::getIndexOf(), UTAP::symbol_t::getName(), UTAP::instance_t::mapping, UTAP::instance_t::parameters, paramsExpanded, UTAP::instance_t::templ, and visitExpression().
Referenced by addVar(), and visitExpression().
|
inlineprotected |
Definition at line 103 of file signalflow.h.
References printChansOnEdgesForDot(), printChansSeparateForDot(), printProcsForDot(), printVarsForDot(), printVarsReadForDot(), printVarsWriteForDot(), and SignalFlow().
Referenced by visitExpression().
|
protectedvirtual |
Definition at line 197 of file signalflow.cpp.
References ch, procs, receivers, and transmitters.
Referenced by popIO(), and printForDot().
|
protectedvirtual |
Definition at line 290 of file signalflow.cpp.
References channels, and procs.
Referenced by popIO(), and printForDot().
|
virtual |
Print I/O information in DOT format into given output stream.
ranked – puts oposite "ranks" on variables and channels erd – puts boxes and diamonds rather than (compact) ellipses. cEdged – channels are printed on edges rather than separate nodes.
Reimplemented in UTAP::DistanceCalculator, and UTAP::Partitioner.
Definition at line 326 of file signalflow.cpp.
References channels, printChansOnEdgesForDot(), printChansSeparateForDot(), printProcsForDot(), printVarsForDot(), printVarsReadForDot(), printVarsWriteForDot(), procs, title, and variables.
Referenced by UTAP::DistanceCalculator::DistanceCalculator(), main(), UTAP::Partitioner::Partitioner(), UTAP::DistanceCalculator::printForDot(), and setVerbose().
void SignalFlow::printForTron | ( | std::ostream & | os | ) |
Print I/O information in TRON format into given output stream.
Definition at line 66 of file signalflow.cpp.
References procs.
Referenced by main(), and setVerbose().
|
protectedvirtual |
Reimplemented in UTAP::DistanceCalculator.
Definition at line 101 of file signalflow.cpp.
References procs.
Referenced by popIO(), and printForDot().
|
protectedvirtual |
Reimplemented in UTAP::DistanceCalculator.
Definition at line 120 of file signalflow.cpp.
References transmitters, and variables.
Referenced by popIO(), and printForDot().
|
protectedvirtual |
Definition at line 175 of file signalflow.cpp.
References procs.
Referenced by popIO(), and printForDot().
|
protectedvirtual |
Definition at line 153 of file signalflow.cpp.
References procs.
Referenced by popIO(), and printForDot().
|
inlineprotected |
Definition at line 100 of file signalflow.h.
Referenced by visitExpression().
|
inline |
Definition at line 129 of file signalflow.h.
References printForDot(), printForTron(), visitAssertStatement(), visitBlockStatement(), visitBreakStatement(), visitCaseStatement(), visitContinueStatement(), visitDefaultStatement(), visitDoWhileStatement(), visitEmptyStatement(), visitExprStatement(), visitForStatement(), visitIfStatement(), visitIterationStatement(), visitReturnStatement(), visitSwitchStatement(), visitWhileStatement(), and ~SignalFlow().
Referenced by main().
|
overridevirtual |
Implements UTAP::StatementVisitor.
Definition at line 778 of file signalflow.cpp.
Referenced by setVerbose().
|
overridevirtual |
Implements UTAP::StatementVisitor.
Definition at line 729 of file signalflow.cpp.
References UTAP::BlockStatement::begin(), and UTAP::BlockStatement::end().
Referenced by setVerbose(), visitCaseStatement(), visitDefaultStatement(), and visitSwitchStatement().
|
overridevirtual |
Implements UTAP::StatementVisitor.
Definition at line 768 of file signalflow.cpp.
Referenced by setVerbose().
|
overridevirtual |
Implements UTAP::StatementVisitor.
Definition at line 747 of file signalflow.cpp.
References UTAP::CaseStatement::cond, visitBlockStatement(), and visitExpression().
Referenced by setVerbose().
|
overridevirtual |
Implements UTAP::StatementVisitor.
Definition at line 773 of file signalflow.cpp.
Referenced by setVerbose().
|
overridevirtual |
Implements UTAP::StatementVisitor.
Definition at line 753 of file signalflow.cpp.
References visitBlockStatement().
Referenced by setVerbose().
|
overridevirtual |
Implements UTAP::StatementVisitor.
Definition at line 722 of file signalflow.cpp.
References UTAP::Statement::accept(), UTAP::DoWhileStatement::cond, UTAP::DoWhileStatement::stat, and visitExpression().
Referenced by setVerbose().
|
overridevirtual |
System visitor pattern extracts read/write information from UCode.
This is actually "const" visitor and should contain "const Statement *stat".
Implements UTAP::StatementVisitor.
Definition at line 691 of file signalflow.cpp.
Referenced by setVerbose().
|
protected |
Definition at line 444 of file signalflow.cpp.
References UTAP::BlockStatement::accept(), addChan(), addVar(), UTAP::Constants::AND, UTAP::Constants::ARRAY, UTAP::Constants::ASSAND, UTAP::Constants::ASSDIV, UTAP::Constants::ASSIGN, UTAP::Constants::ASSLSHIFT, UTAP::Constants::ASSMINUS, UTAP::Constants::ASSMOD, UTAP::Constants::ASSMULT, UTAP::Constants::ASSOR, UTAP::Constants::ASSPLUS, UTAP::Constants::ASSRSHIFT, UTAP::Constants::ASSXOR, UTAP::Constants::BIT_AND, UTAP::Constants::BIT_LSHIFT, UTAP::Constants::BIT_OR, UTAP::Constants::BIT_RSHIFT, UTAP::Constants::BIT_XOR, chanString, checkParams(), UTAP::Constants::COMMA, UTAP::Constants::CONSTANT, cTA, UTAP::Constants::DIV, UTAP::Constants::DOT, UTAP::expression_t::empty(), UTAP::Constants::EQ, UTAP::Constants::EXISTS, UTAP::Constants::FORALL, UTAP::Constants::FRACTION, UTAP::Constants::FUNCALL, UTAP::Constants::FUNCTION, UTAP::Constants::GE, UTAP::symbol_t::getData(), UTAP::symbol_t::getFrame(), UTAP::BlockStatement::getFrame(), UTAP::expression_t::getKind(), UTAP::type_t::getKind(), UTAP::symbol_t::getName(), UTAP::expression_t::getSize(), UTAP::expression_t::getSymbol(), UTAP::expression_t::getSync(), UTAP::expression_t::getType(), UTAP::symbol_t::getType(), UTAP::expression_t::getValue(), UTAP::Constants::GT, UTAP::frame_t::hasParent(), UTAP::Constants::IDENTIFIER, UTAP::SignalFlow::proc_t::inChans, UTAP::Constants::INLINEIF, inp, UTAP::type_t::is(), UTAP::Constants::LE, UTAP::Constants::LIST, UTAP::Constants::LT, UTAP::Constants::MAX, UTAP::Constants::MIN, UTAP::Constants::MINUS, UTAP::Constants::MOD, UTAP::Constants::MULT, UTAP::Constants::NEQ, UTAP::Constants::NOT, UTAP::Constants::OR, out, UTAP::SignalFlow::proc_t::outChans, UTAP::Constants::PLUS, popIO(), UTAP::Constants::POSTDECREMENT, UTAP::Constants::POSTINCREMENT, UTAP::Constants::PREDECREMENT, UTAP::Constants::PREINCREMENT, pushIO(), UTAP::Constants::RATE, UTAP::SignalFlow::proc_t::rdVars, receivers, UTAP::Constants::REF, refparams, UTAP::Constants::SUM, sync, UTAP::Constants::SYNC, UTAP::Constants::SYNC_BANG, UTAP::Constants::SYNC_CSP, UTAP::Constants::SYNC_QUE, transmitters, UTAP::Constants::UNARY_MINUS, valparams, and UTAP::SignalFlow::proc_t::wtVars.
Referenced by checkParams(), visitCaseStatement(), visitDoWhileStatement(), visitExprStatement(), visitForStatement(), visitIfStatement(), visitProcess(), visitReturnStatement(), visitSwitchStatement(), and visitWhileStatement().
|
overridevirtual |
Implements UTAP::StatementVisitor.
Definition at line 696 of file signalflow.cpp.
References UTAP::ExprStatement::expr, and visitExpression().
Referenced by setVerbose().
|
overridevirtual |
Implements UTAP::StatementVisitor.
Definition at line 708 of file signalflow.cpp.
References UTAP::Statement::accept(), UTAP::ForStatement::cond, UTAP::ForStatement::init, UTAP::ForStatement::stat, UTAP::ForStatement::step, and visitExpression().
Referenced by setVerbose().
|
overridevirtual |
Implements UTAP::StatementVisitor.
Definition at line 758 of file signalflow.cpp.
References UTAP::Statement::accept(), UTAP::IfStatement::cond, UTAP::IfStatement::falseCase, UTAP::IfStatement::trueCase, and visitExpression().
Referenced by setVerbose().
|
overridevirtual |
Implements UTAP::StatementVisitor.
Definition at line 702 of file signalflow.cpp.
References UTAP::Statement::accept(), and UTAP::IterationStatement::stat.
Referenced by setVerbose().
|
protected |
Definition at line 420 of file signalflow.cpp.
References cChan, cP, cTA, UTAP::template_t::edges, UTAP::symbol_t::getName(), noChan, processes, procs, UTAP::template_t::states, UTAP::instance_t::templ, UTAP::instance_t::uid, and visitExpression().
Referenced by SignalFlow().
|
overridevirtual |
Implements UTAP::StatementVisitor.
Definition at line 783 of file signalflow.cpp.
References UTAP::ReturnStatement::value, and visitExpression().
Referenced by setVerbose().
|
overridevirtual |
Implements UTAP::StatementVisitor.
Definition at line 741 of file signalflow.cpp.
References UTAP::SwitchStatement::cond, visitBlockStatement(), and visitExpression().
Referenced by setVerbose().
|
overridevirtual |
Implements UTAP::StatementVisitor.
Definition at line 716 of file signalflow.cpp.
References UTAP::Statement::accept(), UTAP::WhileStatement::cond, UTAP::WhileStatement::stat, and visitExpression().
Referenced by setVerbose().
|
protected |
Definition at line 88 of file signalflow.h.
Referenced by addChan(), addVar(), and visitProcess().
|
protected |
Definition at line 85 of file signalflow.h.
Referenced by addChan(), printChansSeparateForDot(), printForDot(), UTAP::Partitioner::printForDot(), and ~SignalFlow().
|
protected |
Definition at line 89 of file signalflow.h.
Referenced by visitExpression().
|
protected |
Definition at line 87 of file signalflow.h.
Referenced by checkParams(), and visitProcess().
|
protected |
Definition at line 86 of file signalflow.h.
Referenced by addChan(), addVar(), visitExpression(), and visitProcess().
|
protected |
Definition at line 90 of file signalflow.h.
Referenced by visitExpression().
|
protected |
Definition at line 91 of file signalflow.h.
|
protected |
Definition at line 90 of file signalflow.h.
Referenced by set_remove(), and visitExpression().
|
protected |
Definition at line 90 of file signalflow.h.
Referenced by checkParams().
|
protected |
Definition at line 85 of file signalflow.h.
Referenced by UTAP::DistanceCalculator::addProcessNeedle(), UTAP::Partitioner::printForDot(), and visitProcess().
|
protected |
Definition at line 83 of file signalflow.h.
Referenced by UTAP::DistanceCalculator::addProcessNeedle(), UTAP::Partitioner::partition(), UTAP::Partitioner::Partitioner(), printChansOnEdgesForDot(), printChansSeparateForDot(), printForDot(), UTAP::Partitioner::printForDot(), printForTron(), printProcsForDot(), UTAP::DistanceCalculator::printProcsForDot(), printVarsReadForDot(), printVarsWriteForDot(), visitProcess(), and ~SignalFlow().
|
protected |
Definition at line 84 of file signalflow.h.
Referenced by UTAP::Partitioner::addProcsByVars(), UTAP::Partitioner::partition(), printChansOnEdgesForDot(), UTAP::Partitioner::printForDot(), and visitExpression().
|
protected |
Definition at line 92 of file signalflow.h.
Referenced by visitExpression().
|
protected |
Definition at line 90 of file signalflow.h.
Referenced by visitExpression().
|
protected |
Definition at line 82 of file signalflow.h.
Referenced by printForDot(), and UTAP::Partitioner::printForDot().
|
protected |
Definition at line 84 of file signalflow.h.
Referenced by UTAP::DistanceCalculator::addProcessNeedle(), UTAP::Partitioner::addProcsByVars(), UTAP::Partitioner::partition(), printChansOnEdgesForDot(), UTAP::Partitioner::printForDot(), printVarsForDot(), UTAP::DistanceCalculator::printVarsForDot(), and visitExpression().
|
protected |
Definition at line 93 of file signalflow.h.
Referenced by visitExpression().
|
protected |
Definition at line 85 of file signalflow.h.
Referenced by addVar(), UTAP::DistanceCalculator::addVariableNeedle(), printForDot(), UTAP::Partitioner::printForDot(), printVarsForDot(), and UTAP::DistanceCalculator::printVarsForDot().
|
protected |
Definition at line 81 of file signalflow.h.
Referenced by UTAP::Partitioner::addIntChans(), UTAP::Partitioner::addIntVars(), UTAP::Partitioner::addProcs(), UTAP::Partitioner::addProcsByVars(), UTAP::Partitioner::partition(), and UTAP::Partitioner::printViolation().