Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

AIFSM Class Reference

#include <AIFSM.h>

List of all members.

Public Member Functions

 AIFSM (AI_FSM_IDS FSMID_)
 AIFSM (AI_FSM_IDS FSMID_, AIState &initialstate_)
AI_FSM_IDS getFSMID () const
bool setInitialState (AIState &initialstate_)
AIState *& getInitialState ()
bool addState (AIState &currentstate_, int input_, AIState &nextstate_)
AIStategetStateByID (int ID_) const
int serialize (std::ofstream &fout_) const
int assemble (std::ifstream &fin_)

Static Public Member Functions

void initAIFSMFileIO ()


Detailed Description

AIFSM - this class does not contain the transitions themselves (see AIState). The role of this class is to store the states, and populate AIStates' transitions after making the following checks: 1) check if currentstate_ and nextstate_ are in the FSM (to maintain uniqueness in "thestates") 2) HELP MAINTAIN MUTUAL EXCLUSIVITY OF STATE TRANSITIONS This is important; a state that can transition to more than one state per input has undefined behavior (at least logically, it will always go to the first state it "finds" - which depends on an implementation that may change).


Constructor & Destructor Documentation

AIFSM::AIFSM AI_FSM_IDS  FSMID_  ) 
 

constructor

Parameters:
FSMID_ the unique identifier for this machine


Member Function Documentation

bool AIFSM::addState AIState currentstate_,
int  input_,
AIState nextstate_
 

ensures that all state transitions added maintain a connected graph with the initial state returns true if operation succeeded

Parameters:
currentstate_ the state to add a transition to (MUST already be in the fsm)
input_ the input to cause a transition from the current state
nextstate_ the state to go to after receiving the input

int AIFSM::assemble std::ifstream &  fin_  ) 
 

assigns this object to one read from a binary file and returns the number of bytes read

Parameters:
fin_ the file stream to read from (opened for binary input)
See also:
serialize()

AI_FSM_IDS AIFSM::getFSMID  )  const [inline]
 

returns the FSMID for this machine

AIState*& AIFSM::getInitialState  )  [inline]
 

returns a pointer to the initial state if it has been set for this finite state machine, 0 otherwise

See also:
setInitialState()

AIState* AIFSM::getStateByID int  ID_  )  const
 

returns 0 if ID_ is not found in the fsm

Parameters:
ID_ the state ID to look for

void AIFSM::initAIFSMFileIO  )  [inline, static]
 

must be called before any call to this classes' serialize or assemble methods

See also:
serialize()

assemble()

int AIFSM::serialize std::ofstream &  fout_  )  const
 

writes this object to a binary file and returns the number of bytes written

Parameters:
fout_ the file stream to write to (opened for binary output)
See also:
assemble()

bool AIFSM::setInitialState AIState initialstate_  ) 
 

the initial state MUST be set before any call to addState, either by this method, or by passing the initial state to the constructor. returns true if operation succeeded. the initial state is only set ONCE per instance of the class

Parameters:
initialstate_ the initial AIState
See also:
getInitialState()


The documentation for this class was generated from the following file:
Generated on Sun Apr 11 05:05:56 2004 for FSM_API by doxygen 1.3.6