|
||||
File indexing completed on 2025-01-18 09:59:16
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // G4UIcmdWithADoubleAndUnit 0027 // 0028 // Class description: 0029 // 0030 // A concrete class of G4UIcommand. The command defined by this class 0031 // takes a double value and a unit string. 0032 // General information of G4UIcommand is given in G4UIcommand.hh 0033 0034 // Author: M.Asai, 1998 0035 // -------------------------------------------------------------------- 0036 #ifndef G4UIcmdWithADoubleAndUnit_hh 0037 #define G4UIcmdWithADoubleAndUnit_hh 1 0038 0039 #include "G4UIcommand.hh" 0040 0041 class G4UIcmdWithADoubleAndUnit : public G4UIcommand 0042 { 0043 public: 0044 // Constructor. The command string with full path directory 0045 // and the pointer to the messenger must be given 0046 G4UIcmdWithADoubleAndUnit(const char* theCommandPath, G4UImessenger* theMessenger); 0047 0048 G4int DoIt(G4String parameterList) override; 0049 0050 // Convert a double value to a string of digits and unit. Best unit is 0051 // chosen from the unit category of default unit (in case SetDefaultUnit() 0052 // is defined) or category defined by SetUnitCategory() 0053 G4String ConvertToStringWithBestUnit(G4double val); 0054 0055 // Convert a double value to a string of digits and unit. Best unit is 0056 // chosen from the category defined by SetUnitCategory() in case default 0057 // unit is not defined 0058 G4String ConvertToStringWithDefaultUnit(G4double val); 0059 0060 // Set the parameter name for double parameters. Name is used by 0061 // the range checking function. 0062 // If "omittable" is set as true, the user of this command can omit 0063 // the value when the command is applied. If "omittable" is false, 0064 // the user must supply a value. 0065 // "currentAsDefault" flag is valid only if "omittable" is true. If this 0066 // flag is true, the current value is used as the default value when the 0067 // user omits the double parameter. If this flag is false, the value 0068 // given by the next SetDefaultValue() method is used 0069 void SetParameterName(const char* theName, G4bool omittable, G4bool currentAsDefault = false); 0070 0071 // Set the default value of the parameter. This default value is used 0072 // when the user of this command omits the parameter value, and 0073 // "omittable" is true and "currentAsDefault" is false 0074 void SetDefaultValue(G4double defVal); 0075 0076 // These three methods must be used alternatively. 0077 // The user cannot omit the unit as the second parameter of the command 0078 // if SetUnitCategory() or SetUnitCandidates() is used, while the unit 0079 // defined by SetDefaultUnit() method is used as the default unit so that 0080 // the user can omit the second parameter. 0081 // SetUnitCategory() defines the category of the units which will be 0082 // accepted. 0083 // The available categories can be found in G4SystemOfUnits.hh in 'global' 0084 // category. Only the units categorized in the given category are accepted 0085 // as the second parameter of the command. 0086 // SetUnitCandidates() defines the candidates of units. Units listed in 0087 // the argument of this method must be separated by space(s). Only the 0088 // units listed in the candidate list are accepted as the second parameter 0089 // of the command. 0090 // SetDefaultUnit() defines the default unit and also defines the category 0091 // of the allowed units. Thus only the units categorized as the given 0092 // default unit will be accepted 0093 void SetUnitCategory(const char* unitCategory); 0094 void SetUnitCandidates(const char* candidateList); 0095 void SetDefaultUnit(const char* defUnit); 0096 0097 // Convert string which represents a double value and a unit to 0098 // double. Value is converted to the Geant4 internal unit 0099 static G4double GetNewDoubleValue(const char* paramString); 0100 0101 // Convert string which represents a double value and a unit to 0102 // double. Value is NOT converted to the Geant4 internal unit 0103 // but just as the given string 0104 static G4double GetNewDoubleRawValue(const char* paramString); 0105 0106 // Convert the unit string to the value of the unit. "paramString" 0107 // must contain a double value AND a unit string 0108 static G4double GetNewUnitValue(const char* paramString); 0109 }; 0110 0111 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |