2 * CS356 Project 01 -- Elevator Simulator
4 * Elevator Class Specification
12 #include "position.hpp"
13 #include "direction.hpp"
17 enum door_status { CLOSED, OPEN };
18 const float elevator_step = 0.1;
20 class bad_direction { };
26 * PURPOSE: Construct a new Elevator object
30 * PROMISE: A new Elevator will be constructed
35 * PURPOSE: Tell the elevator to stop at the given floor,
36 * PURPOSE: going in the given direction.
38 * REQUIRE: floor is a valid floor
39 * REQUIRE: direction is either UP or DOWN
41 * PROMISE: The elevator will stop at the floor when it gets there
43 void stop_at (int floor, enum direction _direction);
46 * PURPOSE: The elevator will move 1/10th of a floor in the current
51 * PROMISE: The elevator will move if it has floors to stop at, otherwise
52 * PROMISE: it will sit idle at its current place.
58 * PURPOSE: Find the direction we should move in
60 * REQUIRE: _direction must be IDLE
62 * PROMISE: The best direction to move will be returned
64 enum direction find_best_direction ();
67 * PURPOSE: Figure out if we are currently at a Stop in _stops
71 * PROMISE: Return true if we are at a Stop in _stops, false otherwise
73 bool currently_at_stop ();
76 /* Storage for all of the places that we will be stopping */
77 std::vector<Stop> _stops;
79 /* Storage for the current elevator position */
82 /* Stores the current direction */
83 enum direction _direction;
85 /* Stores the current door status */
86 enum door_status _door_status;
90 #endif /* ELEVATOR_HPP */
92 /* vim: set ts=4 sts=4 sw=4 noexpandtab textwidth=112: */