Subversion Repositories programming

Rev

Rev 338 | Rev 344 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 338 Rev 340
Line 12... Line 12...
12
#include <assert.h>
12
#include <assert.h>
13
#include <vector>
13
#include <vector>
14
#include <limits.h>
14
#include <limits.h>
15
#include <math.h>
15
#include <math.h>
16
#include <cstdio>
16
#include <cstdio>
-
 
17
 
17
#include "elevator.h"
18
#include "elevator.h"
-
 
19
#include "elevator_window.h"
18
 
20
 
19
class Elevator;
21
class Elevator;
-
 
22
class Elevator_Window;
20
 
23
 
21
class Controller
24
class Controller
22
{
25
{
23
    public:
26
    public:
24
        Controller (int num_floors, int num_elevators);
27
        Controller (int num_floors, int num_elevators);
Line 31... Line 34...
31
 
34
 
32
        void request_elevator (int on_floor, int direction);
35
        void request_elevator (int on_floor, int direction);
33
        void disable_elevator (int elevator_number);
36
        void disable_elevator (int elevator_number);
34
        void enable_elevator (int elevator_number);
37
        void enable_elevator (int elevator_number);
35
 
38
 
-
 
39
        void stop_at_floor (Elevator *e, int on_floor);
-
 
40
        void update_elevator_position (Elevator *e);
-
 
41
 
-
 
42
        void set_gui (Elevator_Window *gui);
-
 
43
 
36
    private:
44
    private:
37
        bool floor_already_requested (int on_floor);
45
        bool floor_already_requested (int on_floor);
38
        int find_closest_elevator (int to_floor, int in_direction);
46
        int find_closest_elevator (int to_floor, int in_direction);
-
 
47
        int which_elevator_is (Elevator *e);
39
 
48
 
40
        std::vector<Elevator*> elevator;
49
        std::vector<Elevator*> elevator;
41
        int num_floors;
50
        int num_floors;
42
        int num_elevators;
51
        int num_elevators;
-
 
52
 
-
 
53
        Elevator_Window *gui;
43
};
54
};
44
 
55
 
45
#endif // CONTROLLER_H
56
#endif // CONTROLLER_H
46
 
57