libutap  0.93
Uppaal Timed Automata Parser
UTAP::SignalFlow Class Reference

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>

Inheritance diagram for UTAP::SignalFlow:
Collaboration diagram for UTAP::SignalFlow:

Classes

struct  less_str
 
struct  proc_t
 

Public Types

typedef std::set< const char *, const less_strstrs_t
 
typedef std::map< const proc_t *, strs_tproc2strs_t
 
typedef std::map< const char *, strs_tstr2strs_t
 
typedef std::set< proc_t * > procs_t
 
typedef std::map< const char *, procs_t, less_strstr2procs_t
 
typedef std::map< const symbol_t, expression_texprref_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
 
- Public Member Functions inherited from UTAP::StatementVisitor
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_tcTA
 
instance_tcP
 
const char * cChan
 
std::string chanString
 
bool inp
 
bool out
 
bool sync
 
bool paramsExpanded
 
std::stack< std::pair< bool, bool > > ioStack
 
std::stack< exprref_trefparams
 
std::stack< exprref_tvalparams
 

Detailed Description

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.nosp@m.s@cs.nosp@m..aau..nosp@m.dk

Definition at line 56 of file signalflow.h.

Member Typedef Documentation

◆ exprref_t

Definition at line 78 of file signalflow.h.

◆ proc2strs_t

typedef std::map<const proc_t*, strs_t> UTAP::SignalFlow::proc2strs_t

Definition at line 65 of file signalflow.h.

◆ procs_t

typedef std::set<proc_t*> UTAP::SignalFlow::procs_t

Definition at line 76 of file signalflow.h.

◆ str2procs_t

typedef std::map<const char*, procs_t, less_str> UTAP::SignalFlow::str2procs_t

Definition at line 77 of file signalflow.h.

◆ str2strs_t

typedef std::map<const char*, strs_t> UTAP::SignalFlow::str2strs_t

Definition at line 67 of file signalflow.h.

◆ strs_t

typedef std::set<const char*, const less_str> UTAP::SignalFlow::strs_t

Definition at line 64 of file signalflow.h.

Constructor & Destructor Documentation

◆ SignalFlow()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~SignalFlow()

SignalFlow::~SignalFlow ( )
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().

Here is the caller graph for this function:

Member Function Documentation

◆ addChan()

void SignalFlow::addChan ( const std::string &  s,
strs_t ids,
str2procs_t index 
)
protected

Definition at line 394 of file signalflow.cpp.

References cChan, channels, and cTA.

Referenced by visitExpression().

Here is the caller graph for this function:

◆ addVar()

void SignalFlow::addVar ( const symbol_t s,
str2strs_t ids,
str2procs_t index 
)
protected

Definition at line 407 of file signalflow.cpp.

References cChan, checkParams(), cTA, UTAP::symbol_t::getName(), and variables.

Referenced by visitExpression().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkParams()

bool SignalFlow::checkParams ( const symbol_t s)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ popIO()

void UTAP::SignalFlow::popIO ( )
inlineprotected

Definition at line 103 of file signalflow.h.

References printChansOnEdgesForDot(), printChansSeparateForDot(), printProcsForDot(), printVarsForDot(), printVarsReadForDot(), printVarsWriteForDot(), and SignalFlow().

Referenced by visitExpression().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printChansOnEdgesForDot()

void SignalFlow::printChansOnEdgesForDot ( std::ostream &  os)
protectedvirtual

Definition at line 197 of file signalflow.cpp.

References ch, procs, receivers, and transmitters.

Referenced by popIO(), and printForDot().

Here is the caller graph for this function:

◆ printChansSeparateForDot()

void SignalFlow::printChansSeparateForDot ( std::ostream &  os,
bool  ranked,
bool  erd 
)
protectedvirtual

Definition at line 290 of file signalflow.cpp.

References channels, and procs.

Referenced by popIO(), and printForDot().

Here is the caller graph for this function:

◆ printForDot()

