source: src/Parameters/Parameter.hpp@ 270bdf

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 270bdf was b56114, checked in by Frederik Heber <heber@…>, 10 years ago

FIX: Action..::outputAsPython now accesses parameters via getUnvalidated().

  • added Value::getUnvalidated() and Parameter::getUnvalidated() for access at store-session.
  • this fixes a bug when OutputAsAction had been used whose filename would no longer be valid as the file now exists. This would cause an assertion and the whole OutputAsAction would fail.
  • Property mode set to 100644
File size: 2.4 KB
Line 
1/*
2 * Parameter.hpp
3 *
4 * Created on: Apr 16, 2012
5 * Author: ankele
6 */
7
8#ifndef PARAMETER_HPP_
9#define PARAMETER_HPP_
10
11
12
13// include config.h
14#ifdef HAVE_CONFIG_H
15#include <config.h>
16#endif
17
18#include <string>
19
20#include "Value.hpp"
21#include "ValueInterface.hpp"
22#include "ParameterInterface.hpp"
23
24class ParameterException;
25class ParameterValueException;
26
27/** This class encapsulates a clonable, continuous value.
28 *
29 */
30template <typename T>
31class Parameter :
32 public ParameterInterface,
33 public ValueInterface<T>
34{
35public:
36 Parameter(const Parameter<T> &instance);
37 Parameter(const std::string &_name);
38 Parameter(const std::string &_name, const T &_value);
39 Parameter(const std::string &_name, const Validator<T> &_Validator);
40 Parameter(const std::string &_name, const Validator<T> &_Validator, const T &_value);
41 Parameter(const std::string &_name, const std::vector<T> &_ValidValues);
42 Parameter(const std::string &_name, const std::vector<T> &_ValidValues, const T &_value);
43 Parameter(const std::string &_name, const range<T> &_ValidRange);
44 Parameter(const std::string &_name, const range<T> &_ValidRange, const T &_value);
45 virtual ~Parameter();
46
47 // wrap the following functions from ValueAsString to add exception information
48 bool isValidAsString(const std::string &_value) const throw(ParameterValidatorException);
49 const std::string getAsString() const throw(ParameterValueException);
50 void setAsString(const std::string &_value) throw(ParameterValueException);
51
52 // wrap the following functions from Value<T> to add exception information
53 bool isValid(const T &_value) const throw(ParameterValidatorException);
54 const T & get() const throw(ParameterValueException);
55 const T & getUnvalidated() const throw(ParameterValueException);
56 void set(const T & _value) throw(ParameterValueException);
57 bool isSet() const
58 { return value.isSet(); }
59
60 const Validator<T> & getValidator() const
61 { return value.getValidator(); }
62 Validator<T> & getValidator()
63 { return value.getValidator(); }
64
65 // comparator
66 bool operator==(const Parameter<T> &_instance) const throw(ParameterException);
67 bool operator!=(const Parameter<T> &_instance) const throw(ParameterException)
68 { return !((*this)==(_instance)); }
69
70 ParameterInterface* clone() const;
71
72//private: // TODO...
73 Parameter();
74
75private:
76 //!> contained value of this parameter
77 Value<T> value;
78};
79
80#include "Parameter_impl.hpp"
81
82
83#endif /* PARAMETER_HPP_ */
Note: See TracBrowser for help on using the repository browser.