#include "rcs.hh"
#include "demon.h"
#include "ch1.h"
#include "ch2.h"
#include <signal.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for main.cc:
Go to the source code of this file.
Functions | |
void | quit (int sig) |
void | main (int argc, char **argv) |
Variables | |
RCS_TIMER * | timer = 0 |
int | want_to_quit = 0 |
|
Definition at line 32 of file main.cc. 00033 { 00034 want_to_quit = 1; 00035 } |
|
Definition at line 49 of file main.cc. 00050 { 00051 set_rcs_print_destination (RCS_PRINT_TO_STDOUT); 00052 00053 // Create Each Module 00054 // 00055 CH1_MODULE *ch1 = new CH1_MODULE (); 00056 CH2_MODULE *ch2 = new CH2_MODULE (); 00057 00058 00059 // Start the timer 00060 #ifndef NO_TIMER 00061 timer = new RCS_TIMER (1.0); 00062 if (NULL == timer) 00063 { 00064 rcs_print_error ("Can't create timer.\n"); 00065 exit (-1); 00066 } 00067 #endif 00068 00069 // set the SIGINT handler 00070 rcs_print ("Set up SIGINT handler.\n"); 00071 signal (SIGINT, quit); 00072 00073 rcs_print ("Running Modules.\n"); 00074 double start_time = etime (); 00075 int cycles = 0; 00076 00077 00078 while (!want_to_quit) 00079 { 00080 ch1->controller (); 00081 ch2->controller (); 00082 #ifndef NO_TIMER 00083 // Wait for the timer; 00084 timer->wait (); 00085 #endif 00086 cycles++; 00087 #if defined(MSDOS) && !defined(_Windows) 00088 if (_kbhit ()) 00089 { 00090 want_to_quit = 1; 00091 break; 00092 } 00093 #endif 00094 00095 00096 } 00097 double finish_time = etime (); 00098 rcs_print ("Exiting Loop.\n"); 00099 00100 if (NULL != ch1) 00101 { 00102 rcs_print ("Deleting ch1.\n"); 00103 delete ch1; 00104 ch1 = NULL; 00105 } 00106 00107 if (NULL != ch2) 00108 { 00109 rcs_print ("Deleting ch2.\n"); 00110 delete ch2; 00111 ch2 = NULL; 00112 } 00113 00114 rcs_print ("Totals: cycles = %d, time = %f\n", cycles, 00115 finish_time - start_time); 00116 rcs_print ("Average Cycle Time = %f\n", 00117 (finish_time - start_time) / cycles); 00118 00119 00120 #ifndef NO_TIMER 00121 rcs_print ("Deleting Timer.\n"); 00122 delete timer; 00123 #endif 00124 } |
|
Definition at line 26 of file main.cc. Referenced by GLOBMEM::GLOBMEM().
|
|
|