Checkpoint before trying to convert to a state machine
[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                 Elevator (int starting_floor);
24
25                 void stop_at (Stop &stop);
26                 float distance_from (Position& pos) const;
27                 void move ();
28                 bool is_idle () const;
29
30         private:
31                 /* Callbacks into the GUI */
32                 void open_door () const;
33                 void close_door () const;
34                 void update_position () const;
35
36                 /* Analyze the list of stops */
37                 bool currently_at_stop () const;
38
39                 /* Elevator Status Variables */
40                 DoorStatus      door_;
41                 Direction       direction_;
42                 Position        current_position_;
43                 StopList        stops_;
44
45                 const float     ELEVATOR_STEP;
46 };
47
48
49 #endif /* ELEVATOR_HPP */
50
51 /* vim: set ts=4 sts=4 sw=4 noexpandtab textwidth=112: */