source: src/Parameters/Parameter_impl.hpp@ 9b5eb0

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator CombiningParticlePotentialParsing Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_BoundInBox_CenterInBox_MoleculeActions Fix_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_PopActions Fix_QtFragmentList_sorted_selection Fix_Restrictedkeyset_FragmentMolecule Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fix_fitting_potentials Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PdbParser_setsAtomName PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks Rewrite_FitPartialCharges RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg Switchable_LogView ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps TremoloParser_setsAtomName Ubuntu_1604_changes stable
Last change on this file since 9b5eb0 was adcfc6, checked in by Michael Ankele <ankele@…>, 13 years ago

added Parameter<T> class

  • Property mode set to 100644
File size: 3.7 KB
Line 
1/*
2 * Parameter_impl.hpp
3 *
4 * Created on: Apr 16, 2012
5 * Author: ankele
6 */
7
8#ifndef PARAMETER_IMPL_HPP_
9#define PARAMETER_IMPL_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16#include "Parameter.hpp"
17
18/** Constructor for class Parameter.
19 *
20 */
21template<typename T>
22Parameter<T>::Parameter(const std::string &_name) :
23 ParameterInterface<T>(_name),
24 Value<T>()
25{};
26
27/** Constructor for class Parameter.
28 *
29 * @param _name name of this parameter
30 * @param _value initial value to set
31 */
32template<typename T>
33Parameter<T>::Parameter(const std::string &_name, const T &_value) :
34 ParameterInterface<T>(_name),
35 Value<T>()
36{
37 Value<T>::set(_value);
38};
39
40/** Constructor for class Parameter.
41 *
42 * @param _name name of this parameter
43 * @param _ValidRange valid range for this ContinuousValue
44 */
45template<typename T>
46Parameter<T>::Parameter(const std::string &_name, const Validator<T> &_Validator) :
47 ParameterInterface<T>(_name),
48 Value<T>(_Validator)
49{};
50
51/** Constructor for class Parameter.
52 *
53 * @param _name name of this parameter
54 * @param _ValidRange valid range for this ContinuousValue
55 * @param _value initial value to set
56 */
57template<typename T>
58Parameter<T>::Parameter(const std::string &_name, const Validator<T> &_Validator, const T &_value) :
59 ParameterInterface<T>(_name),
60 Value<T>(_Validator)
61{
62 Value<T>::set(_value);
63};
64
65/** Constructor for class Parameter.
66 *
67 * @param _name name of this parameter
68 * @param _ValidRange valid range for this ContinuousValue
69 */
70template<typename T>
71Parameter<T>::Parameter(const std::string &_name, const std::vector<T> &_ValidValues) :
72 ParameterInterface<T>(_name),
73 Value<T>(_ValidValues)
74{};
75
76/** Constructor for class Parameter.
77 *
78 * @param _name name of this parameter
79 * @param _ValidRange valid range for this ContinuousValue
80 * @param _value initial value to set
81 */
82template<typename T>
83Parameter<T>::Parameter(const std::string &_name, const std::vector<T> &_ValidValues, const T &_value) :
84 ParameterInterface<T>(_name),
85 Value<T>(_ValidValues)
86{
87 Value<T>::set(_value);
88};
89
90/** Constructor for class Parameter.
91 *
92 * @param _name name of this parameter
93 * @param _ValidRange valid range for this ContinuousValue
94 */
95template<typename T>
96Parameter<T>::Parameter(const std::string &_name, const range<T> &_ValidRange) :
97 ParameterInterface<T>(_name),
98 Value<T>(_ValidRange)
99{};
100
101/** Constructor for class Parameter.
102 *
103 * @param _name name of this parameter
104 * @param _ValidRange valid range for this ContinuousValue
105 * @param _value initial value to set
106 */
107template<typename T>
108Parameter<T>::Parameter(const std::string &_name, const range<T> &_ValidRange, const T &_value) :
109 ParameterInterface<T>(_name),
110 Value<T>(_ValidRange)
111{
112 Value<T>::set(_value);
113};
114
115/** Destructor for class Parameter.
116 *
117 */
118template<typename T>
119Parameter<T>::~Parameter()
120{};
121
122/** Compares this continuous value against another \a _instance.
123 *
124 * @param _instance other value to compare to
125 * @return true - if contained ContinuousValue and name are the same, false - else
126 */
127template <class T>
128bool Parameter<T>::operator==(const Parameter<T> &_instance) const
129{
130 bool status = true;
131 status = status &&
132 (*dynamic_cast<const Value<T> *>(this) == dynamic_cast<const Value<T> &>(_instance));
133 status = status && (ParameterInterface<T>::getName() == _instance.ParameterInterface<T>::getName());
134 return status;
135}
136
137/** Creates a clone of this Parameter instance.
138 *
139 * @return cloned instance
140 */
141template<typename T>
142ParameterInterface<T>* Parameter<T>::clone() const
143{
144 Parameter<T> *instance = new Parameter<T>(ParameterInterface<T>::getName(), Value<T>::getValidator());
145 instance->set(Value<T>::get());
146 return instance;
147}
148
149
150#endif /* Parameter_IMPL_HPP_ */
Note: See TracBrowser for help on using the repository browser.