G4HepRepFileXMLWriter.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 //--------------------------------------------------------------------------
00028 // File and Version Information:
00029 //      $Id$
00030 //
00031 // Description:
00032 //      Create a HepRep XML File (HepRep version 1).
00033 //
00034 // Environment:
00035 //      Software developed for the general High Energy Physics community.
00036 //
00037 // Author :
00038 //       J. Perl                    Original Author
00039 //
00040 // Copyright Information:
00041 //      Copyright (C) 2001          Stanford Linear Accelerator Center
00042 //------------------------------------------------------------------------
00043 #ifndef G4HepRepFileXMLWriter_hh
00044 #define G4HepRepFileXMLWriter_hh
00045 
00046 //#define G4HEPREPFILEDEBUG  // Comment this out to suppress debug code.
00047 
00048 #include "globals.hh"
00049 #include <fstream>
00050 
00051 class G4HepRepFileXMLWriter
00052 {
00053 public:
00054   G4HepRepFileXMLWriter();
00055 
00056   void addType(const char* name, int newTypeDepth);
00057   void addInstance();
00058   void addPrimitive();
00059   void addPoint(double x, double y, double z);
00060 
00061   void addAttDef(const char* name,
00062                  const char* desc,
00063                  const char* type,
00064                  const char* extra);
00065 
00066   void addAttValue(const char* name,
00067                    const char* value);
00068 
00069   void addAttValue(const char* name,
00070                    double value);
00071 
00072   void addAttValue(const char* name,
00073                    int value);
00074 
00075   void addAttValue(const char* name,
00076                    bool value);
00077 
00078   void addAttValue(const char* name,
00079                    double value1,
00080                    double value2,
00081                    double value3);
00082 
00083   void open(const char* filespec);
00084   void close();
00085 
00086   void endTypes();
00087 
00088   bool isOpen;
00089   int typeDepth;
00090   bool inType[50];
00091   bool inInstance[50];
00092   char* prevTypeName[50];
00093   
00094 private:
00095   std::ofstream fout;
00096 
00097   void init();
00098 
00099   bool inPrimitive;
00100   bool inPoint;
00101 
00102   void endType();
00103   void endInstance();
00104   void endPrimitive();
00105   void endPoint();
00106 
00107   void indent();
00108 };
00109 #endif

Generated on Mon May 27 17:48:30 2013 for Geant4 by  doxygen 1.4.7