Rev 344 | 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 <queue>#include <limits.h>#include <math.h>#include <iostream>#include <iomanip>#include <glibmm.h>#include "elevator.h"#include "dispatch_data.h"#include "elevator_window.h"class Elevator;class Elevator_Window;class Controller{public:Controller (int num_floors, int num_elevators);~Controller ();// Mass thread functionsvoid start_all_elevators ();void stop_all_elevators ();void pause_all_elevators ();void unpause_all_elevators ();void request_elevator (int on_floor, int direction);// Public Dispatcher Stuffvoid set_gui (Elevator_Window *gui);void push_to_gui_queue (Dispatch_Data data);void push_button_in_elevator (int elevator_num, int floor);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;// GUI Functionsvoid stop_at_floor (Elevator *e, int on_floor, int direction);void update_elevator_position (Elevator *e, float new_floor);// Dispatcher StuffGlib::Dispatcher dispatcher;std::queue<Dispatch_Data> gui_events;void dispatch_handler ();Elevator_Window *gui;};#endif // CONTROLLER_H