2 // ********************************************************************
3 // * License and Disclaimer *
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. *
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. *
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 // ********************************************************************
32 //_____________________________________________________________________________
34 G4Parameter<T>::G4Parameter(const G4String& name, T initValue, G4MergeMode mergeMode)
35 : G4VParameter(name, mergeMode),
40 //_____________________________________________________________________________
42 G4Parameter<T>::G4Parameter(const G4Parameter& rhs)
45 fInitValue(rhs.fInitValue)
48 //_____________________________________________________________________________
50 G4Parameter<T>::~G4Parameter()
53 //_____________________________________________________________________________
56 G4Parameter<T>::operator=(const G4Parameter<T>& rhs)
58 // check assignment to self
59 if (this == &rhs) return *this;
61 // base class assignment
62 G4VParameter::operator=(rhs);
64 // this class data assignment
66 fInitValue = rhs.fInitValue;
71 //_____________________________________________________________________________
74 G4Parameter<T>::operator+=(const G4Parameter<T>& rhs)
76 // only update the value from rhs
81 //_____________________________________________________________________________
84 G4Parameter<T>::operator*=(const G4Parameter<T>& rhs)
86 // only update the value from rhs
91 //_____________________________________________________________________________
94 G4Parameter<T>::operator=(const T& value)
96 // only update the value
101 //_____________________________________________________________________________
102 template <typename T>
104 G4Parameter<T>::operator+=(const T& value)
106 // only update the value
111 //_____________________________________________________________________________
112 template <typename T>
114 G4Parameter<T>::operator*=(const T& value)
116 // only update the value from rhs
121 //_____________________________________________________________________________
122 template <typename T>
123 void G4Parameter<T>::Merge(const G4VParameter& other)
125 if ( fMergeMode == G4MergeMode::kAddition ) {
126 fValue += static_cast<const G4Parameter<T>&>(other).fValue;
128 else if ( fMergeMode == G4MergeMode::kMultiplication ) {
129 fValue *= static_cast<const G4Parameter<T>&>(other).fValue;
131 // no operation is performed if User merge mode
134 //_____________________________________________________________________________
135 template <typename T>
136 void G4Parameter<T>::Reset()
141 //_____________________________________________________________________________
142 template <typename T>
143 T G4Parameter<T>::GetValue() const