source: trunk/source/persistency/gdml/include/G4GDMLWrite.hh

Last change on this file was 1337, checked in by garnier, 14 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 4.9 KB
Line 
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: G4GDMLWrite.hh,v 1.42 2010/02/18 17:39:00 gcosmo Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-01 $
29//
30//
31// class G4GDMLWrite
32//
33// Class description:
34//
35// GDML writer.
36
37// History:
38// - Created.                                  Zoltan Torzsok, November 2007
39// -------------------------------------------------------------------------
40
41#ifndef _G4GDMLWRITE_INCLUDED_
42#define _G4GDMLWRITE_INCLUDED_
43
44#include <map>
45
46#include <xercesc/dom/DOM.hpp>
47#include <xercesc/util/XMLString.hpp>
48#include <xercesc/util/PlatformUtils.hpp>
49#include <xercesc/framework/LocalFileFormatTarget.hpp>
50
51#include "G4Transform3D.hh"
52
53class G4LogicalVolume;
54class G4VPhysicalVolume;
55
56class G4GDMLWrite
57{
58  typedef std::map<const G4LogicalVolume*,G4Transform3D> VolumeMapType;
59  typedef std::map<const G4VPhysicalVolume*,G4String> PhysVolumeMapType;
60  typedef std::map<G4int,G4int> DepthMapType;
61
62  public:  // with description
63
64    G4Transform3D Write(const G4String& filename,
65                        const G4LogicalVolume* const topLog,
66                        const G4String& schemaPath,
67                        const G4int depth, G4bool storeReferences=true);
68      //
69      // Main method for writing GDML files.
70
71    void AddModule(const G4VPhysicalVolume* const topVol);
72    void AddModule(const G4int depth);
73      //
74      // Split geometry structure in modules, by volume subtree or level
75
76    static void SetAddPointerToName(G4bool);
77      //
78      // Specify if to add or not memory addresses to IDs.
79
80    virtual void DefineWrite(xercesc::DOMElement*)=0;
81    virtual void MaterialsWrite(xercesc::DOMElement*)=0;
82    virtual void SolidsWrite(xercesc::DOMElement*)=0;
83    virtual void StructureWrite(xercesc::DOMElement*)=0;
84    virtual G4Transform3D TraverseVolumeTree(const G4LogicalVolume* const,
85                                             const G4int)=0;
86    virtual void SurfacesWrite()=0;
87    virtual void SetupWrite(xercesc::DOMElement*,
88                            const G4LogicalVolume* const)=0;
89      //
90      // Pure virtual methods implemented in concrete writer plugin's classes
91
92    virtual void ExtensionWrite(xercesc::DOMElement*);
93    virtual void AddExtension(xercesc::DOMElement*,
94                              const G4LogicalVolume* const);
95      //
96      // To be implemented in the client code for handling extensions
97      // to the GDML schema, identified with the tag "extension".
98      // The implementation should be placed inside a user-class
99      // inheriting from G4GDMLWriteStructure and being registered
100      // as argument to G4GDMLParser.
101
102  protected:
103
104    G4GDMLWrite();
105    virtual ~G4GDMLWrite();
106
107    VolumeMapType& VolumeMap();
108
109    G4String GenerateName(const G4String&,const void* const);
110    xercesc::DOMAttr* NewAttribute(const G4String&, const G4String&);
111    xercesc::DOMAttr* NewAttribute(const G4String&, const G4double&);
112    xercesc::DOMElement* NewElement(const G4String&);
113    G4String Modularize(const G4VPhysicalVolume* const topvol,
114                        const G4int depth);
115
116    G4bool FileExists(const G4String&) const;
117    PhysVolumeMapType& PvolumeMap();
118    DepthMapType& DepthMap();
119
120  protected:
121
122    G4String SchemaLocation;
123    static G4bool addPointerToName;
124    xercesc::DOMDocument* doc;
125    xercesc::DOMElement* extElement;
126    XMLCh tempStr[10000];
127
128};
129
130#endif
Note: See TracBrowser for help on using the repository browser.