2 * CS356 Project 01 -- Elevator Simulator
4 * Elevator Class Specification
12 #include "direction.hpp"
13 #include "position.hpp"
16 typedef std::list<Stop> StopList;
18 enum State { STATE_IDLE, STATE_UP, STATE_DOWN, STATE_WAIT, STATE_OPEN_DOOR, STATE_CLOSE_DOOR };
19 enum Event { EVT_IDLE, EVT_UP, EVT_DOWN, EVT_WAIT, EVT_OPEN_DOOR, EVT_CLOSE_DOOR };
25 Elevator (int starting_floor);
27 void stop_at (Stop &stop);
28 float distance_from (Position& pos) const;
30 bool is_idle () const;
34 /* State Machine: Helper Functions */
35 Event find_next_event () const;
37 /* State Machine: Transition Functions */
38 void transition_move_up ();
39 void transition_move_down ();
40 void transition_move_idle ();
41 void transition_open_door ();
42 void transition_close_door ();
43 void transition_begin_wait ();
44 void transition_continue_wait ();
46 /* Analyze the list of stops */
47 bool currently_at_stop () const;
49 /* Elevator Status Variables */
58 static const float ELEVATOR_STEP = 0.1;
62 #endif /* ELEVATOR_HPP */
64 /* vim: set ts=4 sts=4 sw=4 noexpandtab textwidth=112: */