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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 5.1)


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