Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

Machine Class Reference

Stores all information about a machine. More...

#include <Machine.h>

Inheritance diagram for Machine::

List of all members.

Public Slots

void updateCanvasSize (int, int, double)
 Updates the canvas size with a new point. More...

void updateCanvasSize (int, int)
 Updates the canvas size. More...


Signals

void newCanvasSize (int, int)
 Emited when the canvas size needs to be set to a new value.


Public Methods

 Machine (QObject *parent=NULL, const char *name=0)
 Constructor.

 Machine (QObject *name, const QString, QString, int type, int, QString, int, QString, int, QString, QFont, QFont, int)
 Constructor. More...

 ~Machine ()
 Destructor.

GStategetInitialState ()
 Returns initial state of the machine.

void setInitialState (GState *s)
 Sets the initial state of the machine to s.

GITransitiongetInitialTransition ()
 Returns the initial transition.

void setInitialTransition (GITransition *t)
 Sets the initial transition.

void attachInitialTransition ()
 Attaches initial transition graphically to the initial state.

GStategetPhantomState ()
 Returns the phantom state. More...

void setPhantomState (GState *s)
 Sets the phantom state.

QList< GState > & getSList ()
 Returns the state list.

QString getName ()
 Returns the name of the machine.

void setName (const QString n)
 Sets the name of the machine.

QString getVersion ()
 Returns the version of the machine.

void setVersion (QString v)
 Sets the version of the machine.

int getType ()
 Returns the type of the machine. 0: Binary / 1: ASCII.

void setType (int t)
 Sets the type of the machine to t.

int getNumBits ()
 Returns the number of bits used to code the state.

void setNumBits (int)
 Sets the number of bits.

int getNumInputs ()
 Returns the number of input bits.

void setNumInputs (int)
 Sets the number of input bits.

int getNumOutputs ()
 Returns the number of output bits.

void setNumOutputs (int)
 Sets the number of output bits.

QFont & getSFont ()
 Returns the font used to draw the state names.

void setSFont (const QFont &f)
 Sets the font used to draw the state names.

QFont & getTFont ()
 Returns the font used to draw the transition conditions.

void setTFont (const QFont &f)
 Sets the font used to draw the transition conditions.

int getArrowType ()
 Returns the arrow type (0: unfilled, 1: filled).

void setArrowType (int t)
 Sets the arrow type (0: unfilled, 1: filled).

void setProject (Project *p)
 Returns a pointer to the current project.

ProjectgetProject ()
 Returns a pointer to the project.

int countStates ()
 Returns the number of states in the machine.

int getNewCode ()
 Returns a new state code (as integer value).

bool addState (const QString, QString, int, double, double, int, double, QPen, bool endstate, bool withundo=TRUE)
 Adds a new state to the machine. More...

bool addState (GState *, bool withundo=TRUE)
 Adds a state to the machine. More...

GStategetState (QPoint, double)
 Returns the state which lies on (near to) the point at the scale scale.

GObjectgetObject (QPoint p, double scale, int &type)
 Returns the graphical object which lies on a point. More...

void removeState (GState *)
 Removes state s from the machine.

GStategetState (int)
 Returns the state with the code code.

QList< GStategetEndStates ()
 Returns a list of end states of this machine.

void getCanvasSize (int &w, int &h)
 Returns current canvas size.

void setCanvasSize (int, int)
 Sets the canvas (scroll view) size to x, y.

void calcCanvasSize ()
 Calculates the canvas size according to the states and transitions in the machine.

int getNumStates ()
 Returns the number of states in the machine.

void setMooreOutputNames (int, QString)
 Completes the moore output names string. More...

QString getMooreOutputNames (QString separator=",")
 Returns the moore output names separated by separator.

void setMealyInputNames (int, QString)
 Completes the mealy input names. More...

QString getMealyInputNames (QString separator=",")
 Returns the mealy input names separated by separator.

void setMealyOutputNames (int, QString)
 Completes the mealy output names. More...

QString getMealyOutputNames (QString separator=",")
 Returns the mealy output names separated by separator.

QStringList getMooreOutputList ()
 Returns the list of moore output names.

