1 | // |
---|
2 | // ******************************************************************** |
---|
3 | // * License and Disclaimer * |
---|
4 | // * * |
---|
5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
7 | // * conditions of the Geant4 Software License, included in the file * |
---|
8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
9 | // * include a list of copyright holders. * |
---|
10 | // * * |
---|
11 | // * Neither the authors of this software system, nor their employing * |
---|
12 | // * institutes,nor the agencies providing financial support for this * |
---|
13 | // * work make any representation or warranty, express or implied, * |
---|
14 | // * regarding this software system or assume any liability for its * |
---|
15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
16 | // * for the full disclaimer and the limitation of liability. * |
---|
17 | // * * |
---|
18 | // * This code implementation is the result of the scientific and * |
---|
19 | // * technical work of the GEANT4 collaboration. * |
---|
20 | // * By using, copying, modifying or distributing the software (or * |
---|
21 | // * any work based on the software) you agree to acknowledge its * |
---|
22 | // * use in resulting scientific publications, and indicate your * |
---|
23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
24 | // ******************************************************************** |
---|
25 | // |
---|
26 | // |
---|
27 | // $Id: G4AttCheck.hh,v 1.8 2006/10/17 16:14:08 allison Exp $ |
---|
28 | // GEANT4 tag $Name: HEAD $ |
---|
29 | |
---|
30 | #ifndef G4ATTCHECK_HH |
---|
31 | #define G4ATTCHECK_HH |
---|
32 | |
---|
33 | // Class Description: |
---|
34 | // |
---|
35 | // @class G4AttCheck |
---|
36 | // |
---|
37 | // @brief Checks G4AttValue's and their corresponding G4AttDef map. |
---|
38 | // |
---|
39 | // Usage (a): G4AttCheck(values,definitions); |
---|
40 | // or (b): G4cout << G4AttCheck(values,definitions) << G4endl; |
---|
41 | // |
---|
42 | // For further details, see the HepRep home page at http://heprep.freehep.org |
---|
43 | // |
---|
44 | // @author J.Allison |
---|
45 | // @author J.Perl |
---|
46 | // Class Description - End: |
---|
47 | |
---|
48 | #include "globals.hh" |
---|
49 | |
---|
50 | #include <set> |
---|
51 | #include <vector> |
---|
52 | #include <map> |
---|
53 | #include <iostream> |
---|
54 | |
---|
55 | class G4AttValue; |
---|
56 | class G4AttDef; |
---|
57 | |
---|
58 | class G4AttCheck { |
---|
59 | |
---|
60 | public: // With description |
---|
61 | |
---|
62 | G4AttCheck |
---|
63 | (const std::vector<G4AttValue>* values, |
---|
64 | const std::map<G4String,G4AttDef>* definitions); |
---|
65 | |
---|
66 | ~G4AttCheck(); |
---|
67 | |
---|
68 | const std::vector<G4AttValue>* GetAttValues() const { |
---|
69 | return fpValues; |
---|
70 | } |
---|
71 | |
---|
72 | const std::map<G4String,G4AttDef>* GetAttDefs() const { |
---|
73 | return fpDefinitions; |
---|
74 | } |
---|
75 | |
---|
76 | G4bool Check(const G4String& leader = "") const; |
---|
77 | // Check only. Silent unless error - then G4cerr. Returns error. |
---|
78 | // Provide leader, e.g., name of calling function. |
---|
79 | |
---|
80 | G4bool Standard |
---|
81 | (std::vector<G4AttValue>* standardValues, |
---|
82 | std::map<G4String,G4AttDef>* standardDefinitions) |
---|
83 | const; |
---|
84 | // Places standard versions in provided containers and returns error. |
---|
85 | |
---|
86 | friend std::ostream& operator<< (std::ostream&, const G4AttCheck&); |
---|
87 | |
---|
88 | private: |
---|
89 | |
---|
90 | void AddValuesAndDefs |
---|
91 | (std::vector<G4AttValue>* newValues, |
---|
92 | std::map<G4String,G4AttDef>* newDefinitions, |
---|
93 | const G4String& oldName, |
---|
94 | const G4String& name, |
---|
95 | const G4String& value, |
---|
96 | const G4String& extra, |
---|
97 | const G4String& description = "") const; // Utility function for Standard. |
---|
98 | |
---|
99 | const std::vector<G4AttValue>* fpValues; |
---|
100 | const std::map<G4String,G4AttDef>* fpDefinitions; |
---|
101 | |
---|
102 | static G4bool fFirst; // Flag for initialising the following containers. |
---|
103 | static std::set<G4String> fUnitCategories; // Set of legal unit categories. |
---|
104 | static std::map<G4String,G4String> fStandardUnits; // Standard units. |
---|
105 | static std::set<G4String> fCategories; // Set of legal categories. |
---|
106 | static std::set<G4String> fUnits; // Set of legal units. |
---|
107 | static std::set<G4String> fValueTypes; // Set of legal value types. |
---|
108 | }; |
---|
109 | |
---|
110 | #endif //G4ATTCHECK_HH |
---|