libutap
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
UTAP::Partitioner Class Reference

Partitions the system into environment and IUT according to TRON assumptions. More...

#include <signalflow.h>

Inheritance diagram for UTAP::Partitioner:
UTAP::SignalFlow UTAP::StatementVisitor

Public Member Functions

 Partitioner (const char *_title, TimedAutomataSystem &ta)
 
 ~Partitioner ()
 
int partition (const strs_t &inputs, const strs_t &outputs)
 
int partition (std::istream &ioinfo)
 
void printForDot (std::ostream &os, bool ranked, bool erd, bool cEdged)
 Print I/O information in DOT format into given output stream. More...
 
void printViolation (const proc_t *process, const char *variable)
 
void fillWithEnvProcs (strs_t &procs)
 
void fillWithIUTProcs (strs_t &procs)
 
- Public Member Functions inherited from UTAP::SignalFlow
 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...
 
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

void addProcs (const strs_t &chans, const str2procs_t &index, procs_t &result, procs_t &exclude)
 Adds processes to the result which use the channels from chans list according to index. More...
 
void addIntChans (const procs_t &procs, strs_t &result, strs_t &exclude)
 Takes the internal channels of each process from procs list and adds them to the result list. More...
 
void addIntVars (const procs_t &procs, strs_t &result, strs_t &exclude)
 Takes the variables of each process from procs list and adds them to the result list. More...
 
void addProcsByVars (const strs_t &vars, procs_t &procs, procs_t &exclude)
 Take all variables and add all accessing processes to the list. More...
 
- Protected Member Functions inherited from UTAP::SignalFlow
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

procs_t procsEnv
 
procs_t procsIUT
 
procs_t procsBad
 
strs_t chansIntEnv
 
strs_t chansIntIUT
 
strs_t observable
 
strs_t chansBad
 
strs_t varsEnv
 
strs_t varsIUT
 
strs_t varsBad
 
strs_t chansInp
 
strs_t chansOut
 
const char * rule
 
- Protected Attributes inherited from UTAP::SignalFlow
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
 

Additional Inherited Members

- Public Types inherited from UTAP::SignalFlow
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
 

Detailed Description

Partitions the system into environment and IUT according to TRON assumptions.

inputs/outputs are channel names. Environment processes shout on inputs and listens to outputs, while IUT processes shout on outputs and listen to inputs. There are additional rules to complete the partitioning (to cathegorize the internal processes): 1) channels, that are not declared as inputs/outputs, are non-observable, called internal. 2) internal channel belongs to environment (IUT) if it is used by environment (IUT) process (respectively). Model is inconsistent and cannot be partitioned if the internal channel is used by both environment and IUT. 3) process belongs to environment (IUT) if it uses the internal environment (IUT) channel (respectively). 4) variable belongs to environment (IUT) if it is accessed by environment (IUT) process without observable input/output channel synchronization. Variable is not cathegorized (can be either) if accessed consistently only during observable input/output channel synchronization. 5) process belongs to environment (IUT) if accesses environment (IUT) variable (respectively) without observable channel synchronization. Returns: 0 if partitioning was consistent and complete, 1 if partitioning was consistent but incomplete (some proc/chan is free) 2 if partitioning was inconsistent (some proc/chan/var is both Env and IUT)

Constructor & Destructor Documentation

UTAP::Partitioner::Partitioner ( const char *  _title,
TimedAutomataSystem ta 
)
inline
Partitioner::~Partitioner ( )

References chansInp, chansOut, and free().

Member Function Documentation

void Partitioner::addIntChans ( const procs_t procs,
strs_t result,
strs_t exclude 
)
protected

Takes the internal channels of each process from procs list and adds them to the result list.

Reports inconcistency if channel is in the exclude list.

References chansBad, observable, printViolation(), rule, and UTAP::SignalFlow::verbosity.

Referenced by partition().

void Partitioner::addIntVars ( const procs_t procs,
strs_t result,
strs_t exclude 
)
protected

Takes the variables of each process from procs list and adds them to the result list.

Reports inconcistency if variable is in the exclude list.

References observable, printViolation(), rule, varsBad, and UTAP::SignalFlow::verbosity.

Referenced by partition().

void Partitioner::addProcs ( const strs_t chans,
const str2procs_t index,
procs_t result,
procs_t exclude 
)
protected

Adds processes to the result which use the channels from chans list according to index.

Reports inconsistency if some process happens to be in exclude list.

References printViolation(), procsBad, rule, and UTAP::SignalFlow::verbosity.

Referenced by partition().

void Partitioner::addProcsByVars ( const strs_t vars,
procs_t procs,
procs_t exclude 
)
protected

Take all variables and add all accessing processes to the list.

Report inconcistencies if process happens to be in exclude list.

References observable, printViolation(), procsBad, UTAP::SignalFlow::receivers, rule, UTAP::SignalFlow::transmitters, and UTAP::SignalFlow::verbosity.

Referenced by partition().

void Partitioner::fillWithEnvProcs ( strs_t procs)

References procsEnv.

void Partitioner::fillWithIUTProcs ( strs_t procs)

References procsIUT.

int Partitioner::partition ( const strs_t inputs,
const strs_t outputs 
)
int UTAP::Partitioner::partition ( std::istream &  ioinfo)
void Partitioner::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 from UTAP::SignalFlow.

References BADSTYLE, ch, UTAP::SignalFlow::channels, chansBad, chansInp, chansIntEnv, chansIntIUT, chansOut, ENVSTYLE, IUTSTYLE, MEDSTYLE, UTAP::SignalFlow::processes, UTAP::SignalFlow::procs, procsBad, procsEnv, procsIUT, UTAP::SignalFlow::receivers, set_remove(), UTAP::SignalFlow::title, UTAP::SignalFlow::transmitters, UTAP::SignalFlow::variables, varsBad, varsEnv, and varsIUT.

void Partitioner::printViolation ( const proc_t process,
const char *  variable 
)
inline

Member Data Documentation

strs_t UTAP::Partitioner::chansBad
protected

Referenced by addIntChans(), partition(), and printForDot().

strs_t UTAP::Partitioner::chansInp
protected
strs_t UTAP::Partitioner::chansIntEnv
protected

Referenced by partition(), and printForDot().

strs_t UTAP::Partitioner::chansIntIUT
protected

Referenced by partition(), and printForDot().

strs_t UTAP::Partitioner::chansOut
protected
strs_t UTAP::Partitioner::observable
protected
procs_t UTAP::Partitioner::procsBad
protected
procs_t UTAP::Partitioner::procsEnv
protected
procs_t UTAP::Partitioner::procsIUT
protected
const char* UTAP::Partitioner::rule
protected
strs_t UTAP::Partitioner::varsBad
protected

Referenced by addIntVars(), partition(), and printForDot().

strs_t UTAP::Partitioner::varsEnv
protected

Referenced by partition(), and printForDot().

strs_t UTAP::Partitioner::varsIUT
protected

Referenced by partition(), and printForDot().


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