void SignalFlow::printForDot ( std::ostream &  os,
bool  ranked,
bool  erd,
bool  cEdged 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printForTron()

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().

Here is the caller graph for this function:

◆ printProcsForDot()

void SignalFlow::printProcsForDot ( std::ostream &  os,
bool  erd 
)
protectedvirtual

Reimplemented in UTAP::DistanceCalculator.

Definition at line 101 of file signalflow.cpp.

References procs.

Referenced by popIO(), and printForDot().

Here is the caller graph for this function:

◆ printVarsForDot()

void SignalFlow::printVarsForDot ( std::ostream &  os,
bool  ranked,
bool  erd 
)
protectedvirtual

Reimplemented in UTAP::DistanceCalculator.

Definition at line 120 of file signalflow.cpp.

References transmitters, and variables.

Referenced by popIO(), and printForDot().

Here is the caller graph for this function:

◆ printVarsReadForDot()

void SignalFlow::printVarsReadForDot ( std::ostream &  os)
protectedvirtual

Definition at line 175 of file signalflow.cpp.

References procs.

Referenced by popIO(), and printForDot().

Here is the caller graph for this function:

◆ printVarsWriteForDot()

void SignalFlow::printVarsWriteForDot ( std::ostream &  os)
protectedvirtual

Definition at line 153 of file signalflow.cpp.

References procs.

Referenced by popIO(), and printForDot().

Here is the caller graph for this function:

◆ pushIO()

void UTAP::SignalFlow::pushIO ( )
inlineprotected

Definition at line 100 of file signalflow.h.

Referenced by visitExpression().

Here is the caller graph for this function:

◆ setVerbose()

◆ visitAssertStatement()

int32_t SignalFlow::visitAssertStatement ( UTAP::AssertStatement stat)
overridevirtual

Implements UTAP::StatementVisitor.

Definition at line 778 of file signalflow.cpp.

Referenced by setVerbose().

Here is the caller graph for this function:

◆ visitBlockStatement()

int32_t SignalFlow::visitBlockStatement ( BlockStatement stat)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ visitBreakStatement()

int32_t SignalFlow::visitBreakStatement ( BreakStatement stat)
overridevirtual

Implements UTAP::StatementVisitor.

Definition at line 768 of file signalflow.cpp.

Referenced by setVerbose().

Here is the caller graph for this function:

◆ visitCaseStatement()

int32_t SignalFlow::visitCaseStatement ( CaseStatement stat)
overridevirtual

Implements UTAP::StatementVisitor.

Definition at line 747 of file signalflow.cpp.

References UTAP::CaseStatement::cond, visitBlockStatement(), and visitExpression().

Referenced by setVerbose().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ visitContinueStatement()

int32_t SignalFlow::visitContinueStatement ( ContinueStatement stat)
overridevirtual

Implements UTAP::StatementVisitor.

Definition at line 773 of file signalflow.cpp.

Referenced by setVerbose().

Here is the caller graph for this function:

◆ visitDefaultStatement()

int32_t SignalFlow::visitDefaultStatement ( DefaultStatement stat)
overridevirtual

Implements UTAP::StatementVisitor.

Definition at line 753 of file signalflow.cpp.

References visitBlockStatement().

Referenced by setVerbose().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ visitDoWhileStatement()

int32_t SignalFlow::visitDoWhileStatement ( DoWhileStatement stat)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ visitEmptyStatement()

int32_t SignalFlow::visitEmptyStatement ( EmptyStatement stat)
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().

Here is the caller graph for this function:

◆ visitExpression()

void SignalFlow::visitExpression ( const expression_t e)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ visitExprStatement()

int32_t SignalFlow::visitExprStatement ( ExprStatement stat)
overridevirtual

Implements UTAP::StatementVisitor.

Definition at line 696 of file signalflow.cpp.

References UTAP::ExprStatement::expr, and visitExpression().

Referenced by setVerbose().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ visitForStatement()

int32_t SignalFlow::visitForStatement ( ForStatement stat)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ visitIfStatement()

int32_t SignalFlow::visitIfStatement ( IfStatement stat)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ visitIterationStatement()

int32_t SignalFlow::visitIterationStatement ( IterationStatement stat)
overridevirtual

Implements UTAP::StatementVisitor.

Definition at line 702 of file signalflow.cpp.

References UTAP::Statement::accept(), and UTAP::IterationStatement::stat.

Referenced by setVerbose().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ visitProcess()

void SignalFlow::visitProcess ( instance_t p)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ visitReturnStatement()

int32_t SignalFlow::visitReturnStatement ( ReturnStatement stat)
overridevirtual

Implements UTAP::StatementVisitor.

Definition at line 783 of file signalflow.cpp.

References UTAP::ReturnStatement::value, and visitExpression().

Referenced by setVerbose().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ visitSwitchStatement()

int32_t SignalFlow::visitSwitchStatement ( SwitchStatement stat)
overridevirtual

Implements UTAP::StatementVisitor.

Definition at line 741 of file signalflow.cpp.

References UTAP::SwitchStatement::cond, visitBlockStatement(), and visitExpression().

Referenced by setVerbose().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ visitWhileStatement()

int32_t SignalFlow::visitWhileStatement ( WhileStatement stat)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ cChan

const char* UTAP::SignalFlow::cChan
protected

Definition at line 88 of file signalflow.h.

Referenced by addChan(), addVar(), and visitProcess().

◆ channels

strs_t UTAP::SignalFlow::channels
protected

◆ chanString

std::string UTAP::SignalFlow::chanString
protected

Definition at line 89 of file signalflow.h.

Referenced by visitExpression().

◆ cP

instance_t* UTAP::SignalFlow::cP
protected

Definition at line 87 of file signalflow.h.

Referenced by checkParams(), and visitProcess().

◆ cTA

proc_t* UTAP::SignalFlow::cTA
protected

Definition at line 86 of file signalflow.h.

Referenced by addChan(), addVar(), visitExpression(), and visitProcess().

◆ inp

bool UTAP::SignalFlow::inp
protected

Definition at line 90 of file signalflow.h.

Referenced by visitExpression().

◆ ioStack

std::stack<std::pair<bool, bool> > UTAP::SignalFlow::ioStack
protected

Definition at line 91 of file signalflow.h.

◆ out

bool UTAP::SignalFlow::out
protected

Definition at line 90 of file signalflow.h.

Referenced by set_remove(), and visitExpression().

◆ paramsExpanded

bool UTAP::SignalFlow::paramsExpanded
protected

Definition at line 90 of file signalflow.h.

Referenced by checkParams().

◆ processes

strs_t UTAP::SignalFlow::processes
protected

◆ procs

◆ receivers

◆ refparams

std::stack<exprref_t> UTAP::SignalFlow::refparams
protected

Definition at line 92 of file signalflow.h.

Referenced by visitExpression().

◆ sync

bool UTAP::SignalFlow::sync
protected

Definition at line 90 of file signalflow.h.

Referenced by visitExpression().

◆ title

const char* UTAP::SignalFlow::title
protected

Definition at line 82 of file signalflow.h.

Referenced by printForDot(), and UTAP::Partitioner::printForDot().

◆ transmitters

◆ valparams

std::stack<exprref_t> UTAP::SignalFlow::valparams
protected

Definition at line 93 of file signalflow.h.

Referenced by visitExpression().

◆ variables

◆ verbosity


The documentation for this class was generated from the following files: