Changes between Version 1 and Version 2 of Old/Documentation/OTG/FuncSpec/UserInterface
- Timestamp:
- Oct 6, 2005, 6:04:21 PM (19 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Old/Documentation/OTG/FuncSpec/UserInterface
v1 v2 3 3 = Function Specification: User Interface Design = 4 4 5 User Inter ace provides a command shell to users. User can specify important program arguments in a standard command line format. "--option <arg>".5 User Interface provides a command shell to users. User can specify important program arguments in a standard command line format. "--option <arg>". 6 6 7 7 == Design Requirement == 8 8 The following principles of the design should be respected: 9 * User only need to give command-line options once to start the program. A step-by-step configurat on tends to be confusing, error-prone and complicates fault-handling.9 * User only need to give command-line options once to start the program. A step-by-step configuration tends to be confusing, error-prone and complicates fault-handling. 10 10 * Configuration file shall not be used. (difficult to maintain) 11 11 * Run-time argument change must be supported whenever possible. 12 * In the run-time, user com amnd inputs can only change one parameter a time. (multiple changes at the same time might lead mutual conflicting)12 * In the run-time, user command inputs can only change one parameter a time. (multiple changes at the same time might lead mutual conflicting) 13 13 14 == Brief introduction abou using POPT ==14 == Brief introduction about using POPT == 15 15 16 16 The OTG software uses POPT library to simplify the design of user interface. To use POPT, … … 31 31 }}} 32 32 33 then, use a while loop to parse all given option arguments. Whenever an option name matches one of the options defined in the options array, the "poptGetNextOpt" fu cntion call will return a value. Different options return differnt valuse. This occurs repetitively until the value returns -1. So, In "case" of differnt value, different handling routing should be proceeded.33 then, use a while loop to parse all given option arguments. Whenever an option name matches one of the options defined in the options array, the "poptGetNextOpt" function call will return a value. Different options return different values. This occurs repetitively until the value returns -1. So, In "case" of different value, different handling routing should be proceeded. 34 34 {{{ 35 35 int rc; … … 61 61 In OTG program, first-tier options are following 62 62 * protocol, generator, debuglog 63 "protocol" and "generator" must be parsed correctly before other argu ements related to them can be understood. "debuglog" is used only for turning on the local logging of measurements. Because first-tier options are pivotal and governing 2nd-tier options in the program, run-time changes for them are impossible.63 "protocol" and "generator" must be parsed correctly before other arguments related to them can be understood. "debuglog" is used only for turning on the local logging of measurements. Because first-tier options are pivotal and governing 2nd-tier options in the program, run-time changes for them are impossible. 64 64 65 Correspondingly, three fu cntions are used in parsing options:65 Correspondingly, three functions are used in parsing options: 66 66 * parseOptionsPhase1 67 67 * parseOptionsPhase2 … … 69 69 70 70 ''parseOptionsPhase1'' is used to set values for variables corresponding to first-tier arguments 71 Because both Port and Generator are vi tual base class, a certain type of Port and Generator objects will be created based on those variables.71 Because both Port and Generator are virtual base class, a certain type of Port and Generator objects will be created based on those variables. 72 72 Second-tier options are parsed by ''parseOptionsPhase2''. Certain properties of newly created Port and Generator objects will be set. 73 73 Finally, ''parseRuntimeOptions'' will parse run-time user input to change a certain set of parameters. 74 74 For initial shell user inputs, ''argc'' and ''argv'' are automatically provided by standard C. So, we pass them to POPT function directly. 75 But for run-time user inputs, a special char* variable ''msg'' is taken as the parameter. The msg contain the setting for only one options and either in "--option <arg>" format or without leading hyph ons.75 But for run-time user inputs, a special char* variable ''msg'' is taken as the parameter. The msg contain the setting for only one options and either in "--option <arg>" format or without leading hyphens. 76 76 77 77 == OTR User Interface == 78 78 In OTR program, first-tier options are following 79 79 * protocol, debuglog 80 "protocol" must be parsed correctly before other argu ements relating to receiving functions could be understood. "debuglog" is used only for turning on the local logging of measurements. Because first-tier options are pivotal and governing 2nd-tier options in the program, run-time changes for them are impossible.80 "protocol" must be parsed correctly before other arguments relating to receiving functions could be understood. "debuglog" is used only for turning on the local logging of measurements. Because first-tier options are pivotal and governing 2nd-tier options in the program, run-time changes for them are impossible. 81 81 82 Correspondingly, three fu cntions are used in parsing options:82 Correspondingly, three functions are used in parsing options: 83 83 * parseOptionsPhase1 84 84 * parseOptionsPhase2 … … 86 86 87 87 ''parseOptionsPhase1'' is used to set values for variable corresponding to first-tier arguments 88 Because Gate is a virtual base class, a certain type of Gate object will be created based on ''pro otcol_name'' variable.88 Because Gate is a virtual base class, a certain type of Gate object will be created based on ''protocol_name'' variable. 89 89 Second-tier options are parsed by ''parseOptionsPhase2''. Certain properties of newly created Gate object will be set. 90 90 Finally, ''parseRuntimeOptions'' will parse run-time user input to change a certain set of parameters. … … 94 94 == Difference between OTG and OTR user interface design 95 95 96 As can be seen, the de isng for OTG and OTR user interfaces are quite similar, but there are two major differnce:96 As can be seen, the design for OTG and OTR user interfaces are quite similar, but there are two major difference: 97 97 * Gate does not need "generator" related options 98 98 * Gate does not support run-time pause and resume options.