Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pyG4GDMLParser.cc
Go to the documentation of this file.
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 // $Id: pyG4GDMLParser.cc,v 1.5 2010-12-02 08:24:22 kmura Exp $
27 // $Name: not supported by cvs2svn $
28 // ====================================================================
29 // pyG4GDMLParser.cc
30 //
31 // 2007 Q
32 // ====================================================================
33 #ifdef ENABLE_GDML
34 
35 #include <boost/python.hpp>
36 #include "G4GDMLParser.hh"
37 #include "G4LogicalVolume.hh"
38 #include "G4Material.hh"
39 #include "G4Version.hh"
40 
41 using namespace boost::python;
42 
43 // ====================================================================
44 // thin wrappers
45 // ====================================================================
46 namespace pyG4GDMLParser {
47 
49  GetWorldVolume, 0, 1);
50 
51 void (G4GDMLParser::*f1_Write)
52  (const G4String&, const G4VPhysicalVolume*, G4bool,
53  const G4String&) = &G4GDMLParser::Write;
54 
55 void (G4GDMLParser::*f2_Write)
56  (const G4String&, const G4LogicalVolume*, G4bool,
57  const G4String&) = &G4GDMLParser::Write;
58 
59 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(g_Write, Write, 2, 4);
60 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_Read, Read, 1, 2);
61 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_ReadModule, ReadModule, 1, 2);
62 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_Write, Write, 1, 4);
63 
64 }
65 
66 using namespace pyG4GDMLParser;
67 
68 // ====================================================================
69 // module definition
70 // ====================================================================
71 void export_G4GDMLParser()
72 {
73  class_<G4GDMLParser, boost::noncopyable>
74  ("G4GDMLParser", "GDML parser")
75  // ---
76  .def("Read", &G4GDMLParser::Read, f_Read())
77  .def("ReadModule", &G4GDMLParser::ReadModule, f_ReadModule())
78  .def("ParseST", &G4GDMLParser::ParseST,
79  return_value_policy<reference_existing_object>())
80  .def("Write", f1_Write, f_Write())
81  .def("Write", f2_Write, g_Write())
82  .def("GetWorldVolume", &G4GDMLParser::GetWorldVolume,
83  f_GetWorldVolume()
84  [return_value_policy<reference_existing_object>()])
85  ;
86 }
87 
88 #endif