G4UIcmdWithADoubleAndUnit.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 //
00030 
00031 #ifndef G4UIcmdWithADoubleAndUnit_H
00032 #define G4UIcmdWithADoubleAndUnit_H 1
00033 
00034 #include "G4UIcommand.hh"
00035 
00036 // class description:
00037 //  A concrete class of G4UIcommand. The command defined by this class
00038 // takes a double value and a unit string.
00039 //  General information of G4UIcommand is given in G4UIcommand.hh.
00040 
00041 class G4UIcmdWithADoubleAndUnit : public G4UIcommand
00042 {
00043   public: // with description
00044     G4UIcmdWithADoubleAndUnit
00045     (const char * theCommandPath,G4UImessenger * theMessenger);
00046     //  Constructor. The command string with full path directory
00047     // and the pointer to the messenger must be given.
00048     virtual G4int DoIt(G4String parameterList);
00049     static G4double GetNewDoubleValue(const char* paramString);
00050     //  Convert string which represents a double value and a unit to
00051     // double. Value is converted to the Geant4 internal unit.
00052     static G4double GetNewDoubleRawValue(const char* paramString);
00053     //  Convert string which represents a double value and a unit to
00054     // double. Value is NOT converted to the Geant4 internal unit
00055     // but just as the given string.
00056     static G4double GetNewUnitValue(const char* paramString);
00057     //  Convert the unit string to the value of the unit. "paramString"
00058     // must contain a double value AND a unit string.
00059     G4String ConvertToStringWithBestUnit(G4double val);
00060     //  Convert a double value to a string of digits and unit. Best unit is
00061     // chosen from the unit category of default unit (in case SetDefaultUnit()
00062     //  is defined) or category defined by SetUnitCategory().
00063     G4String ConvertToStringWithDefaultUnit(G4double val);
00064     //  Convert a double value to a string of digits and unit. Best unit is
00065     // chosen from the category defined by SetUnitCategory() in case default
00066     // unit is not defined.
00067     void SetParameterName(const char * theName,G4bool omittable,
00068                           G4bool currentAsDefault=false);
00069     //  Set the parameter name for double parameterxs. Name is used by
00070     // the range checking routine.
00071     //  If "omittable" is set as true, the user of this command can ommit
00072     // the value when he/she applies the command. If "omittable" is false,
00073     // the user must supply a value.
00074     //  "currentAsDefault" flag is valid only if "omittable" is true. If this
00075     // flag is true, the current value is used as the default value when the
00076     // user ommit the double parameter. If this flag is false, the value
00077     // given by the next SetDefaultValue() method is used.
00078     void SetDefaultValue(G4double defVal);
00079     //  Set the default value of the parameter. This default value is used
00080     // when the user of this command ommits the parameter value, and
00081     // "ommitable" is true and "curreutAsDefault" is false.
00082     void SetUnitCategory(const char * unitCategory);
00083     void SetUnitCandidates(const char * candidateList);
00084     void SetDefaultUnit(const char * defUnit);
00085     //  These three methods must be used alternatively.
00086     //  The user cannot ommit the unit as the second parameter of the command if
00087     // SetUnitCategory() or SetUnitCandidates() is used, while the unit defined
00088     // by SetDefaultUnit() method is used as the default unit so that the user can
00089     // ommits the second parameter.
00090     //  SetUnitCategory() defines the category of the units which will be accepted.
00091     // The available categories can be found in G4SystemOfUnits.hh in global category.
00092     // Only the units categorized in the given category are accepted as the second
00093     // parameter of the command.
00094     //  SetUnitCandidates() defines the candidates of units. Units listed in the
00095     // argument of this method must be separated by space(s). Only the units listed
00096     // in the candidate list are accepted as the second parameter of the command.
00097     //  SetDefaultUnit() defines the default unit and also it defines the category
00098     // of the allowed units. Thus only the units categorized as the given default
00099     // unit will be accepted.
00100 };
00101 
00102 #endif

Generated on Mon May 27 17:50:05 2013 for Geant4 by  doxygen 1.4.7