Changeset 6440c6 for src/Parameters
- Timestamp:
- Feb 13, 2013, 3:47:46 PM (12 years ago)
- Branches:
- 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
- Children:
- cf1d82
- Parents:
- b11f5e
- git-author:
- Frederik Heber <heber@…> (01/10/13 13:27:38)
- git-committer:
- Frederik Heber <heber@…> (02/13/13 15:47:46)
- Location:
- src/Parameters
- Files:
-
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parameters/Makefile.am
rb11f5e r6440c6 31 31 Parameters/Parameter.hpp \ 32 32 Parameters/Parameter_impl.hpp \ 33 Parameters/ParameterAsString.hpp \34 33 Parameters/ParameterInterface.hpp \ 35 34 Parameters/Validators/DiscreteValidator.hpp \ -
src/Parameters/Parameter.hpp
rb11f5e r6440c6 28 28 */ 29 29 template <typename T> 30 class Parameter : public ParameterInterface<T>, public Value<T> 30 class Parameter : 31 virtual public ParameterInterface, 32 virtual public Value<T> 31 33 { 32 34 public: … … 53 55 { return !((*this)==(_instance)); } 54 56 55 Parameter AsString* clone() const;57 ParameterInterface* clone() const; 56 58 57 59 //private: // TODO... -
src/Parameters/ParameterInterface.hpp
rb11f5e r6440c6 16 16 #include <string> 17 17 18 #include "Parameters/ValueInterface.hpp" 19 #include "Parameters/ParameterAsString.hpp" 18 #include "CodePatterns/Clone.hpp" 20 19 20 #include "Parameters/ValueAsString.hpp" 21 21 22 /** This interface represents a clonable,named Value.22 /** This interface represents a named Value. 23 23 * 24 24 */ 25 template <class T> 26 class ParameterInterface : virtual public ParameterAsString, virtual public ValueInterface<T> 25 class ParameterInterface : 26 virtual public ValueAsString, 27 public Clone<ParameterInterface> 27 28 { 28 29 public: … … 31 32 32 33 const std::string &getName() const { return name; } 34 35 virtual ParameterInterface* clone() const=0; 33 36 34 37 private: -
src/Parameters/Parameter_impl.hpp
rb11f5e r6440c6 20 20 template<typename T> 21 21 Parameter<T>::Parameter(const Parameter<T> &instance) : 22 ParameterInterface <T>(instance.getName()),22 ParameterInterface(instance.getName()), 23 23 Value<T>(instance.getValidator()) 24 24 { … … 31 31 template<typename T> 32 32 Parameter<T>::Parameter() : 33 ParameterInterface <T>("__no_name__"),33 ParameterInterface("__no_name__"), 34 34 Value<T>() 35 35 {}; … … 40 40 template<typename T> 41 41 Parameter<T>::Parameter(const std::string &_name) : 42 ParameterInterface <T>(_name),42 ParameterInterface(_name), 43 43 Value<T>() 44 44 {}; … … 51 51 template<typename T> 52 52 Parameter<T>::Parameter(const std::string &_name, const T &_value) : 53 ParameterInterface <T>(_name),53 ParameterInterface(_name), 54 54 Value<T>() 55 55 { … … 64 64 template<typename T> 65 65 Parameter<T>::Parameter(const std::string &_name, const Validator<T> &_Validator) : 66 ParameterInterface <T>(_name),66 ParameterInterface(_name), 67 67 Value<T>(_Validator) 68 68 {}; … … 76 76 template<typename T> 77 77 Parameter<T>::Parameter(const std::string &_name, const Validator<T> &_Validator, const T &_value) : 78 ParameterInterface <T>(_name),78 ParameterInterface(_name), 79 79 Value<T>(_Validator) 80 80 { … … 89 89 template<typename T> 90 90 Parameter<T>::Parameter(const std::string &_name, const std::vector<T> &_ValidValues) : 91 ParameterInterface <T>(_name),91 ParameterInterface(_name), 92 92 Value<T>(_ValidValues) 93 93 {}; … … 101 101 template<typename T> 102 102 Parameter<T>::Parameter(const std::string &_name, const std::vector<T> &_ValidValues, const T &_value) : 103 ParameterInterface <T>(_name),103 ParameterInterface(_name), 104 104 Value<T>(_ValidValues) 105 105 { … … 114 114 template<typename T> 115 115 Parameter<T>::Parameter(const std::string &_name, const range<T> &_ValidRange) : 116 ParameterInterface <T>(_name),116 ParameterInterface(_name), 117 117 Value<T>(_ValidRange) 118 118 {}; … … 126 126 template<typename T> 127 127 Parameter<T>::Parameter(const std::string &_name, const range<T> &_ValidRange, const T &_value) : 128 ParameterInterface <T>(_name),128 ParameterInterface(_name), 129 129 Value<T>(_ValidRange) 130 130 { … … 149 149 return Value<T>::getAsString(); 150 150 } catch(ParameterException &e) { 151 e << ParameterName(ParameterInterface <T>::getName());151 e << ParameterName(ParameterInterface::getName()); 152 152 throw; 153 153 } … … 164 164 return Value<T>::get(); 165 165 } catch(ParameterException &e) { 166 e << ParameterName(ParameterInterface <T>::getName());166 e << ParameterName(ParameterInterface::getName()); 167 167 throw; 168 168 } … … 179 179 Value<T>::set(_value); 180 180 } catch(ParameterException &e) { 181 e << ParameterName(ParameterInterface <T>::getName());181 e << ParameterName(ParameterInterface::getName()); 182 182 throw; 183 183 } … … 194 194 Value<T>::setAsString(_value); 195 195 } catch(ParameterException &e) { 196 e << ParameterName(ParameterInterface <T>::getName());196 e << ParameterName(ParameterInterface::getName()); 197 197 throw; 198 198 } … … 211 211 status = status && 212 212 (*dynamic_cast<const Value<T> *>(this) == dynamic_cast<const Value<T> &>(_instance)); 213 status = status && (ParameterInterface <T>::getName() == _instance.ParameterInterface<T>::getName());214 } catch(ParameterException &e) { 215 e << ParameterName(ParameterInterface <T>::getName());213 status = status && (ParameterInterface::getName() == _instance.ParameterInterface::getName()); 214 } catch(ParameterException &e) { 215 e << ParameterName(ParameterInterface::getName()); 216 216 throw; 217 217 } … … 224 224 */ 225 225 template<typename T> 226 inline Parameter AsString* Parameter<T>::clone() const227 { 228 Parameter<T> *instance = new Parameter<T>(ParameterInterface <T>::getName(), Value<T>::getValidator());226 inline ParameterInterface* Parameter<T>::clone() const 227 { 228 Parameter<T> *instance = new Parameter<T>(ParameterInterface::getName(), Value<T>::getValidator()); 229 229 if (Value<T>::ValueSet) 230 230 instance->set(Value<T>::get()); -
src/Parameters/Value.hpp
rb11f5e r6440c6 18 18 #include <vector> 19 19 20 #include "ValueAsString.hpp" 20 21 #include "ValueInterface.hpp" 21 22 #include "Validators/Validator.hpp" … … 57 58 */ 58 59 template <class T> 59 class Value : virtual public ValueInterface<T> 60 class Value : 61 virtual public ValueAsString, 62 public ValueInterface<T> 60 63 { 61 64 //!> unit test needs to have access to internal values -
src/Parameters/ValueInterface.hpp
rb11f5e r6440c6 23 23 */ 24 24 template <class T> 25 class ValueInterface : virtual public ValueAsString25 class ValueInterface 26 26 { 27 27 public: -
src/Parameters/unittests/Makefile.am
rb11f5e r6440c6 56 56 ../Parameters/Parameter.hpp \ 57 57 ../Parameters/Parameter_impl.hpp \ 58 ../Parameters/ParameterAsString.hpp \59 58 ../Parameters/ParameterInterface.hpp 60 59 ContinuousParameterTest_LDADD = \ … … 80 79 ../Parameters/Parameter.hpp \ 81 80 ../Parameters/Parameter_impl.hpp \ 82 ../Parameters/ParameterAsString.hpp \83 81 ../Parameters/ParameterInterface.hpp \ 84 82 ../Parameters/Validators/DiscreteValidator.hpp \
Note:
See TracChangeset
for help on using the changeset viewer.