G4tgrUtils.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: G4tgrUtils.hh 69803 2013-05-15 15:24:50Z gcosmo $
00028 //
00029 //
00030 // class G4tgrUtils
00031 //
00032 // Class description:
00033 //
00034 // Utility class for managing of strings.
00035 
00036 // History:
00037 // - Created.                                 P.Arce, CIEMAT (November 2007)
00038 // -------------------------------------------------------------------------
00039 
00040 #ifndef G4tgrUtils_h
00041 #define G4tgrUtils_h 
00042 
00043 #include "globals.hh"
00044 
00045 #include <iostream>
00046 #include <vector>
00047 
00048 #include "G4ThreeVector.hh"
00049 #include "G4RotationMatrix.hh"
00050 #include "G4tgrEvaluator.hh"
00051 
00052 enum WLSIZEtype {WLSIZE_EQ,WLSIZE_NE,WLSIZE_LE,WLSIZE_LT,WLSIZE_GE,WLSIZE_GT};
00053 
00054 class G4tgrUtils
00055 {
00056   public:  // with description
00057 
00058     G4tgrUtils();
00059    ~G4tgrUtils();
00060   
00061     static G4bool IsSeparator(char);
00062     static G4bool IsNumber( const G4String& str);
00063     static G4bool IsInteger( const G4double val,
00064                              const G4double precision = 1.e-6 );
00065     static G4bool IsFunction( const G4String& word ); 
00066       // Checks that every character in a G4String is a number
00067       // (also '.' or exponencial notation: 'E')
00068     static G4bool WordIsUnit( const G4String& word );
00069 
00070     static void Dump3v( const G4ThreeVector& vec, const char* msg);
00071       // Dumps a three-vector with a message
00072     static void Dumprm( const G4RotationMatrix& rm, const char* msg);
00073       // Dumps a rotation matrix with a message
00074     static void DumpVS( const std::vector<G4String>& wl , const char* msg);
00075       // Dumps a vector of G4Strings with a message to cout
00076     static void DumpVS( const std::vector<G4String>& wl , const char* msg,
00077                               std::ostream& outs) ;
00078       // Dumps a vector of G4Strings with a message to outs
00079     static void CheckWLsize( const std::vector<G4String>& wl,
00080                                    unsigned int nWCheck, WLSIZEtype st,
00081                              const G4String& methodName );
00082     static G4bool CheckListSize( unsigned int nWreal,
00083                                  unsigned int nWcheck, WLSIZEtype st,
00084                                               G4String& outstr );
00085 
00086     static G4String SubColon( const G4String& str );
00087       // Return the str without leading ':'
00088 
00089     static G4String GetString( const G4String& str );
00090       // Return the str without leading and trailing '"' and ' '
00091 
00092     static G4double GetDouble( const G4String& str, G4double unitval = 1. );
00093       // Convert a G4String to a double, checking that it is really a number
00094     static G4int GetInt( const G4String& str );
00095       // Convert a G4String to an integer, checking that it is really an int
00096     static G4bool GetBool( const G4String& str );
00097       // Convert a bool to an integer, checking that it is really a bool
00098 
00099     static G4RotationMatrix GetRotationFromDirection( G4ThreeVector dir );
00100 
00101     static G4bool AreWordsEquivalent( const G4String& word1,
00102                                       const G4String& word2 );
00103       // Looks if word1 and word2 are equivalent, considering that
00104       // word1 may have '*', meaning 'any character'
00105 
00106   private:
00107 
00108     static G4tgrEvaluator* theEvaluator;
00109 };
00110 
00111 #endif 

Generated on Mon May 27 17:49:59 2013 for Geant4 by  doxygen 1.4.7