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 | // File and Version Information: |
---|
29 | // $Id: G4HepRepFileXMLWriter.hh,v 1.2 2006/06/29 21:17:12 gunter Exp $ |
---|
30 | // |
---|
31 | // Description: |
---|
32 | // Create a HepRep XML File (HepRep version 1). |
---|
33 | // |
---|
34 | // Environment: |
---|
35 | // Software developed for the general High Energy Physics community. |
---|
36 | // |
---|
37 | // Author : |
---|
38 | // J. Perl Original Author |
---|
39 | // |
---|
40 | // Copyright Information: |
---|
41 | // Copyright (C) 2001 Stanford Linear Accelerator Center |
---|
42 | //------------------------------------------------------------------------ |
---|
43 | #ifndef G4HepRepFileXMLWriter_hh |
---|
44 | #define G4HepRepFileXMLWriter_hh |
---|
45 | |
---|
46 | //#define G4HEPREPFILEDEBUG // Comment this out to suppress debug code. |
---|
47 | |
---|
48 | #include "globals.hh" |
---|
49 | #include <fstream> |
---|
50 | |
---|
51 | class G4HepRepFileXMLWriter |
---|
52 | { |
---|
53 | public: |
---|
54 | G4HepRepFileXMLWriter(); |
---|
55 | |
---|
56 | void addType(const char* name, int newTypeDepth); |
---|
57 | void addInstance(); |
---|
58 | void addPrimitive(); |
---|
59 | void addPoint(double x, double y, double z); |
---|
60 | |
---|
61 | void addAttDef(const char* name, |
---|
62 | const char* desc, |
---|
63 | const char* type, |
---|
64 | const char* extra); |
---|
65 | |
---|
66 | void addAttValue(const char* name, |
---|
67 | const char* value); |
---|
68 | |
---|
69 | void addAttValue(const char* name, |
---|
70 | double value); |
---|
71 | |
---|
72 | void addAttValue(const char* name, |
---|
73 | int value); |
---|
74 | |
---|
75 | void addAttValue(const char* name, |
---|
76 | bool value); |
---|
77 | |
---|
78 | void addAttValue(const char* name, |
---|
79 | double value1, |
---|
80 | double value2, |
---|
81 | double value3); |
---|
82 | |
---|
83 | void open(const char* filespec); |
---|
84 | void close(); |
---|
85 | |
---|
86 | void endTypes(); |
---|
87 | |
---|
88 | bool isOpen; |
---|
89 | int typeDepth; |
---|
90 | bool inType[50]; |
---|
91 | bool inInstance[50]; |
---|
92 | char* prevTypeName[50]; |
---|
93 | |
---|
94 | private: |
---|
95 | std::ofstream fout; |
---|
96 | |
---|
97 | void init(); |
---|
98 | |
---|
99 | bool inPrimitive; |
---|
100 | bool inPoint; |
---|
101 | |
---|
102 | void endType(); |
---|
103 | void endInstance(); |
---|
104 | void endPrimitive(); |
---|
105 | void endPoint(); |
---|
106 | |
---|
107 | void indent(); |
---|
108 | }; |
---|
109 | #endif |
---|