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;
29 float distance_from (Stop& s) const;
31 bool is_idle () const;
35 /* State Machine: Helper Functions */
36 Event find_next_event () const;
38 /* State Machine: Transition Functions */
39 void transition_move_up ();
40 void transition_move_down ();
41 void transition_move_idle ();
42 void transition_open_door ();
43 void transition_close_door ();
44 void transition_begin_wait ();
45 void transition_continue_wait ();
47 /* Analyze the list of stops */
48 bool currently_at_stop () const;
50 /* Elevator Status Variables */
59 static const float ELEVATOR_STEP = 0.1;
63 #endif /* ELEVATOR_HPP */
65 /* vim: set ts=4 sts=4 sw=4 noexpandtab textwidth=112: */