Rev 338 | Rev 344 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
/*******************************************************************************
* controller.h
*
* Header file for the Controller class.
*
* Copyright 2006, Ira W. Snyder (devel@irasnyder.com)
******************************************************************************/
#ifndef CONTROLLER_H
#define CONTROLLER_H
#include <assert.h>
#include <vector>
#include <limits.h>
#include <math.h>
#include <cstdio>
#include "elevator.h"
#include "elevator_window.h"
class Elevator;
class Elevator_Window;
class Controller
{
public:
Controller (int num_floors, int num_elevators);
~Controller ();
void start_all_elevators ();
void stop_all_elevators ();
void pause_all_elevators ();
void unpause_all_elevators ();
void request_elevator (int on_floor, int direction);
void disable_elevator (int elevator_number);
void enable_elevator (int elevator_number);
void stop_at_floor (Elevator *e, int on_floor);
void update_elevator_position (Elevator *e);
void set_gui (Elevator_Window *gui);
private:
bool floor_already_requested (int on_floor);
int find_closest_elevator (int to_floor, int in_direction);
int which_elevator_is (Elevator *e);
std::vector<Elevator*> elevator;
int num_floors;
int num_elevators;
Elevator_Window *gui;
};
#endif // CONTROLLER_H