/* File: system.h Author: R. P. Futrelle Date: 8/8/98 Notice: Copyright 1998 by R. P. Futrelle and the College of Computer Science, Northeastern University Class: COM1204, Object-Oriented Design, Summer 1998. Proj: PS2.µ Metrowerks Code Warrior Mac. Done in IDE version 2.0.1. Purpose: System class definition. Timer class. Switch_Phone_State class. Modification history: 8/1/98: RPF. Started. 8/5/98: RPF. Vector problems, switch to arrays. 8/8/98: RPF. Change to Connector/Wire architecture. Don't retain connectors in system array, just in switch array. */ class System { public: Phone* phones[MAX_PHONES]; Switch* switches[MAX_SWITCHES]; Switch_Phone_State* phone_states[MAX_PHONES]; Log *the_log; int time, max_steps; int num_switches, num_phones; string *log_file; bool flog, clog; // local vars Switch *a_switch; Phone *a_phone; Connector *connector1, *connector2; Wire *wire1, *wire2; System(int how_many_phones); void sys_init(); void run(int max_steps, string *log_file_name, bool cout_logging, int rseed); }; class Timer { public: bool on; // timer's on int set_for; // sys->time that "timer alarm sounds" void start(int duration); // will go off after duration steps int start(int min_duration, int max_duration); // chooses random duration void shut_off(); // shuts it off completely (not a pause) int remaining(); // how much time left? bool is_on(); // is it running? bool rang(); // has it rung? Timer(); };