source: src/controller_AddOn.hpp@ a10cc0

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 a10cc0 was 014bc4, checked in by Frederik Heber <heber@…>, 13 years ago

Introduced interface controller_AddOn.hpp that encapsulates controller extending functions in struct controller_AddOn.

  • allocating function for derived structure controller_AddOn is contained in extra module to allow indepent linking, i.e. combine controller.cpp, controller_AddOn_SystemCommandJob.cpp and controller_SystemCommandJon.cpp or with controller_AddOn_MPQCCommandJob.cpp and controller_MPQCCommandJon.cpp.
  • Property mode set to 100644
File size: 3.4 KB
Line 
1/*
2 * controller_AddOn.hpp
3 *
4 * Created on: 01.06.2012
5 * Author: heber
6 */
7
8#ifndef CONTROLLER_ADDON_HPP_
9#define CONTROLLER_ADDON_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16
17#include <boost/function.hpp>
18#include <boost/program_options.hpp>
19
20class ControllerCommand;
21class ControllerCommandRegistry;
22class ControllerInfo;
23class ControllerOptions;
24class FragmentController;
25
26struct controller_AddOn;
27
28/** This is the allocator function for the specific controller addon structure.
29 *
30 * The implementation should reside in its own module such that it can be
31 * linked in unison with the \file controller.cpp and the derived implementation
32 * of controller_AddOn to the executable controller.
33 */
34extern "C++" controller_AddOn *getAddOn();
35
36/** This is the structure that contains functions to extend the functionality
37 * of the basic controller with respect to certain jobs and commands.
38 *
39 * Here, we have four types of functions:
40 * -# Allocator: Required to allocate to specific function which contains
41 * extended member variables and parsing functions.
42 * -# Commands: Add more commands to the registry of the controller.
43 * -# Options: Add more command-line options to require additional information
44 * from the user.
45 * -# Parsers: Add parsing function to place parameter from command-line
46 * into internal structure allocated via Allocator.
47 *
48 * The allocated structure is the one which contains all information for the
49 * execution of these commands. Note that some defaults are already parsed
50 * and stored therein by the controller by default.
51 *
52 * \note All these functions are called within the basic controller, hence
53 * all parameters are instances of this basic controller.
54 */
55struct controller_AddOn {
56 /** Function to allocate a derived variant of ControllerOptions which might
57 * be extended by own member variables and parsing functions.
58 *
59 * \return Pointer to allocated instance of ControllerOptions or derived.
60 */
61 virtual ControllerOptions *allocateControllerInfo()=0;
62
63 /** Function to register new commands communicating with a server.
64 *
65 * \param registrator registrator function for the generated ControllerCommand
66 * \param controller access to controller to bind to its functions
67 * \param ControllerInfo All other options of the controller
68 */
69 virtual void addSpecificCommands(
70 boost::function<void (ControllerCommand *)> &registrator,
71 FragmentController &controller,
72 ControllerOptions &ControllerInfo)=0;
73
74 /** Function to add other command line options if more use input is required.
75 *
76 * \param option option_description entity that can be used to add another
77 * boost::program_options as follows:
78 * \code
79 * option("command,c", boost::program_options::, "description");
80 * \endcode
81 */
82 virtual void addSpecificOptions(
83 boost::program_options::options_description_easy_init option)=0;
84
85 /** Function to add a parsing function for placing info from the command line
86 * option into \a ControllerInfo.
87 *
88 * \param ControllerInfo May be reinterpret_cast to true type as has been
89 * allocated in controller_AddOn::allocateControllerInfo.
90 * \param vm map of command line variables
91 * \return 0 - ok, else - some failure code (which leads to program exit)
92 */
93 virtual int addOtherParsings(
94 ControllerOptions &ControllerInfo,
95 boost::program_options::variables_map &vm)=0;
96};
97
98#endif /* CONTROLLER_ADDON_HPP_ */
Note: See TracBrowser for help on using the repository browser.