LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
pyG4UnitsTable.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: pyG4UnitsTable.cc 66892 2013-01-17 10:57:59Z gunter $
27 // ====================================================================
28 // pyG4UnitsTable.cc
29 //
30 // 2005 Q
31 // ====================================================================
32 #include <boost/python.hpp>
33 #include "pyG4indexing.hh"
34 #include "G4UnitsTable.hh"
35 
36 using namespace boost::python;
37 
38 // ====================================================================
39 // module definition
40 // ====================================================================
42 {
43  class_<G4UnitsTable>("G4UnitsTable", "Units Table")
45  ;
46 
47  class_<G4UnitsContainer>("G4UnitsContainer", "Units Container")
49  ;
50 
51  class_<G4UnitDefinition, boost::noncopyable>
52  ("G4UnitDefinition", "Unit Definition", no_init)
53  .def(init<const G4String&, const G4String&, const G4String&, G4double>())
54  // ---
55  .def("GetName", &G4UnitDefinition::GetName,
56  return_value_policy<return_by_value>())
57  .def("GetSymbol", &G4UnitDefinition::GetSymbol,
58  return_value_policy<return_by_value>())
59  .def("GetValue", &G4UnitDefinition::GetValue)
60  .def("PrintDefinition", &G4UnitDefinition::PrintDefinition)
61  // ---
62  .def("BuildUnitsTable", &G4UnitDefinition::BuildUnitsTable)
63  .staticmethod("BuildUnitsTable")
64  .def("PrintUnitsTable", &G4UnitDefinition::PrintUnitsTable)
65  .staticmethod("PrintUnitsTable")
66  .def("GetUnitsTable", &G4UnitDefinition::GetUnitsTable,
67  return_value_policy<reference_existing_object>())
68  .staticmethod("GetUnitsTable")
69  // ---
70  .def("GetValueOf", &G4UnitDefinition::GetValueOf)
71  .staticmethod("GetValueOf")
72  .def("GetCategory", &G4UnitDefinition::GetCategory)
73  .staticmethod("GetCategory")
74  ;
75 
76  class_<G4UnitsCategory, boost::noncopyable>
77  ("G4UnitsCategory", "Units Category", no_init)
78  .def(init<const G4String&>())
79  // ---
80  .def("GetName", &G4UnitsCategory::GetName,
81  return_value_policy<return_by_value>())
82  .def("GetUnitsList", &G4UnitsCategory::GetUnitsList,
83  return_value_policy<reference_existing_object>())
84  .def("GetNameMxLen", &G4UnitsCategory::GetNameMxLen)
85  .def("GetSymbMxLen", &G4UnitsCategory::GetSymbMxLen)
86  .def("UpdateNameMxLen", &G4UnitsCategory::UpdateNameMxLen)
87  .def("UpdateSymbMxLen", &G4UnitsCategory::UpdateSymbMxLen)
88  .def("PrintCategory", &G4UnitsCategory::PrintCategory)
89  ;
90 
91  class_<G4BestUnit>("G4BestUnit", "present best unit", no_init)
92  .def(init<G4double, const G4String&>())
93  .def(init<const G4ThreeVector&, const G4String&>())
94  // ---
95  .def("GetCategory", &G4BestUnit::GetCategory,
96  return_value_policy<return_by_value>())
97  .def("GetIndexOfCategory", &G4BestUnit::GetIndexOfCategory)
98  .def(self_ns::str(self))
99  ;
100 
101 }
102 
void export_G4UnitsTable()