00001 00002 #ifndef NML_MODULE_H 00003 #define NML_MODULE_H 00004 00005 /* 00006 nml_mod.h 00007 00008 Declarations of NML class derived from RCS_MODULE_C, which include 00009 NML channels and an RCS_TIMER. 00010 */ 00011 00012 /* 00013 Modification history: 00014 00015 3-Apr-1997 WPS made NML_MODULE no longer the subordinate of RCS_MODULE_C 00016 and brought those functions, variables from RCS_MODULE_C we want in 00017 here directly. 00018 7-Mar-1997 WPS changed header files to 8.3 format. 00019 11-Feb-1997 WPS modified -- calc_avg_time, update_line_history, and 00020 stop_timing all use exec_history but fail to check to 00021 see if it is initialized. 00022 I override them here minimize changes to rcs_module.cc 00023 3-Dec-1996 FMP changed NML to RCS_CMD/STAT_CHANNEL for commandIn, 00024 statusOut, etc. 00025 112696 hui, changed the base class for commandInData, etc., from NMLmsg 00026 to RCS_CMD_MSG and RCS_STAT_MSG. 00027 29-Jul-1996 FMP moved NML_ERROR, NML_TEXT, NML_DISPLAY, and NML_STATUS 00028 into nml_emc.hh 00029 29-Jul-1996 FMP added NML_TEXT and NML_DISPLAY classes; added member 00030 functions for logText and requestDisplay 00031 10-Jun-1996 Fred Proctor added commandOutstanding, commandLastNum arrays; 00032 NML_STATUS struct 00033 5-Jun-1996 Fred Proctor added errorLog, logError() 00034 29-Apr-1996 Fred Proctor moved 'done' from RCS_MODULE_C to here. 00035 16-Apr-1996 Fred Proctor added NMLmsg *'s 00036 5-Apr-1996 Fred Proctor created 00037 */ 00038 00039 #include "rcs_mod.h" 00040 #include "rcs.hh" 00041 00042 class NML_MODULE2 00043 { 00044 public: 00045 // This section taken from RCS_MODULE_C 00046 void controller (void); 00047 00048 virtual void DECISION_PROCESS (void); 00049 00050 virtual void READ_COMM_BUFFERS (void); // Preprocess 00051 virtual void LOAD_LOCAL_VARIABLES (void); 00052 virtual void READ_CHILD_BUFFERS (void); 00053 virtual void DETERMINE_CHILDREN_STATUS (void); 00054 virtual void PRE_PROCESS_PARAMETERS (void); 00055 00056 virtual void POST_PROCESS_PARAMETERS (void); // Postprocess 00057 virtual void UNLOAD_LOCAL_VARIABLES (void); 00058 virtual void WRITE_COMM_BUFFERS (void); 00059 virtual void WRITE_CHILD_BUFFERS (void); 00060 00061 // State table functions 00062 int stateMatch (char *_src_file, int source_line, int state, int conds = 1); 00063 int stateMatch (int state, int conds = 1); 00064 void stateNext (int state); 00065 00066 protected: 00067 00068 void pre_process (void); // preprocess 00069 void check_if_new_command (void); 00070 void check_if_new_sup_request (void); 00071 void start_timing (void); 00072 void check_run_command (void); 00073 void check_cycle_time (void); 00074 00075 void post_process (void); // postprocess 00076 void calc_avg_time (void); 00077 void update_line_num_history (void); 00078 00079 void stop_timing (void); 00080 00081 00082 RCS_EXEC_HISTORY_STRUCT exec_history; // Exec History 00083 RCS_EXEC_STATUS_STRUCT exec_status; 00084 00085 RCS_RUN_COMMAND_STRUCT run_command; // Run Command 00086 RCS_RUN_STATUS_STRUCT run_status; 00087 00088 00089 long cycle_start; // Data 00090 long cycle_stop; 00091 00092 int command_time_averaged; 00093 int new_command_sequence; 00094 int new_line_num_sequence; 00095 int new_sup_request; 00096 00097 long delta_clock; 00098 long cycle_time; 00099 long command_current_time; 00100 00101 int pause_status; 00102 int command; 00103 int last_line; 00104 00105 int execute; 00106 int command_time; 00107 int state; 00108 int status; 00109 00110 int sup_req_num; 00111 int sup_req_num_echo; 00112 int command_num; 00113 int command_num_echo; 00114 00115 private: 00116 int matched; /* flag set when a state is matched, to 00117 prevent fall-through to another state */ 00118 int stateBegin; /* flag set by controller() signifying 00119 that stateMatch should init line number */ 00120 00121 public: 00122 00123 NML_MODULE (); 00124 ~NML_MODULE (); 00125 00126 RCS_CMD_CHANNEL *commandIn; // NML channel for command from supervisor 00127 RCS_STAT_CHANNEL *statusOut; // NML channel for status to supervisor 00128 RCS_CMD_CHANNEL **commandOut; // NML channels for commands to subordinates 00129 RCS_STAT_CHANNEL **statusIn; // NML channels for status from subordinates 00130 NML *errorLog; // NML channel for logging errors 00131 00132 RCS_CMD_MSG *commandInData; // ptr to NML data in channel 00133 RCS_STAT_MSG *statusOutData; // ptr to NML data to be put in channel 00134 RCS_CMD_MSG **commandOutData; // ptrs to NML data to be put in channel 00135 RCS_STAT_MSG **statusInData; // ptrs to NML data in channels 00136 00137 int *commandLastNum; // array of command nums saved before writes 00138 int *commandOutstanding; // array of flags, 1 = command has been sent, 00139 // 0 = command has finished 00140 00141 RCS_TIMER *timer; // synch timer 00142 00143 int done; // non-zero means stop calling controller() 00144 00145 int setSubordinates (int number); 00146 int logError (const char *fmt, ...); 00147 int logText (const char *fmt, ...); 00148 int requestDisplay (const char *display); 00149 00150 // WPS modified 11-Feb-1997 calc_avg_time, update_line_history, and 00151 // stop_timing all use exec_history but fail to check to 00152 // see if it is initialized. 00153 // I override them here minimize changes to rcs_module.cc 00154 void calc_avg_time (void); 00155 void update_line_num_history (void); 00156 00157 void stop_timing (void); 00158 00159 protected: 00160 00161 int numSubordinates; // number of subordinates for this module 00162 }; 00163 00164 #endif