void setMooreOutputList (QStringList l)
 Sets the list of moore output names.

QStringList getInputNameList ()
 Returns the list of input names.

void setInputNameList (QStringList l)
 Sets the list of input names.

QStringList getOutputNameList ()
 Returns the list of output names.

void setOutputNameList (QStringList l)
 Sets the list of output names.

void checkIntegrity (ICheck *)
 Checks the integrity of the machine and displays the results in a dialog.

void getEventList (QList< IOInfo > *)
 Returns a list of all events covered by a transition of the machine.


Static Public Methods

void replaceChar (QString &s, QChar c1, QChar c2)
 Replaces in string s all occurences of c1 with c2.


Private Attributes

Projectproject
 Pointer to the project this machine belongs to.

QString name
 Name of the machine.

QString version
 Version of the machine.

int type
 Type: 0: Binary / 1: ASCII.

int num_bits
 Number of bits to code the states.

int num_input
 Number of bits for the input conditions.

int num_output
 Number of bits for the outputs.

QStringList input_names
 Names of the input bits.

QStringList output_names
 Names of the output bits.

QStringList output_names_moore
 Names of the moore outputs (state coding).

QFont state_font
 Font for the state name.

QFont transition_font
 Font for the transition.

int arrow_type
 Arrow type: 0: line arrow / 1: solid arrow.

QList< GStatestate_list
 List of states.

GStateinitial_state
 Pointer to the start state (initial state).

GStatephantom_state
 Phantom state.

GITransitioninitial_transition
 Start transition (initial transition).

QSize canvas_size
 Size of the drawing area.


Detailed Description

Stores all information about a machine.


Constructor & Destructor Documentation

Machine::Machine QObject * parent,
const QString n,
QString v,
int t,
int nb,
QString onamesm,
int ni,
QString inames,
int no,
QString onames,
QFont sf,
QFont tf,
int atype
 

Constructor.

Parameters:
parent   parent object
n   name of machine
t   type of machine
nb   number of bits for states
ni   number of input bits
inames   names of input bits
no   number of output bits
onames   names of output bits
sf   font used for drawing the state names
tf   font used for drawing the transition conditions
atype   arrow type (0: unfilled, 1: filled)


Member Function Documentation

bool Machine::addState GState * s,
bool withundo = TRUE
 

Adds a state to the machine.

Parameters:
s   State to add
withundo   If TRUE this step can be undone
Returns:
TRUE if successful

bool Machine::addState const QString sname,
QString sdescription,
int code,
double xpos,
double ypos,
int radius,
double scale,
QPen pen,
bool endstate,
bool withundo = TRUE
 

Adds a new state to the machine.

Parameters:
sname   state name
code   state code
xpos   x position
ypos   y position
radius   radius of circle
scale   current scale
pen   pen used to draw the state

GObject * Machine::getObject QPoint p,
double scale,
int & type
 

Returns the graphical object which lies on a point.

The type of the object will be stored in type.

Parameters:
p   point the resulting object will lie on (near to)
scale   current scale
type   type of the object

GState* Machine::getPhantomState [inline]
 

Returns the phantom state.

A phantom state is the state containing all the transitions which have no starting states.

void Machine::setMealyInputNames int num,
QString string
 

Completes the mealy input names.

Parameters:
num   Number of mealy inputs of the machine
string   Input string

void Machine::setMealyOutputNames int num,
QString string
 

Completes the mealy output names.

Parameters:
num   Number of mealy outputs of the machine
string   Input string

void Machine::setMooreOutputNames int num,
QString string
 

Completes the moore output names string.

Output names that are not given are named "s_out" + the bit number

Parameters:
num   Number of moore outputs (state coding bits)
string   Input string

void Machine::updateCanvasSize int x,
int y
[slot]
 

Updates the canvas size.

The coordinates are already transformed into scale factor 1.0

void Machine::updateCanvasSize int x,
int y,
double scale
[slot]
 

Updates the canvas size with a new point.

If the point with the coordinates x and y at the scale scale lies outside the current scroll view, the size will be adjusted accordingly


The documentation for this class was generated from the following files:
Generated at Fri Apr 11 22:37:16 2003 for Qfsm by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001