- Timestamp:
- Apr 11, 2012, 4:56:55 PM (13 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:
- e44956
- Parents:
- be21fa
- git-author:
- Frederik Heber <heber@…> (03/16/12 12:29:01)
- git-committer:
- Frederik Heber <heber@…> (04/11/12 16:56:55)
- Location:
- src
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/Action.hpp
rbe21fa rb2c302 36 36 namespace MoleCuilder { 37 37 38 /** 39 * Base class for all actions. 38 /** Actions are Command patterns to allow for undoing and redoing. 39 * 40 * Each specific Action derives from this class to implement a certain functionality. 40 41 * 41 42 * Actions describe something that has to be done. 42 * Actions can be passed around, stored, performed and undone (Command-Pattern). 43 * Actions can be passed around, stored, performed and undone (Command-Pattern: 44 * http://en.wikipedia.org/wiki/Command_pattern). 45 * 46 * Unique to each Action is its ActionTrait, i.e. the options it requires 47 * to perform a certain function. E.g. in order to execute a "add atom" Action 48 * we need to know a position and an element. These options have certain 49 * properties, see \ref OptionTrait and \ref ActionTrait wherein these are stored. 50 * Essentially, each option is stored as an \ref OptionTrait instance and 51 * contains the token, default value, a description, the type, ... 52 * 53 * ActionTrait itself is also an OptionTrait because the command token may actually 54 * coincide with an option-token. E.g. this allows "...--add-atom 3" to mean 55 * both execute the action under token "add-atom" and that the option "add-atom" 56 * (the new atom's \ref element number) should contain 3. 57 * 58 * \ref ActionTrait contains a map of all associated options. With this in the cstor 59 * we register not only the Action with the \ref ActionRegistry but also each of 60 * its \link options OptionTrait \endlink with the \ref OptionRegistry. 61 * 62 * The token of the option is unique, but two Action's may share the same token if: 63 * -# they have the same default value 64 * -# they have the same type 65 * 66 * This requirement is easy because if you need to store some option of another 67 * type, simply think of a new suitable name for it. 68 * 69 * The actual value, i.e. "3" in the "add-atom" example, is taken from the 70 * ValueStorage, see \ref Dialog for how this is possible. 71 * 72 * \note There is a unit test that checks on the consistency of all registered 73 * options, also in "--enable-debug"-mode assertions will check that an option 74 * has not been registered before under another type. 75 * 43 76 */ 44 77 class Action -
src/Actions/ActionRegistry.hpp
rbe21fa rb2c302 30 30 * It is a singleton and can be called from anywhere. 31 31 * 32 * ActionRegistry::fillRegistry() is the essential function, called in the cstor, 33 * where all the prototypical Action's are instantiated. To this end, we sadly 34 * require a global list of all present actions (\note there is a regression test 35 * check on its completeness). We include \ref GlobalListOfActionsh.hpp where a 36 * boost::preprocessor sequence is contained that is then used to install each 37 * of the Action's in the registry. 38 * 32 39 */ 33 40 class ActionRegistry : public Singleton<ActionRegistry>, public Registry<Action> -
src/Actions/ValueStorage.hpp
rbe21fa rb2c302 84 84 #include "CodePatterns/Singleton.hpp" 85 85 86 /** ValueStorage serves as a mediator to MapOfActions. 86 /** ValueStorage is a container for any type of value. 87 * 87 88 * This is needed to relax inter-dependencies between the Queries and the Actions. 88 * I.e. this is the interface implemented in MapOfActions which both can safely rely on 89 * to store&retrieve/exchange values. 90 * 91 * \section ValueStorage ValueStorage howto 89 * 90 * The ValueStorage is necessary because we do not a-priori know about the 91 * type of a value as given by the user. The type is handled via RTTI (run-time 92 * type information), and the value is cast to string stored under a specific 93 * token in a map inside this class. 94 * 95 * Not any value can be stored in this container. We rely on OptionRegistry to allow 96 * only tokens whose type has been defined beforehand. I.e. for each option we 97 * require a specific and unique type. 98 * 99 * Then, there are three types of functions: 100 * -# queryCurrentValue: request a value under a specific token 101 * -# setCurrentValue: set/enter a value under a specific token 102 * -# isCurrentValuePresent: ask whether a value under a specific token is contained 103 * 104 * For the first two we have templated version and a number of specialized ones to 105 * deal with some types specific to this code: \ref atom, \ref Box, \ref element, 106 * \ref molecule, ... 107 * 108 * \section ValueStorage-extend ValueStorage extension howto 92 109 * 93 110 * If you ever need to add a particular class to the ValueStorage, do as follows: … … 98 115 * class' members to a stringstream or use an already implemented operator<< 99 116 * or operator<<, respectively. 117 * 118 * \section ValueStorage-further-info Further information 119 * 120 * If you want to know in detail how this all works with the options, where they 121 * come from and how values end up in the ValueStorage, then look at \ref actions 122 * and \ref userinterfaces. 100 123 * 101 124 */ -
src/UIElements/Dialog.hpp
rbe21fa rb2c302 199 199 /** Base class for all queries. 200 200 * 201 * A query is request to the user for a value of a specific type. 202 * E.g. All \ref Action's need parameters to perform a specific function. 203 * These are obtained from the user at run-time via a Query regardless 204 * of the interface that the user is using. 201 205 * 202 * <h1>How to add another query?</h1> 206 * A Query always contains a protected member variable of the specific type. 207 * For each type there is a derived class, e.g. for a boolean there is 208 * \ref BooleanQuery deriving from \ref Query. Each specific UI derives 209 * again from a specific Query, e.g. for the \link userinterfaces-textmenu 210 * textmenu \endlink we have \ref BooleanTextQuery that derives from 211 * \ref BooleanQuery. This derived class has to implement the Query::handle 212 * function that actually sets the protected member variable to something 213 * the user has entered. Also it implements Query::setResult that actually 214 * places the obtained value in the \ref ValueStorage. 215 * 216 * \section query-howto How to add another query? 203 217 * 204 218 * Let's say we want to query for a type called \a Value. -
src/documentation/constructs/actions.dox
rbe21fa rb2c302 15 15 /** \page actions Actions 16 16 * 17 * Actions are Command patterns (http://en.wikipedia.org/wiki/Command_pattern) 17 * \link MoleCuilder::Action Actions \endlink are Command patterns 18 * (http://en.wikipedia.org/wiki/Command_pattern) 18 19 * to allow for undoing and redoing. Each specific Action derives from this 19 20 * class to implement a certain functionality. There is a lot of preprocessor … … 27 28 * such that an instance can be retrieved by knowing this token. 28 29 * 29 * Each Action obtains its parameterfrom a central ValueStorage such that30 * they are independent of where the parameteroriginated from: a command line30 * Each Action obtains its options from a central ValueStorage such that 31 * they are independent of where the option originated from: a command line 31 32 * parameter, a value entered in a graphical dialog or given via the keyboard 32 33 * in a terminal. That's why each begins with a function call to … … 62 63 * Have a look at \ref UndoRedoHelpers.hpp for some helper functions on this. 63 64 * 65 * \section actions-further Further information 66 * 67 * If you want know: 68 * -# how the code knows about the valid tokens for actions and options and how 69 * they are constructed, see \ref MoleCuilder::Action . 70 * 64 71 * 65 72 * \date 2012-04-05 -
src/documentation/constructs/constructs.dox
rbe21fa rb2c302 36 36 * \li \ref shapes 37 37 * \li \ref tesselation 38 * \li \ref values 38 39 * \li \ref world 39 40 * -
src/documentation/userinterfaces/userinterfaces.dox
rbe21fa rb2c302 36 36 * \section userinterfaces-query Making queries to the user 37 37 * 38 * The passing of values from the user to the code is done via a Query class 39 * which each of the interfaces implements for each of the required types. 38 * The passing of values from the user to the code is done via a \ref Dialog 39 * class that contains a number of \ref Query instances. 40 * Both Dialog and Query have to be implemented for each of the interfaces 41 * for each of the required types. 42 * 43 * See \ref Query to understand how a value from the user actually happens to 44 * end up in the \ref ValueStorage for \ref Action's to find it. 40 45 * 41 46 * \section userinterfaces-menu Menu structure … … 44 49 * 45 50 * 46 * \date 201 1-10-3151 * \date 2012-03-16 47 52 * 48 53 */
Note:
See TracChangeset
for help on using the changeset viewer.