cis441 project milestone 1a

Dependencies:   TextLCD

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Road.h Source File

Road.h

00001 #ifndef _ROAD_H_
00002 #define _ROAD_H_
00003 
00004 #include "mbed.h"
00005 #include "AccCar.h"
00006 #include "Intersection.h"
00007 
00008 #define MAX_CARS 5
00009 
00010 class AccCar;
00011 
00012 class Road {
00013 public:
00014     EventFlags go_flags;
00015     EventFlags done_flags;
00016     int active_cars;
00017     
00018     Road(Intersection* intersection, int roadId);
00019     Intersection* intersection; 
00020     int try_enter_car(int time);
00021     void let_cars_update();
00022     void wait_for_car_update();
00023     void check_exit_cars();
00024     void intendToEnter(int id); 
00025     int roadId; 
00026     
00027     void print_status();
00028     
00029     
00030 private:
00031     AccCar* last_car;
00032     AccCar* cars[MAX_CARS];
00033     
00034     AccCar* pending_car;
00035     int next_release;
00036     int num_cars;
00037 };
00038 #endif