Ignore:
Timestamp:
Jun 13, 2012, 5:39:12 PM (14 years ago)
Author:
Frederik Heber <heber@…>
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, Candidate_v1.7.0, Candidate_v1.7.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:
8453b3
Parents:
301723
git-author:
Frederik Heber <heber@…> (05/09/12 16:17:57)
git-committer:
Frederik Heber <heber@…> (06/13/12 17:39:12)
Message:

All Actions' .def files now have a paramvalids that is used to for validators of their Parameters.

  • the structure ActionParameters contains Parameter<> instances per required parameter of the Action.
  • these Parameter<> contain a validation functionality if given a Validator.
  • right now via boost::preprocessor magic (new defines valid_print and validcopy_print) we create the cstor of the derived ActionParameters class and create a DummyValidator of the correct type for each parameter.
  • TODO: We have to go through each .def file and replace DummyValidator by the correct Validator.
  • added src/Actions/test.sh which is the shell script to make these changes.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/Action_impl_pre.hpp

    r301723 r649aaa  
    5050#include "Parameters/Parameter.hpp"
    5151
     52
    5253// some derived names: if CATEGORY is not given, we don't prefix with it
    5354#ifdef CATEGORY
     
    127128  );
    128129
     130// print an initialiser list, i.e. "var( token, valid )(,)"
     131#define valid_print(z,n,TOKENLIST, VARLIST, VALIDLIST) \
     132  BOOST_PP_COMMA_IF(n) \
     133  BOOST_PP_SEQ_ELEM(n, VARLIST) \
     134  ( \
     135  BOOST_PP_SEQ_ELEM(n, TOKENLIST) \
     136  , \
     137  BOOST_PP_SEQ_ELEM(n, VALIDLIST) \
     138  )
     139
     140// print an initialiser list, i.e. "var( token, valid )(,)"
     141#define validcopy_print(z,n,TOKENLIST, VARLIST, VALID) \
     142  BOOST_PP_COMMA_IF(n) \
     143  BOOST_PP_SEQ_ELEM(n, VARLIST) \
     144  ( \
     145  VALID . \
     146  BOOST_PP_SEQ_ELEM(n, VARLIST) \
     147  )
     148
    129149// prints set/queryCurrentValue (command) for paramreferences and paramtokens
    130150#define value_print(z, n, container, prefix) \
     
    206226}
    207227
     228// =========== parameter constructor ===========
     229ACTION::PARAMS::PARAMS()
     230#if defined paramtokens && defined paramreferences && defined paramvalids
     231      :
     232#define BOOST_PP_LOCAL_MACRO(n) valid_print(~, n, paramtokens, paramreferences, paramvalids)
     233#define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
     234#include BOOST_PP_LOCAL_ITERATE()
     235#endif
     236    {}
     237
     238ACTION::PARAMS::PARAMS(const PARAMS &p)
     239#if defined paramtokens && defined paramreferences
     240      :
     241#define BOOST_PP_LOCAL_MACRO(n) validcopy_print(~, n, paramtokens, paramreferences, p)
     242#define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
     243#include BOOST_PP_LOCAL_ITERATE()
     244#endif
     245    {}
     246
    208247// =========== fill a dialog ===========
    209248Dialog* ACTION::fillDialog(Dialog *dialog) {
     
    263302
    264303// free up defines
     304#undef paramvalids
    265305#undef paramtypes
    266306#undef paramtokens
    267307#undef paramreferences
     308#undef paramdescriptions
     309#undef paramdefaults
    268310#undef MAXPARAMTYPES
    269311#undef statetypes
     
    277319#undef type_list
    278320#undef dialog_print
     321#undef valid_print
     322#undef validcopy_print
    279323#undef value_print
    280324#undef valuetype_print
Note: See TracChangeset for help on using the changeset viewer.