G4AttCheck.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 #ifndef G4ATTCHECK_HH
00030 #define G4ATTCHECK_HH
00031 
00032 // Class Description:
00033 //
00034 // @class G4AttCheck
00035 //
00036 // @brief Checks G4AttValue's and their corresponding G4AttDef map.
00037 //
00038 // Usage (a): G4AttCheck(values,definitions);
00039 //    or (b): G4cout << G4AttCheck(values,definitions) << G4endl;
00040 //
00041 // For further details, see the HepRep home page at http://heprep.freehep.org
00042 //  
00043 // @author J.Allison
00044 // @author J.Perl
00045 // Class Description - End:
00046 
00047 #include "globals.hh"
00048 
00049 #include <set>
00050 #include <vector>
00051 #include <map>
00052 #include <iostream>
00053 
00054 class G4AttValue;
00055 class G4AttDef;
00056 
00057 class G4AttCheck {
00058 
00059 public: // With description
00060 
00061   G4AttCheck
00062   (const std::vector<G4AttValue>* values,
00063    const std::map<G4String,G4AttDef>* definitions);
00064 
00065   ~G4AttCheck();
00066 
00067   const std::vector<G4AttValue>* GetAttValues() const {
00068     return fpValues;
00069   }
00070 
00071   const std::map<G4String,G4AttDef>* GetAttDefs() const {
00072     return fpDefinitions;
00073   }
00074 
00075   G4bool Check(const G4String& leader = "") const;
00076   // Check only.  Silent unless error - then G4cerr.  Returns error.
00077   // Provide leader, e.g., name of calling function.
00078 
00079   G4bool Standard
00080   (std::vector<G4AttValue>* standardValues,
00081    std::map<G4String,G4AttDef>* standardDefinitions)
00082     const;
00083   // Places standard versions in provided containers and returns error.
00084 
00085   friend std::ostream& operator<< (std::ostream&, const G4AttCheck&);
00086 
00087 private:
00088 
00089   void AddValuesAndDefs
00090   (std::vector<G4AttValue>* newValues,
00091    std::map<G4String,G4AttDef>* newDefinitions,
00092    const G4String& oldName,
00093    const G4String& name,
00094    const G4String& value,
00095    const G4String& extra,
00096    const G4String& description = "") const;   // Utility function for Standard.
00097 
00098   const std::vector<G4AttValue>* fpValues;
00099   const std::map<G4String,G4AttDef>* fpDefinitions;
00100 
00101   static G4bool fFirst;  // Flag for initialising the following containers.
00102   static std::set<G4String> fUnitCategories;  // Set of legal unit categories.
00103   static std::map<G4String,G4String> fStandardUnits;  // Standard units.
00104   static std::set<G4String> fCategories;      // Set of legal categories.
00105   static std::set<G4String> fUnits;           // Set of legal units.
00106   static std::set<G4String> fValueTypes;      // Set of legal value types.
00107 };
00108 
00109 #endif //G4ATTCHECK_HH

Generated on Mon May 27 17:47:41 2013 for Geant4 by  doxygen 1.4.7