FSM Library - C++ version
Public Member Functions | Friends | List of all members
OFSMTable Class Reference

#include <OFSMTable.h>

Public Member Functions

 OFSMTable (const std::vector< std::shared_ptr< FsmNode >> &nodes, const int maxInput, const int maxOutput, const std::shared_ptr< FsmPresentationLayer > presentationLayer)
 
 OFSMTable (const int numStates, const int maxInput, const int maxOutput, const std::vector< std::shared_ptr< OFSMTableRow >> &rows, const std::shared_ptr< FsmPresentationLayer > presentationLayer)
 
int getId ()
 
S2CMap getS2C ()
 
void setS2C (const S2CMap &ps2c)
 
int get (const int id, const int x, const int y)
 
int maxClassId () const
 
std::shared_ptr< OFSMTablenext ()
 
std::string getMembers (const int c) const
 
Fsm toFsm (const std::string &name) const
 

Friends

std::ostream & operator<< (std::ostream &out, const OFSMTable &ofsmTable)
 

Detailed Description

Table representation for observable FSMs

The table structure is as follows.

  1. One row for each FSM state, the FSM state number in 0..nodes.length-1 is the table index.
  2. Each row r has the following matrix structure. (a) The matrix is indexed over inputs i in 0..maxInput and outputs o in 0..maxOutput (b) If FSM state r has no transition labelled with i/o, then the matrix contains value -1 at position [i][o] (c) If FSM state r transits with i/o to post-state r', then the matrix contains value r' at position [i][o]
Note
This representation is well-defined if and only if the FSM is observable.

Additionally, each OFSMTable contains an S2CMap which maps FSM states to their equivalence class associated with the current OFSMTable

Constructor & Destructor Documentation

OFSMTable::OFSMTable ( const std::vector< std::shared_ptr< FsmNode >> &  nodes,
const int  maxInput,
const int  maxOutput,
const std::shared_ptr< FsmPresentationLayer presentationLayer 
)

This constructor creates the initial OFSMTable for an observable FSM. All nodes are associated with equivalence class 0.

Parameters
nodesarray of FSM states
maxInputinput alphabet is in range 0..maxInput
maxOutputoutput alphabet is in range 0..maxOutput
presentationLayerThe presentation layer used by the OFSMTable

Member Function Documentation

int OFSMTable::get ( const int  id,
const int  x,
const int  y 
)

Get table entry for given state and I/O

Parameters
idstate id in range 0..(nodes.length-1)
xinput value in range 0..maxInput
youtput value in range 0..maxOutput
Returns
-1 if FSM state id does not have an outgoing transition labelled by x/y n >= 0 if FSM state id has an outgoing transition labelled by x/y, which ends at FSM state n
std::string OFSMTable::getMembers ( const int  c) const

Return members of an equivalence class c as set string

Here is the caller graph for this function:

std::shared_ptr< OFSMTable > OFSMTable::next ( )

Create the next OFSMTable on the basis of the current table.

Returns
The next OFSMTable if it exists, null otherwise
Fsm OFSMTable::toFsm ( const std::string &  name) const

Create minimised FSM from OFSM-Table

Parameters
namethe name for the FSM to be created
Returns
the FSM instance
Note
This operation expects that this OFSMTable is already the last one in a sequence of OFSMTable transformations, so that it really represents the minimised FSM.

Here is the call graph for this function:

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const OFSMTable ofsmTable 
)
friend

Produce a stream given a tabular LaTeX representation of the OFSMTable, to be included in a LaTeX document.


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