Geant4  10.00.p01
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")
44  .def(vector_indexing_suite<G4UnitsTable>())
45  ;
46 
47  class_<G4UnitsContainer>("G4UnitsContainer", "Units Container")
48  .def(vector_indexing_suite<G4UnitsContainer>())
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 
G4int GetNameMxLen() const
static void BuildUnitsTable()
const G4String & GetCategory() const
G4int GetSymbMxLen() const
const G4String & GetSymbol() const
G4UnitsContainer & GetUnitsList()
static G4double GetValueOf(const G4String &)
void UpdateSymbMxLen(G4int len)
const G4String & GetName() const
static G4UnitsTable & GetUnitsTable()
static G4String GetCategory(const G4String &)
void export_G4UnitsTable()
static void PrintUnitsTable()
const G4String & GetName() const
G4double GetValue() const
void UpdateNameMxLen(G4int len)
size_t GetIndexOfCategory() const