00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef G4UIparameter_h
00033 #define G4UIparameter_h 1
00034
00035 #include "globals.hh"
00036 #include "G4UItokenNum.hh"
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 class G4UIparameter
00048 {
00049 public:
00050 G4UIparameter();
00051 G4UIparameter(char theType);
00052 G4UIparameter(const char * theName, char theType, G4bool theOmittable);
00053
00054
00055
00056
00057
00058
00059 ~G4UIparameter();
00060
00061
00062
00063
00064 public:
00065 G4int operator==(const G4UIparameter &right) const;
00066 G4int operator!=(const G4UIparameter &right) const;
00067
00068 G4int CheckNewValue(const char* newValue);
00069 void List();
00070
00071 private:
00072 G4String parameterName;
00073 G4String parameterGuidance;
00074 G4String defaultValue;
00075 G4String parameterRange;
00076 G4String parameterCandidate;
00077 char parameterType;
00078 G4bool omittable;
00079 G4bool currentAsDefaultFlag;
00080 G4int widget;
00081
00082 public:
00083 inline void SetDefaultValue(const char * theDefaultValue)
00084 { defaultValue = theDefaultValue; }
00085 void SetDefaultValue(G4int theDefaultValue);
00086 void SetDefaultValue(G4double theDefaultValue);
00087
00088 public:
00089 inline G4String GetDefaultValue() const
00090 { return defaultValue; }
00091 inline char GetParameterType() const
00092 { return parameterType; }
00093
00094 public:
00095 inline void SetParameterRange(const char * theRange)
00096 { parameterRange = theRange; }
00097
00098
00099
00100
00101
00102 public:
00103 inline G4String GetParameterRange() const
00104 { return parameterRange; }
00105
00106
00107 inline void SetParameterName(const char * theName)
00108 { parameterName = theName; }
00109 inline G4String GetParameterName() const
00110 { return parameterName; }
00111
00112 public:
00113 inline void SetParameterCandidates(const char * theString)
00114 { parameterCandidate = theString; }
00115
00116
00117 public:
00118 inline G4String GetParameterCandidates() const
00119 { return parameterCandidate; }
00120
00121
00122 inline void SetOmittable(G4bool om)
00123 { omittable = om; }
00124 inline G4bool IsOmittable() const
00125 { return omittable; }
00126
00127
00128 inline void SetCurrentAsDefault(G4bool val)
00129 { currentAsDefaultFlag = val; }
00130 inline G4bool GetCurrentAsDefault() const
00131 { return currentAsDefaultFlag; }
00132
00133
00134 inline void SetWidget(G4int theWidget)
00135 { widget = theWidget; }
00136 inline const G4String GetParameterGuidance() const
00137 { return parameterGuidance; }
00138 inline void SetGuidance(const char * theGuidance)
00139 { parameterGuidance = theGuidance; }
00140
00141 private:
00142
00143 G4int TypeCheck(const char* newValue );
00144 G4int RangeCheck(const char* newValue );
00145 G4int CandidateCheck(const char* newValue );
00146 G4int IsInt(const char* str, short maxDigit);
00147 G4int IsDouble(const char* str);
00148 G4int ExpectExponent(const char* str);
00149
00150 yystype Expression( void );
00151 yystype LogicalORExpression( void );
00152 yystype LogicalANDExpression( void );
00153 yystype EqualityExpression ( void );
00154 yystype RelationalExpression( void );
00155 yystype AdditiveExpression( void );
00156 yystype MultiplicativeExpression( void );
00157 yystype UnaryExpression( void );
00158 yystype PrimaryExpression( void );
00159
00160 G4int Eval2( yystype arg1, G4int op, yystype arg2 );
00161 G4int CompareInt( G4int arg1, G4int op, G4int arg2);
00162 G4int CompareDouble( double arg1, G4int op, double arg2);
00163
00164 tokenNum Yylex( void );
00165 G4int G4UIpGetc( void );
00166 G4int G4UIpUngetc( G4int c );
00167 G4int Backslash( G4int c );
00168 G4int Follow( G4int expect, G4int ifyes, G4int ifno );
00169 G4String TokenToStr(G4int token);
00170
00171
00172 G4String rangeBuf;
00173 G4int bp;
00174 tokenNum token;
00175 yystype yylval;
00176 yystype newVal;
00177 G4int paramERR;
00178
00179
00180 };
00181
00182 #endif
00183