DiaDes  0.1
DIAgnosis of Discrete-Event System
Enumerations | Functions | Variables
Component2Dot.cc File Reference
#include <iostream>
#include <fstream>
#include <list>
#include <string>
#include <set>
#include <boost/program_options.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <diades/automata/Event.hh>
#include <diades/automata/ObservableComponent.hh>
#include "CmdInterface.hh"

Go to the source code of this file.

Enumerations

enum  Option {
  OUTPUT =0, VERBOSE =1, EVENTS =2, NOTEVENTS =3,
  HELP =4, STATEABSTRACTIONS = 5, EVENT = 0, HELP = 1,
  OUTPUT =0, HELP = 0, EVENTS = 1, EVENTNB = 2,
  STATES = 3, STATENB = 4, TRANSITIONS = 5, TRANSITIONNB = 6,
  OBSERVABLES = 7, OBSERVABLENB = 8, UNOBSERVABLES = 9, UNOBSERVABLENB =10,
  INITIALSTATES = 11, INITIALSTATENB = 12, NAME = 13, STATISTICS = 14,
  STATEMIN = 0, STATEMAX = 1, OBSMIN = 2, OBSMAX = 3,
  EVTMIN = 4, EVTMAX = 5, SEED = 6, DIRNAME = 7,
  LATEXFILENAME = 8, TOPOLOGYFILENAME = 9, OBSINTERACTIONMIN = 10, OBSINTERACTIONMAX = 11,
  NODEBEHAVIOUR = 12, HELP = 13, OUTPUTDEGREEMAX = 14, PETRINET = 15,
  STATISTICS =0, HELP =1, FAULTS = 2, NOFAILURES =0,
  FAILURES =1, OBSERVABLES =2, HDFILE =3, DOTFILE =4,
  CPPFILE =5, WITHSILENTCLOSURE =6, HELP =7, FAULTMAX =0,
  SEED =1, HELP =2, HELP =0, FAULTS = 0,
  ALGORITHMS = 1, HELP = 0, EVENTS = 1, TIMEDEVENTS = 2,
  OBSERVATIONS = 3, TIMEDOBSERVATIONS = 4, FAULTS = 5, OBSMIN = 0,
  OBSMAX = 1, TIMEMIN = 2, TIMEMAX = 3, NOEVT = 4,
  SEED = 5, XML = 6, GENERATEFAULTS = 7, HELP = 8,
  INTERACTIVE = 9, PTALOG = 10, NBSIM = 11, HELP =0,
  COMPONENTS =0, EVENTS =1, NUMBER =2, CONNECTIONWITHEVENT =3,
  HELP =4
}
 
enum  FileExtension {
  DESCOMP =0, DESCOMP =0, RULES =1, DESCOMP =0,
  DESCOMP =0, RULES =1, XML =2, ABSTRACTION = 3,
  DIAGNOSER = 4, DESCOMP =0, ARCHV = 0, DESCOMP =0,
  RULES =1, XML =2, DESCOMP = 0, RULES = 1,
  XML =0, RULES =0
}
 

Functions

vector< string > fileExtensions (numberOfFileExtensions)
 
vector< string > options (numberOfOptions)
 
vector< bool > isSet (numberOfOptions, false)
 
void initialiseOptions ()
 
void exportToDot (const string &filename, int depth, const vector< string > &states, ostream &out)
 
void exportBackwardToDot (const string &filename, int depth, const vector< string > &states, ostream &out)
 
void checkDescompFile (const string &filename)
 
int main (int argc, char *argv[])
 
void getStartingStates (const Component &component, const vector< string > &states, std::vector< Diades::Automata::State > &startingStates)
 

Variables

unsigned numberOfOptions = 1
 
unsigned numberOfFileExtensions = 1
 
string description ="Usage: dd-component-to-dot [file1.des_comp file2.des_comp file3.des_comp...] [--output template]\n\t Compute the dot graph associated to the component files. If no file as parameters,\n\t read the models from the standard input.\n\tIf --output is set with the name 'template' then the written dot files have\n\t the following names: 'template0.dot template1.dot...'\n\tIf no --output is set, write the result to the standard output "
 

Detailed Description

This file is the main file of the command component_to_dot.

This command exports the given components (des_comp format) to 'graphviz/dot' format.

