Geant4 Cross Reference |
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 28 #ifndef G4ATTDEF_HH 29 #define G4ATTDEF_HH 30 31 #include "globals.hh" 32 #include "G4TypeKey.hh" 33 #include <map> 34 35 // Class Description: 36 // 37 // @class G4AttDef 38 // 39 // @brief This class represents a HepRep-style Attribute Definition. 40 // The G4AttDef is used to define new kinds of attributes that can 41 // then have values set for a Trajectory, Trajectory Point or Sensitive 42 // Detector Hit. These attributes are then made available to the end user 43 // in an interactive visualization system (such as WIRED). 44 // Values are set by creating G4AttValue objects and attaching them to the 45 // relevant Trajectory, Trajectory Point or Sensitive Detector Hit. 46 // The association between the G4AttValue and the G4AttDef object is 47 // made through the data member "name". 48 // For details, see the HepRep home page at http://heprep.freehep.org 49 // 50 // @author M.Frailis 51 // @author R.Giannitrapani 52 // @author J.Perl 53 // Class Description - End: 54 55 56 class G4AttDef{ 57 58 public: 59 G4AttDef(const G4String& name, 60 const G4String& desc, 61 const G4String& category, 62 const G4String& extra, 63 const G4String& valueType): 64 m_name(name),m_desc(desc), 65 m_category(category), 66 m_extra(extra),m_valueType(valueType){}; 67 68 // G4Typekey based constructor 69 G4AttDef(const G4String& name, 70 const G4String& desc, 71 const G4String& category, 72 const G4String& extra, 73 const G4TypeKey& typeKey): 74 m_name(name),m_desc(desc), 75 m_category(category), 76 m_extra(extra),m_valueType("Null"), 77 m_typeKey(typeKey) 78 {}; 79 80 G4AttDef()= default; 81 virtual ~G4AttDef()= default; 82 83 const G4String& GetName()const{return m_name;}; 84 const G4String& GetDesc()const{return m_desc;}; 85 const G4String& GetCategory()const{return m_category;}; 86 const G4String& GetExtra()const{return m_extra;}; 87 const G4String& GetValueType()const{return m_valueType;}; 88 const G4TypeKey& GetTypeKey()const{return m_typeKey;}; 89 90 void SetName(const G4String& name){m_name = name;}; 91 void SetDesc(const G4String& desc){m_desc = desc;}; 92 void SetCategory(const G4String& cat){m_category = cat;}; 93 void SetExtra(const G4String& extra){m_extra = extra;}; 94 void SetValueType(const G4String& type){m_valueType = type;}; 95 96 private: 97 /// The name of the attribute 98 G4String m_name; 99 /// A short description of the attribute 100 G4String m_desc; 101 /// The category (Draw, Physics, PickAction, Association, etc.) 102 G4String m_category; 103 /// Some extra property of the attribute (units, etc.) 104 G4String m_extra; 105 /// The type of the value of the attribute (int, double, vector, etc.) 106 G4String m_valueType; 107 // Type key 108 G4TypeKey m_typeKey; 109 110 }; 111 112 // Deprecated. It is not a good idea to output a pointer since failure to 113 // include this prototype will not cause a compilation error - it will merely 114 // cause your code to use a default function that outputs the pointer as an 115 // address. 116 [[deprecated("Use pass-by-reference version instead.")]] 117 std::ostream& operator<< 118 (std::ostream& os, const std::map<G4String,G4AttDef>* definitions); 119 120 // Use this instead. 121 std::ostream& operator<< 122 (std::ostream& os, const std::map<G4String,G4AttDef>& definitions); 123 124 #endif //G4ATTDEF_H 125