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.4 2010/06/04 05:46:43 kmura Exp $ |
---|
27 | // $Name: geant4-09-04-beta-01 $ |
---|
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 | |
---|
48 | #if G4VERSION_NUMBER >= 920 |
---|
49 | BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_Read, Read, 1, 2); |
---|
50 | BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_ReadModule, ReadModule, 1, 2); |
---|
51 | BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_Write, Write, 1, 4); |
---|
52 | #endif |
---|
53 | |
---|
54 | BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_GetWorldVolume, |
---|
55 | GetWorldVolume, 0, 1); |
---|
56 | } |
---|
57 | |
---|
58 | using namespace pyG4GDMLParser; |
---|
59 | |
---|
60 | // ==================================================================== |
---|
61 | // module definition |
---|
62 | // ==================================================================== |
---|
63 | void export_G4GDMLParser() |
---|
64 | { |
---|
65 | class_<G4GDMLParser, boost::noncopyable> |
---|
66 | ("G4GDMLParser", "GDML parser") |
---|
67 | // --- |
---|
68 | #if G4VERSION_NUMBER < 920 |
---|
69 | .def("Read", &G4GDMLParser::Read) |
---|
70 | #else |
---|
71 | .def("Read", &G4GDMLParser::Read, f_Read()) |
---|
72 | .def("ReadModule", &G4GDMLParser::ReadModule, f_ReadModule()) |
---|
73 | .def("Write", &G4GDMLParser::Write, f_Write()) |
---|
74 | .def("ParseST", &G4GDMLParser::ParseST, |
---|
75 | return_value_policy<reference_existing_object>()) |
---|
76 | #endif |
---|
77 | .def("GetWorldVolume", &G4GDMLParser::GetWorldVolume, |
---|
78 | f_GetWorldVolume() |
---|
79 | [return_value_policy<reference_existing_object>()]) |
---|
80 | ; |
---|
81 | } |
---|
82 | |
---|
83 | #endif |
---|