Source code: rcs/nml/RCS_STAT_MSG.java
1 package rcs.nml;
2
3 import rcs.nml.NMLmsg;
4
5 /**
6 * Base class for NML status messages.
7 * <pre>
8 * Related Documentation:
9 * <A HREF="http://isd.cme.nist.gov/proj/rcs_lib">RCS Library</a>, <A HREF="http://isd.cme.nist.gov/proj/rcs_lib/NMLjava.html">NML Programmers Guide (Java Version)</a>
10 *
11 * Source Code:
12 * <A HREF="RCS_STAT_MSG.java">RCS_STAT_MSG.java</a>
13 *
14 * </pre>
15 *
16 * @author Will Shackleford -- <A HREF="mailto:shackle@cme.nist.gov">shackle@cme.nist.gov</a>
17 *
18 */
19 public class RCS_STAT_MSG extends NMLmsg
20 {
21 /**
22 * Subordinates ussually set this to the type of the command
23 * they are currently executing or just completed.
24 * The templates do this automatically.
25 */
26 public int command_type;
27
28 /**
29 * Subordinates ussually set this to the serial_number of the command
30 * they are currently executing or just completed.
31 * The templates do this automatically.
32 */
33 public int echo_serial_number;
34
35 /**
36 * Value for status if the module has not yet been initialized.
37 */
38 static public final int UNINITIALIZED_STATUS = -1;
39
40 /**
41 * Value for status if the module has completed the last command
42 * it was given.
43 */
44 static public final int RCS_DONE = 1;
45
46 /**
47 * Value for status if the module is still executing the last command
48 * it was given.
49 */
50 static public final int RCS_EXEC = 2;
51
52 /**
53 * Value for status if the module has encountered an error.
54 */
55 static public final int RCS_ERROR = 3;
56
57
58 /**
59 * The status of the module is ussually set to either
60 * UNINITIALIZED_STATUS, RCS_DONE, RCS_EXEC, or RCS_ERROR, depending on
61 * whether the module is currently executing a command
62 * or has encountered an error.
63 * The templates do this automatically.
64 */
65 public int status;
66
67 /**
68 * Modules that use simple state tables ussually provide
69 * the current state here.
70 * The templates do this automatically.
71 */
72 public int state;
73
74 /**
75 * Modules that use simple state tables ussually provide
76 * the last line matched in the state table here.
77 * The line here is meant as the number of if(STATE_MATCH(...)
78 * encountered before one was true.
79 * The templates do this automatically.
80 */
81 public int line;
82
83 /**
84 * Modules that use simple state tables ussually provide
85 * the last line matched in the state table here.
86 * The line here is meant as the line number in the source
87 * code of the if(STATE_MATCH( . . .) that was true.
88 * The templates do this automatically.
89 * The diagnostics tool uses this for the "state table"
90 * display.
91 */
92 public int source_line;
93
94 /**
95 * Modules that use simple state tables may provide the
96 * name of the source file of the state table that is
97 * currently being used here.
98 * The templates do this automatically.
99 * The diagnostics tool uses this for the "state table"
100 * display.
101 */
102 public byte source_file[] = new byte[64];
103
104 /**
105 * Derived classes should use this constructor by placing
106 * super(_type) in the first line of thier constructors.
107 *
108 * @param _type the integer identifier of the derived class
109 */
110 public RCS_STAT_MSG(int _type)
111 {
112 super(_type);
113 //System.out.println("RCS_STAT_MSG("+_type+") constructed.");
114 command_type = 0;
115 state = 0;
116 line = 0;
117 status = 0;
118 echo_serial_number = 0;
119 }
120
121 /**
122 * update function for the RCS_STAT_MSG members. Derived
123 * classes that have data members that should be communicated
124 * should override this function and place super.update(nml_fc) in
125 * the first line.
126 *
127 * @param nml_fc the NMLFormatConverter used to convert basic
128 * data types to neutral formats and back.
129 */
130 public void update(NMLFormatConverter nml_fc)
131 {
132 if(!nml_fc.stat_msg_updated)
133 {
134 //super.update(nml_fc);
135 command_type = nml_fc.update(command_type );
136 echo_serial_number = nml_fc.update(echo_serial_number );
137 status = nml_fc.update(status );
138 state = nml_fc.update(state );
139 line = nml_fc.update(line );
140 source_line = nml_fc.update(source_line );
141 nml_fc.update(source_file,64);
142 nml_fc.stat_msg_updated = true;
143 }
144 }
145 }
146