Subversion Repositories programming

Rev

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

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