Main Page | Modules | Alphabetical List | Compound List | File List | Compound Members | Related Pages

state< T > Class Template Reference
[TuringMachineDefinition]

Single state of turing machine. More...

#include <state.hpp>

List of all members.

Public Types

enum  transition_result { run, halt }

Public Member Functions

 state ()
 Default constructor.

 ~state ()
 trivial destructor.

void create_transition (T read, T write, typename std::vector< state< T > >::size_type next_state, typename infinite_tape< T >::direction move)
 adds a full transition (read, write, move, next_state).

void create_write_transition (T read, T write, typename std::vector< state< T > >::size_type next_state)
 adds a full transition (read, write, next_state) adds a 4 tuple write transition

void create_move_transition (T read, typename std::vector< state< T > >::size_type next_state, typename infinite_tape< T >::direction move)
 adds a full transition (read, move, next_state) adds a 4 tuple move transition

transition_result perform_transition (infinite_tape< T > &tape, typename std::vector< state< T > >::size_type &state_index)
 performs a transition given a tape.

transition_result simulate_transition (T tape_read, T &tape_write, typename infinite_tape< T >::direction &tape_move, typename std::vector< state< T > >::size_type &state_index) const
 simulates performance of a transition given the relevant tape specification.

void print (std::ostream &out) const
 displayes the states of the set.


Protected Attributes

std::map< T, transition_structtransition_map
 map of the transitions on this state with the read symbol as the key


Detailed Description

template<typename T>
class state< T >

Single state of turing machine.

Definition at line 54 of file state.hpp.


Constructor & Destructor Documentation

template<typename T>
state< T >::state  )  [inline]
 

Default constructor.

Author:
Kyle Ross

Definition at line 63 of file state.hpp.

template<typename T>
state< T >::~state  )  [inline]
 

trivial destructor.

Author:
Kyle Ross

Definition at line 74 of file state.hpp.


Member Function Documentation

template<typename T>
void state< T >::create_move_transition read,
typename std::vector< state< T > >::size_type  next_state,
typename infinite_tape< T >::direction  move
[inline]
 

adds a full transition (read, move, next_state) adds a 4 tuple move transition

Postcondition:
the requested transition has been added, overwriting the currently-existing transition for read
Parameters:
read symbol read on the tape
next_state next state to transition to
move direction to move the read head
Author:
Kyle Ross

Definition at line 127 of file state.hpp.

template<typename T>
void state< T >::create_transition read,
write,
typename std::vector< state< T > >::size_type  next_state,
typename infinite_tape< T >::direction  move
[inline]
 

adds a full transition (read, write, move, next_state).

adds a full 5 tuple transition

Postcondition:
the requested transition has been added, overwriting the currently-existing transition for read
Parameters:
read symbol read on the tape
write symbol to be written on the tape
next_state next state to transition to
move direction to move the read head
Author:
Kyle Ross

Definition at line 93 of file state.hpp.

Referenced by transition_result::create_move_transition(), and transition_result::create_write_transition().

template<typename T>
void state< T >::create_write_transition read,
write,
typename std::vector< state< T > >::size_type  next_state
[inline]
 

adds a full transition (read, write, next_state) adds a 4 tuple write transition

Postcondition:
the requested transition has been added, overwriting the currently-existing transition for read
Parameters:
read symbol read on the tape
write symbol to be written to the tape
next_state next state to transition to
Author:
Kyle Ross

Definition at line 113 of file state.hpp.

template<typename T>
transition_result state< T >::perform_transition infinite_tape< T > &  tape,
typename std::vector< state< T > >::size_type &  state_index
[inline]
 

performs a transition given a tape.

Precondition:
tape.read(), tape.write(), tape.move(left), tape.move(right) are valid operations
Postcondition:
transition has been processed, updating current state and tape
Parameters:
tape tape to perform the transition on
state_index reference to the current state which will be updated
Returns:
run if success, halt if failure
Author:
Kyle Ross

Definition at line 141 of file state.hpp.

template<typename T>
void state< T >::print std::ostream &  out  )  const [inline]
 

displayes the states of the set.

Precondition:
there are zero or more states defined
Postcondition:
" < no transitions defined >" has been displayed if there are none defined, else each transition has been displayed in the format " read("") -> "<transition-struct-format-output>
Author:
Kyle Ross

Definition at line 194 of file state.hpp.

template<typename T>
transition_result state< T >::simulate_transition tape_read,
T &  tape_write,
typename infinite_tape< T >::direction &  tape_move,
typename std::vector< state< T > >::size_type &  state_index
const [inline]
 

simulates performance of a transition given the relevant tape specification.

Precondition:
the parameters tape_read holds the symbol that would have been read
Postcondition:
tape_write, tape_move, state_index are set to reflect the operations that would have been taken by perform_transition and the return value is the same of perform_condition
Parameters:
tape_read symbol to simulate transition on
tape_write updated to symbol that would've been written
tape_move updated to direction that would've been moved
state_index updated to state that would've been transitioned to
Returns:
run if success, halt if failure
Author:
Kyle Ross

Definition at line 168 of file state.hpp.


The documentation for this class was generated from the following file:
Generated on Thu Nov 20 00:17:33 2003 for BusyBeaver by doxygen 1.3.3