libutap
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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:
UTAP::StatementVisitor UTAP::DistanceCalculator UTAP::Partitioner

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)
 System visitor pattern extracts read/write information from UCode. More...
 
int32_t visitExprStatement (ExprStatement *stat)
 
int32_t visitForStatement (ForStatement *stat)
 
int32_t visitIterationStatement (IterationStatement *stat)
 
int32_t visitWhileStatement (WhileStatement *stat)
 
int32_t visitDoWhileStatement (DoWhileStatement *stat)
 
int32_t visitBlockStatement (BlockStatement *stat)
 
int32_t visitSwitchStatement (SwitchStatement *stat)
 
int32_t visitCaseStatement (CaseStatement *stat)
 
int32_t visitDefaultStatement (DefaultStatement *stat)
 
int32_t visitIfStatement (IfStatement *stat)
 
int32_t visitBreakStatement (BreakStatement *stat)
 
int32_t visitContinueStatement (ContinueStatement *stat)
 
int32_t visitReturnStatement (ReturnStatement *stat)
 
int32_t visitAssertStatement (UTAP::AssertStatement *stat)
 
- 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

Member Typedef Documentation

typedef std::map<const proc_t*, strs_t> UTAP::SignalFlow::proc2strs_t
typedef std::set<proc_t*> UTAP::SignalFlow::procs_t
typedef std::map<const char*, procs_t, less_str> UTAP::SignalFlow::str2procs_t
typedef std::map<const char*, strs_t> UTAP::SignalFlow::str2strs_t
typedef std::set<const char*, const less_str> UTAP::SignalFlow::strs_t

Constructor & Destructor Documentation

SignalFlow::SignalFlow ( const char *  _title,
TimedAutomataSystem ta 
)

Analyse the system and extract I/O information:

References UTAP::TimedAutomataSystem::getProcesses(), and visitProcess().

SignalFlow::~SignalFlow ( )
virtual

All strings are from TASystem (don't dispose TASystem before SignalFlow).

References channels, and procs.

Member Function Documentation

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

References cChan, channels, and cTA.

Referenced by visitExpression().

void SignalFlow::addVar ( const symbol_t s,
str2strs_t ids,
str2procs_t index 
)
protected
bool SignalFlow::checkParams ( const symbol_t s)
protected
void UTAP::SignalFlow::popIO ( )
inlineprotected

Referenced by visitExpression().

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

References ch, procs, receivers, and transmitters.

Referenced by printForDot().

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

References channels, and procs.

Referenced by 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.

References channels, printChansOnEdgesForDot(), printChansSeparateForDot(), printProcsForDot(), printVarsForDot(), printVarsReadForDot(), printVarsWriteForDot(), procs, title, and variables.

Referenced by main(), and UTAP::DistanceCalculator::printForDot().

void SignalFlow::printForTron ( std::ostream &  os)

Print I/O information in TRON format into given output stream.

References procs.

Referenced by main().

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

Reimplemented in UTAP::DistanceCalculator.

References procs.

Referenced by printForDot().

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

Reimplemented in UTAP::DistanceCalculator.

References transmitters, and variables.

Referenced by printForDot().

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

References procs.

Referenced by printForDot().

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

References procs.

Referenced by printForDot().

void UTAP::SignalFlow::pushIO ( )
inlineprotected

Referenced by visitExpression().

void UTAP::SignalFlow::setVerbose ( int  verbose)
inline

Referenced by main().

int32_t SignalFlow::visitAssertStatement ( UTAP::AssertStatement stat)
virtual
int32_t SignalFlow::visitBlockStatement ( BlockStatement stat)
virtual
int32_t SignalFlow::visitBreakStatement ( BreakStatement stat)
virtual
int32_t SignalFlow::visitCaseStatement ( CaseStatement stat)
virtual
int32_t SignalFlow::visitContinueStatement ( ContinueStatement stat)
virtual
int32_t SignalFlow::visitDefaultStatement ( DefaultStatement stat)
virtual
int32_t SignalFlow::visitDoWhileStatement ( DoWhileStatement stat)
virtual
int32_t SignalFlow::visitEmptyStatement ( EmptyStatement stat)
virtual

System visitor pattern extracts read/write information from UCode.

This is actually "const" visitor and should contain "const Statement *stat".

Implements UTAP::StatementVisitor.

void SignalFlow::visitExpression ( const expression_t e)
protected

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

int32_t SignalFlow::visitExprStatement ( ExprStatement stat)
virtual
int32_t SignalFlow::visitForStatement ( ForStatement stat)
virtual
int32_t SignalFlow::visitIfStatement ( IfStatement stat)
virtual
int32_t SignalFlow::visitIterationStatement ( IterationStatement stat)
virtual
void SignalFlow::visitProcess ( instance_t p)
protected
int32_t SignalFlow::visitReturnStatement ( ReturnStatement stat)
virtual
int32_t SignalFlow::visitSwitchStatement ( SwitchStatement stat)
virtual
int32_t SignalFlow::visitWhileStatement ( WhileStatement stat)
virtual

Member Data Documentation

const char* UTAP::SignalFlow::cChan
protected

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

strs_t UTAP::SignalFlow::channels
protected
std::string UTAP::SignalFlow::chanString
protected

Referenced by visitExpression().

instance_t* UTAP::SignalFlow::cP
protected

Referenced by checkParams(), and visitProcess().

proc_t* UTAP::SignalFlow::cTA
protected
bool UTAP::SignalFlow::inp
protected

Referenced by visitExpression().

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

Referenced by visitExpression().

bool UTAP::SignalFlow::paramsExpanded
protected

Referenced by checkParams().

strs_t UTAP::SignalFlow::processes
protected
procs_t UTAP::SignalFlow::procs
protected
str2procs_t UTAP::SignalFlow::receivers
protected
std::stack<exprref_t> UTAP::SignalFlow::refparams
protected

Referenced by visitExpression().

bool UTAP::SignalFlow::sync
protected

Referenced by visitExpression().

const char* UTAP::SignalFlow::title
protected
str2procs_t UTAP::SignalFlow::transmitters
protected
std::stack<exprref_t> UTAP::SignalFlow::valparams
protected

Referenced by visitExpression().

strs_t UTAP::SignalFlow::variables
protected
int UTAP::SignalFlow::verbosity
protected

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