|
||||
File indexing completed on 2025-01-18 09:59:10
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 // G4tgrUtils 0027 // 0028 // Class description: 0029 // 0030 // Utility class for managing of strings. 0031 0032 // Author: P.Arce, CIEMAT (November 2007) 0033 // -------------------------------------------------------------------- 0034 #ifndef G4tgrUtils_hh 0035 #define G4tgrUtils_hh 1 0036 0037 #include <iostream> 0038 #include <vector> 0039 0040 #include "globals.hh" 0041 #include "G4ThreeVector.hh" 0042 #include "G4RotationMatrix.hh" 0043 #include "G4tgrEvaluator.hh" 0044 0045 enum WLSIZEtype 0046 { 0047 WLSIZE_EQ, 0048 WLSIZE_NE, 0049 WLSIZE_LE, 0050 WLSIZE_LT, 0051 WLSIZE_GE, 0052 WLSIZE_GT 0053 }; 0054 0055 class G4tgrUtils 0056 { 0057 public: 0058 0059 G4tgrUtils(); 0060 ~G4tgrUtils(); 0061 0062 static G4bool IsSeparator(char); 0063 static G4bool IsNumber(const G4String& str); 0064 static G4bool IsInteger(const G4double val, 0065 const G4double precision = 1.e-6); 0066 static G4bool IsFunction(const G4String& word); 0067 // Checks that every character in a G4String is a number 0068 // (also '.' or exponencial notation: 'E') 0069 static G4bool WordIsUnit(const G4String& word); 0070 0071 static void Dump3v(const G4ThreeVector& vec, const char* msg); 0072 // Dumps a three-vector with a message 0073 static void Dumprm(const G4RotationMatrix& rm, const char* msg); 0074 // Dumps a rotation matrix with a message 0075 static void DumpVS(const std::vector<G4String>& wl, const char* msg); 0076 // Dumps a vector of G4Strings with a message to cout 0077 static void DumpVS(const std::vector<G4String>& wl, const char* msg, 0078 std::ostream& outs); 0079 // Dumps a vector of G4Strings with a message to outs 0080 static void CheckWLsize(const std::vector<G4String>& wl, 0081 unsigned int nWCheck, 0082 WLSIZEtype st, const G4String& methodName); 0083 static G4bool CheckListSize(unsigned int nWreal, unsigned int nWcheck, 0084 WLSIZEtype st, G4String& outstr); 0085 0086 static G4String SubColon(const G4String& str); 0087 // Return the str without leading ':' 0088 0089 static G4String GetString(const G4String& str); 0090 // Return the str without leading and trailing '"' and ' ' 0091 0092 static G4double GetDouble(const G4String& str, G4double unitval = 1.); 0093 // Convert a G4String to a double, checking that it is really a number 0094 static G4int GetInt(const G4String& str); 0095 // Convert a G4String to an integer, checking that it is really an int 0096 static G4bool GetBool(const G4String& str); 0097 // Convert a bool to an integer, checking that it is really a bool 0098 0099 static G4RotationMatrix GetRotationFromDirection(G4ThreeVector dir); 0100 0101 static G4bool AreWordsEquivalent(const G4String& word1, 0102 const G4String& word2); 0103 // Looks if word1 and word2 are equivalent, considering that 0104 // word1 may have '*', meaning 'any character' 0105 0106 private: 0107 0108 static G4ThreadLocal G4tgrEvaluator* theEvaluator; 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 |