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10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /intercoms/include/G4UIparameter.hh (Version 11.3.0) and /intercoms/include/G4UIparameter.hh (Version 10.7.p3)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // G4UIparameter                                   26 // G4UIparameter
 27 //                                                 27 //
 28 // Class description:                              28 // Class description:
 29 //                                                 29 //
 30 // This class represents a parameter which wil     30 // This class represents a parameter which will be taken by a G4UIcommand
 31 // object. In case a command is defined by con     31 // object. In case a command is defined by constructing G4UIcmdXXX class,
 32 // it automatically creates necessary paramete     32 // it automatically creates necessary parameter objects, thus the user needs
 33 // not to create parameter object(s). In case      33 // not to create parameter object(s). In case the user wants to create a
 34 // command directly instantiated by G4UIcomman     34 // command directly instantiated by G4UIcommand class, he/she must create
 35 // a parameter object(s)                           35 // a parameter object(s)
 36                                                    36 
 37 // Author: Makoto Asai, 1997                       37 // Author: Makoto Asai, 1997
 38 // -------------------------------------------     38 // --------------------------------------------------------------------
 39 #ifndef G4UIparameter_hh                           39 #ifndef G4UIparameter_hh
 40 #define G4UIparameter_hh 1                         40 #define G4UIparameter_hh 1
 41                                                    41 
 42 #include "globals.hh"                              42 #include "globals.hh"
                                                   >>  43 #include "G4UItokenNum.hh"
 43                                                    44 
 44 class G4UIparameter                                45 class G4UIparameter
 45 {                                                  46 {
 46   public:                                          47   public:
 47     // Default constructor                     << 
 48     G4UIparameter() = default;                 << 
 49                                                    48 
 50     // Constructors, where "theName" is the na <<  49     G4UIparameter();
 51     // be used by the range checking, "theType << 
 52     // (currently "b" (Boolean), "i" (integer) << 
 53     // and "s" (string) are supported).        << 
 54     // "theOmittable" is a Boolean flag to set << 
 55     // the user of the command can omit the pa << 
 56     // If "theOmittable" is true, the default  << 
 57     G4UIparameter(char theType);                   50     G4UIparameter(char theType);
 58     G4UIparameter(const char* theName, char th     51     G4UIparameter(const char* theName, char theType, G4bool theOmittable);
                                                   >>  52       // Constructors, where "theName" is the name of the parameter which will
                                                   >>  53       // be used by the range checking, "theType" is the type of the parameter
                                                   >>  54       // (currently "b" (Boolean), "i" (integer), "l" (long int), "d" (double)
                                                   >>  55       // and "s" (string) are supported). 
                                                   >>  56       // "theOmittable" is a Boolean flag to set whether
                                                   >>  57       // the user of the command can omit the parameter or not.
                                                   >>  58       // If "theOmittable" is true, the default value must be given
 59                                                    59 
 60     // Destructor. When a command is destructe << 
 61     // associated parameter(s) are AUTOMATICAL << 
 62     ~G4UIparameter();                              60     ~G4UIparameter();
                                                   >>  61       // Destructor. When a command is destructed, the delete operator(s) of the
                                                   >>  62       // associated parameter(s) are AUTOMATICALLY invoked
                                                   >>  63 
                                                   >>  64     G4bool operator==(const G4UIparameter& right) const;
                                                   >>  65     G4bool operator!=(const G4UIparameter& right) const;
 63                                                    66 
 64     G4int CheckNewValue(const char* newValue);     67     G4int CheckNewValue(const char* newValue);
 65     void List();                                   68     void List();
 66                                                    69 
 67     // These methods set the default value of  <<  70     inline void SetDefaultValue(const char* theDefaultValue)
 68     inline void SetDefaultValue(const char* th <<  71     {
                                                   >>  72       defaultValue = theDefaultValue;
                                                   >>  73     }
 69     void SetDefaultValue(G4int theDefaultValue     74     void SetDefaultValue(G4int theDefaultValue);
 70     void SetDefaultValue(G4long theDefaultValu     75     void SetDefaultValue(G4long theDefaultValue);
 71     void SetDefaultValue(G4double theDefaultVa     76     void SetDefaultValue(G4double theDefaultValue);
                                                   >>  77       // These methods set the default value of the parameter
 72                                                    78 
 73     // This method can be used for a string-ty << 
 74     // used to specify a unit. This method is  << 
 75     // string-type parameter                   << 
 76     void SetDefaultUnit(const char* theDefault     79     void SetDefaultUnit(const char* theDefaultUnit);
                                                   >>  80       // This method can be used for a string-type parameter that is
                                                   >>  81       // used to specify a unit. This method is valid only for a
                                                   >>  82       // string-type parameter
 77                                                    83 
 78     inline const G4String& GetDefaultValue() c     84     inline const G4String& GetDefaultValue() const { return defaultValue; }
 79     inline char GetParameterType() const { ret     85     inline char GetParameterType() const { return parameterType; }
 80                                                    86 
 81     // Defines the range the parameter can tak <<  87     inline void SetParameterRange(const char* theRange)
 82     // The variable name appearing in the rang <<  88       // Defines the range the parameter can take.
 83     // same as the name of the parameter.      <<  89       // The variable name appearing in the range expression must be the
 84     // All the C++ syntax of relational operat <<  90       // same as the name of the parameter.
 85     // range expression                        <<  91       // All the C++ syntax of relational operators are allowed for the
 86     inline void SetParameterRange(const char*  <<  92       // range expression
                                                   >>  93     {
                                                   >>  94       parameterRange = theRange;
                                                   >>  95     }
 87                                                    96 
 88     inline const G4String& GetParameterRange() <<  97     inline const G4String& GetParameterRange() const { return parameterRange; }
 89                                                    98 
 90     inline void SetParameterName(const char* p     99     inline void SetParameterName(const char* pName) { parameterName = pName; }
 91     inline const G4String& GetParameterName()     100     inline const G4String& GetParameterName() const { return parameterName; }
 92                                                   101 
 93     // This method is meaningful if the type o << 102     inline void SetParameterCandidates(const char* theString)
 94     // The candidates listed in the argument m << 103       // This method is meaningful if the type of the parameter is string.
 95     inline void SetParameterCandidates(const c << 104       // The candidates listed in the argument must be separated by space(s)
 96                                                << 105     {
 97     inline const G4String& GetParameterCandida << 106       parameterCandidate = theString;
                                                   >> 107     }
                                                   >> 108 
                                                   >> 109     inline const G4String& GetParameterCandidates() const
                                                   >> 110     {
                                                   >> 111       return parameterCandidate;
                                                   >> 112     }
 98                                                   113 
 99     inline void SetOmittable(G4bool om) { omit    114     inline void SetOmittable(G4bool om) { omittable = om; }
100     inline G4bool IsOmittable() const { return    115     inline G4bool IsOmittable() const { return omittable; }
101                                                   116 
102     inline void SetCurrentAsDefault(G4bool val    117     inline void SetCurrentAsDefault(G4bool val) { currentAsDefaultFlag = val; }
103     inline G4bool GetCurrentAsDefault() const     118     inline G4bool GetCurrentAsDefault() const { return currentAsDefaultFlag; }
104                                                   119 
105     // Obsolete methods                           120     // Obsolete methods
106     //                                            121     //
107     inline const G4String& GetParameterGuidanc << 122     inline void SetWidget(G4int theWidget) { widget = theWidget; }
108     inline void SetGuidance(const char* theGui << 123     inline const G4String& GetParameterGuidance() const
                                                   >> 124     {
                                                   >> 125       return parameterGuidance;
                                                   >> 126     }
                                                   >> 127     inline void SetGuidance(const char* theGuidance)
                                                   >> 128     {
                                                   >> 129       parameterGuidance = theGuidance;
                                                   >> 130     }
109                                                   131 
110   private:                                     << 132   protected:
111     G4bool TypeCheck(const char* newValue);    << 133 
112     G4bool CandidateCheck(const char* newValue << 134     using yystype  = G4UItokenNum::yystype;
                                                   >> 135     using tokenNum = G4UItokenNum::tokenNum;
113                                                   136 
114   private:                                        137   private:
                                                   >> 138 
                                                   >> 139     // --- the following is used by CheckNewValue() -------
                                                   >> 140     G4int TypeCheck(const char* newValue);
                                                   >> 141     G4int RangeCheck(const char* newValue);
                                                   >> 142     G4int CandidateCheck(const char* newValue);
                                                   >> 143     G4int IsInt(const char* str, short maxDigit); // used for both int and long int
                                                   >> 144     G4int IsDouble(const char* str);
                                                   >> 145     G4int ExpectExponent(const char* str);
                                                   >> 146     //  syntax nodes
                                                   >> 147     yystype Expression(void);
                                                   >> 148     yystype LogicalORExpression(void);
                                                   >> 149     yystype LogicalANDExpression(void);
                                                   >> 150     yystype EqualityExpression(void);
                                                   >> 151     yystype RelationalExpression(void);
                                                   >> 152     yystype AdditiveExpression(void);
                                                   >> 153     yystype MultiplicativeExpression(void);
                                                   >> 154     yystype UnaryExpression(void);
                                                   >> 155     yystype PrimaryExpression(void);
                                                   >> 156     //  semantics routines
                                                   >> 157     G4int Eval2(yystype arg1, G4int op, yystype arg2);
                                                   >> 158     G4int CompareInt(G4int arg1, G4int op, G4int arg2);
                                                   >> 159     G4int CompareLong(G4long arg1, G4int op, G4long arg2);
                                                   >> 160     G4int CompareDouble(double arg1, G4int op, double arg2);
                                                   >> 161     //  utility
                                                   >> 162     tokenNum Yylex(void);        // returns next token
                                                   >> 163     G4int G4UIpGetc(void);       // read one char from rangeBuf
                                                   >> 164     G4int G4UIpUngetc(G4int c);  // put back
                                                   >> 165     G4int Backslash(G4int c);
                                                   >> 166     G4int Follow(G4int expect, G4int ifyes, G4int ifno);
                                                   >> 167     //G4String TokenToStr(G4int token);
                                                   >> 168 
                                                   >> 169     // data -----------------------------------------------------------
                                                   >> 170 
115     G4String parameterName;                       171     G4String parameterName;
116     G4String parameterGuidance;                   172     G4String parameterGuidance;
117     G4String defaultValue;                        173     G4String defaultValue;
118     G4String rangeExpression;                  << 174     G4String parameterRange;
119     G4String parameterCandidate;                  175     G4String parameterCandidate;
120     char parameterType = '\0';                    176     char parameterType = '\0';
121     G4bool omittable = false;                     177     G4bool omittable = false;
122     G4bool currentAsDefaultFlag = false;          178     G4bool currentAsDefaultFlag = false;
                                                   >> 179     G4int widget = 0;
                                                   >> 180 
                                                   >> 181     //------------ CheckNewValue() related data members ---------------
                                                   >> 182     G4String rangeBuf;
                                                   >> 183     G4int bp = 0;  // buffer pointer for rangeBuf
                                                   >> 184     tokenNum token = G4UItokenNum::NONE;
                                                   >> 185     yystype yylval;
                                                   >> 186     yystype newVal;
                                                   >> 187     G4int paramERR = 0;
123 };                                                188 };
124                                                   189 
125 #endif                                            190 #endif
126                                                   191