2 * CS356 Project 01 -- Elevator Simulator
4 * Elevator Class Specification
12 #include "direction.hpp"
13 #include "position.hpp"
16 class bad_direction { };
18 typedef std::list<Stop> StopList;
20 enum State { STATE_IDLE, STATE_UP, STATE_DOWN, STATE_WAIT, STATE_OPEN_DOOR, STATE_CLOSE_DOOR };
21 enum Event { EVT_IDLE, EVT_UP, EVT_DOWN, EVT_WAIT, EVT_OPEN_DOOR, EVT_CLOSE_DOOR };
26 Elevator (int elevator_number);
27 Elevator (int starting_floor, int elevator_number);
29 void stop_at (Stop &stop);
30 float distance_from (Position& pos) const;
31 float distance_from (Stop& s) const;
33 bool is_idle () const;
35 bool willStopAt (int floor, Direction direction) const;
39 /* State Machine: Helper Functions */
40 Event find_next_event () const;
42 /* State Machine: Transition Functions */
43 void transition_move_up ();
44 void transition_move_down ();
45 void transition_move_idle ();
46 void transition_open_door ();
47 void transition_close_door ();
48 void transition_begin_wait ();
49 void transition_continue_wait ();
51 /* Analyze the list of stops */
52 bool currently_at_stop () const;
54 /* Elevator Status Variables */
63 /* Elevator Number: Used to make calls into the GUI */
66 static const float ELEVATOR_STEP = 0.1;
70 #endif /* ELEVATOR_HPP */
72 /* vim: set ts=4 sts=4 sw=4 noexpandtab textwidth=112: */