Much Better Now
[cs356-p1-elevator.git] / elevator.hpp
1 /*
2  * CS356 Project 01 -- Elevator Simulator
3  *
4  * Elevator Class Specification
5  */
6
7 #ifndef ELEVATOR_HPP
8 #define ELEVATOR_HPP
9
10 #include <iostream>
11 #include <list>
12 #include "direction.hpp"
13 #include "position.hpp"
14 #include "stop.hpp"
15
16 typedef enum { CLOSED, OPEN } DoorStatus;
17 typedef std::list<Stop> StopList;
18
19 class Elevator
20 {
21         public:
22                 Elevator ();
23
24                 void stop_at (Stop &stop);
25                 float distance_from (Position& pos) const;
26                 void move ();
27                 bool is_idle () const;
28
29         private:
30                 /* Callbacks into the GUI */
31                 void open_door () const;
32                 void close_door () const;
33                 void update_position () const;
34
35                 /* Analyze the list of stops */
36                 bool currently_at_stop () const;
37
38                 /* Elevator Status Variables */
39                 DoorStatus      door_;
40                 Direction       direction_;
41                 Position        current_position_;
42                 StopList        stops_;
43
44                 const float     ELEVATOR_STEP;
45 };
46
47
48 #endif /* ELEVATOR_HPP */
49
50 /* vim: set ts=4 sts=4 sw=4 noexpandtab textwidth=112: */