Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:57:56

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 //
0027 
0028 #ifndef G4ATTCHECK_HH
0029 #define G4ATTCHECK_HH
0030 
0031 // Class Description:
0032 //
0033 // @class G4AttCheck
0034 //
0035 // @brief Checks G4AttValue's and their corresponding G4AttDef map.
0036 //
0037 // Usage (a): G4AttCheck(values,definitions);
0038 //    or (b): G4cout << G4AttCheck(values,definitions) << G4endl;
0039 //
0040 // For further details, see the HepRep home page at http://heprep.freehep.org
0041 //  
0042 // @author J.Allison
0043 // @author J.Perl
0044 // Class Description - End:
0045 
0046 #include "globals.hh"
0047 
0048 #include <set>
0049 #include <vector>
0050 #include <map>
0051 #include <iostream>
0052 
0053 class G4AttValue;
0054 class G4AttDef;
0055 
0056 class G4AttCheck {
0057 
0058 public: // With description
0059 
0060   G4AttCheck
0061   (const std::vector<G4AttValue>* values,
0062    const std::map<G4String,G4AttDef>* definitions);
0063 
0064   ~G4AttCheck() = default;
0065 
0066   const std::vector<G4AttValue>* GetAttValues() const {
0067     return fpValues;
0068   }
0069 
0070   const std::map<G4String,G4AttDef>* GetAttDefs() const {
0071     return fpDefinitions;
0072   }
0073 
0074   G4bool Check(const G4String& leader = "") const;
0075   // Check only.  Silent unless error - then G4cerr.  Returns error.
0076   // Provide leader, e.g., name of calling function.
0077 
0078   G4bool Standard
0079   (std::vector<G4AttValue>* standardValues,
0080    std::map<G4String,G4AttDef>* standardDefinitions)
0081     const;
0082   // Places standard versions in provided containers and returns error.
0083 
0084   friend std::ostream& operator<< (std::ostream&, const G4AttCheck&);
0085 
0086 private:
0087 
0088   void AddValuesAndDefs
0089   (std::vector<G4AttValue>* newValues,
0090    std::map<G4String,G4AttDef>* newDefinitions,
0091    const G4String& oldName,
0092    const G4String& name,
0093    const G4String& value,
0094    const G4String& extra,
0095    const G4String& description = "") const;   // Utility function for Standard.
0096 
0097   void Init();   // Initialises maps and sets
0098 
0099   const std::vector<G4AttValue>* fpValues;
0100   const std::map<G4String,G4AttDef>* fpDefinitions;
0101 
0102   static G4ThreadLocal G4bool fFirst;  // Flag for initialising the following containers.
0103   static G4ThreadLocal std::set<G4String> *fUnitCategories;  // Set of legal unit categories.
0104   static G4ThreadLocal std::map<G4String,G4String> *fStandardUnits;  // Standard units.
0105   static G4ThreadLocal std::set<G4String> *fCategories;      // Set of legal categories.
0106   static G4ThreadLocal std::set<G4String> *fUnits;           // Set of legal units.
0107   static G4ThreadLocal std::set<G4String> *fValueTypes;      // Set of legal value types.
0108 };
0109 
0110 #endif //G4ATTCHECK_HH