Options:
  -h [ --help ]          Help about the command line.
  -o [ --output ] arg    Output file template (if several files are exported 
                         they are written to the files template0.dot 
                         template1.dot ...) or output file name if only one 
                         file to display (not that if this option is not set, 
                         it displays the result on the standard output).
  -d [ --depth ] arg     The maximal depth to visit from the given states (if 
                         depth is unset, there is no limit).
  -s [ --state ] arg     State from which the display can start (if this option
                         is unset, the display starts from the initial states 
                         of the component. Many states can be added as follows:
                         -s q1 q2  and/or -s q1 -s q2 q3...
  -c [ --component ] arg Component to display (many components can be added). 
                         The option '--component/-c f1.des_comp f2.des_comp' 
                         can be simply written as 'f1.des_comp f2.des_comp'.
  -b [ --backward ]      Backward display (visiting source states instead of 
                         target states)

Examples: 
         dd-component-to-dot file.des_comp
         Print the dot format of the component file.des_comp on the standard output

         dd-component-to-dot file1.des_comp file.des_comp
         Print the dot format of the components file1.des_comp and file2.des_comp on the standard output

         dd-component-to-dot file.des_comp -o result.dot
         Print the dot format of the component file.des_comp in the file result.dot

         dd-component-to-dot file1.des_comp file.des_comp -o result
         Print the dot format of the components file1.des_comp and file2.des_comp in the files result0.dot result1.dot

         dd-component-to-dot file.des_comp -d 10
         Print the dot format of the subpart of the component file.des_comp on the standard output from the initial states to the depth 10 

         dd-component-to-dot file.des_comp -d 10 -s q1 q3
         Print the dot format of the subpart of the component file.des_comp on the standard output from states q1 and q3 to the depth 10 

         dd-component-to-dot file.des_comp -d 10 -s q1 q3 
         Print the dot format of the subpart of the component file.des_comp on the standard output from states q1 and q3 to the depth 10 

         dd-component-to-dot file.des_comp -d 10 -s q1 q3 -b
         Print the dot format of the subpart of the component file.des_comp on the standard output from states q1 and q3 to the depth 10 in backward mode (predecessors of q1 and q3)

Compute the dots files

Definition in file Component2Dot.cc.

Enumeration Type Documentation

◆ FileExtension

Enumerator
DESCOMP 
DESCOMP 
RULES 
DESCOMP 
DESCOMP 
RULES 
XML 
ABSTRACTION 
DIAGNOSER 
DESCOMP 
ARCHV 
DESCOMP 
RULES 
XML 
DESCOMP 
RULES 
XML 
RULES 

Definition at line 85 of file Component2Dot.cc.

◆ Option

enum Option
Enumerator
OUTPUT 
VERBOSE 
EVENTS 
NOTEVENTS 
HELP 
STATEABSTRACTIONS 
EVENT 
HELP 
OUTPUT 
HELP 
EVENTS 
EVENTNB 
STATES 
STATENB 
TRANSITIONS 
TRANSITIONNB 
OBSERVABLES 
OBSERVABLENB 
UNOBSERVABLES 
UNOBSERVABLENB 
INITIALSTATES 
INITIALSTATENB 
NAME 
STATISTICS 
STATEMIN 
STATEMAX 
OBSMIN 
OBSMAX 
EVTMIN 
EVTMAX 
SEED 
DIRNAME 
LATEXFILENAME 
TOPOLOGYFILENAME 
OBSINTERACTIONMIN 
OBSINTERACTIONMAX 
NODEBEHAVIOUR 
HELP 
OUTPUTDEGREEMAX 
PETRINET 
STATISTICS 
HELP 
FAULTS 
NOFAILURES 
FAILURES 
OBSERVABLES 
HDFILE 
DOTFILE 
CPPFILE 
WITHSILENTCLOSURE 
HELP 
FAULTMAX 
SEED 
HELP 
HELP 
FAULTS 
ALGORITHMS 
HELP 
EVENTS 
TIMEDEVENTS 
OBSERVATIONS 
TIMEDOBSERVATIONS 
FAULTS 
OBSMIN 
OBSMAX 
TIMEMIN 
TIMEMAX 
NOEVT 
SEED 
XML 
GENERATEFAULTS 
HELP 
INTERACTIVE 
PTALOG 
NBSIM 
HELP 
COMPONENTS 
EVENTS 
NUMBER 
CONNECTIONWITHEVENT 
HELP 

Definition at line 84 of file Component2Dot.cc.

Function Documentation

◆ checkDescompFile()

void checkDescompFile ( const string &  filename)

Definition at line 539 of file Component2Dot.cc.

References Diades::CmdInterface::fileSuffixOk(), and path.

Referenced by initialiseOptions(), and main().

◆ exportBackwardToDot()

void exportBackwardToDot ( const string &  filename,
int  depth,
const vector< string > &  states,
ostream &  out 
)

◆ exportToDot()

void exportToDot ( const string &  filename,
int  depth,
const vector< string > &  states,
ostream &  out 
)

◆ fileExtensions()

vector<string> fileExtensions ( numberOfFileExtensions  )

Referenced by initialiseOptions().

◆ getStartingStates()

void getStartingStates ( const Component component,
const vector< string > &  states,
std::vector< Diades::Automata::State > &  startingStates 
)

◆ initialiseOptions()

void initialiseOptions ( )

◆ isSet()

vector<bool> isSet ( numberOfOptions  ,
false   
)

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 123 of file Component2Dot.cc.

References checkDescompFile(), exportBackwardToDot(), exportToDot(), path, and states.

◆ options()

vector<string> options ( numberOfOptions  )

Referenced by initialiseOptions().

Variable Documentation

◆ description

string description ="Usage: dd-component-to-dot [file1.des_comp file2.des_comp file3.des_comp...] [--output template]\n\t Compute the dot graph associated to the component files. If no file as parameters,\n\t read the models from the standard input.\n\tIf --output is set with the name 'template' then the written dot files have\n\t the following names: 'template0.dot template1.dot...'\n\tIf no --output is set, write the result to the standard output "

Definition at line 94 of file Component2Dot.cc.

◆ numberOfFileExtensions

unsigned numberOfFileExtensions = 1

Definition at line 87 of file Component2Dot.cc.

◆ numberOfOptions

unsigned numberOfOptions = 1

Definition at line 86 of file Component2Dot.cc.