Subversion Repositories programming

Rev

Rev 331 | Rev 334 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
321 ira 1
 
2
#ifndef CONTROLLER_H
3
#define CONTROLLER_H
4
 
5
#include <assert.h>
6
#include <vector>
328 ira 7
#include <limits.h>
8
#include <math.h>
332 ira 9
#include <cstdio>
321 ira 10
#include "elevator.h"
11
 
331 ira 12
class Elevator;
13
 
321 ira 14
class Controller
15
{
16
    public:
17
        Controller (int num_floors, int num_elevators);
18
        ~Controller ();
19
 
331 ira 20
        void start_all_elevators ();
21
        void stop_all_elevators ();
22
        void pause_all_elevators ();
23
        void unpause_all_elevators ();
24
 
329 ira 25
        void request_elevator (int on_floor, int direction);
26
        void disable_elevator (int elevator_number);
27
        void enable_elevator (int elevator_number);
321 ira 28
 
29
    private:
328 ira 30
        bool floor_already_requested (int on_floor);
332 ira 31
        int find_closest_elevator (int to_floor, int in_direction);
328 ira 32
 
33
        std::vector<Elevator> elevators;
321 ira 34
        int num_floors;
35
        int num_elevators;
36
};
37
 
38
#endif // CONTROLLER_H
39