source: src/Actions/ActionTraits.cpp@ 81c980b

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 81c980b was ad011c, checked in by Frederik Heber <heber@…>, 14 years ago

CodePatterns places all includes now in subfolder CodePatterns/.

  • change all includes accordingly.
  • this was necessary as Helpers and Patterns are not very distinctive names for include folders. Already now, we had a conflict between Helpers from CodePatterns and Helpers from this project.
  • changed compilation test in ax_codepatterns.m4 when changing CodePatterns includes.
  • Property mode set to 100644
File size: 4.7 KB
RevLine 
[df32ee]1/*
2 * Project: MoleCuilder
3 * Description: creates and alters molecular systems
4 * Copyright (C) 2010 University of Bonn. All rights reserved.
5 * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
6 */
7
8/*
9 * ActionTraits.cpp
10 *
11 * Created on: Oct 26, 2010
12 * Author: heber
13 */
14
[d2b28f]15// include config.h
16#ifdef HAVE_CONFIG_H
17#include <config.h>
18#endif
19
[ad011c]20#include "CodePatterns/MemDebug.hpp"
[d2b28f]21
[df32ee]22#include "Actions/ActionTraits.hpp"
23
[ad011c]24#include "CodePatterns/Assert.hpp"
[e4afb4]25
26#include <iostream>
27#include <sstream>
[df32ee]28#include <string>
[e4afb4]29#include <typeinfo>
[df32ee]30
[e4afb4]31/** Copy constructor for base class ActionTraits.
32 * \param &_Traits source ActionTraits class to copy
[df32ee]33 */
[e4afb4]34ActionTraits::ActionTraits(const std::string &_token) :
35 OptionTrait(_token,
36 &typeid(void),
37 "this is an invisible action",
38 "",
39 ""
40 )
41{
[c38826]42 //std::cout << "ActionTraits::ActionTraits(string &) with " << getName() << ", type " << getTypeName() << " and description " << getDescription() << std::endl;
[e4afb4]43}
[df32ee]44
[e4afb4]45/** Copy constructor for base class ActionTraits.
46 * we have to make our own copy in order to avoid references and deep-copy everything.
47 * \param &_Traits source ActionTraits class to copy
[df32ee]48 */
[e4afb4]49ActionTraits::ActionTraits(const ActionTraits &_Traits) :
50 OptionTrait(_Traits.getName(),
51 _Traits.getType(),
52 _Traits.getDescription(),
53 _Traits.hasDefaultValue() ? _Traits.getDefaultValue() : "",
54 _Traits.hasShortForm() ? _Traits.getShortForm() : ""
[b59da6]55 ),
56 MenuTitle(_Traits.MenuTitle),
57 MenuPosition(_Traits.MenuPosition)
[e4afb4]58{
59 for (options_const_iterator iter = _Traits.Options.begin(); iter != _Traits.Options.end(); ++iter) {
60 Options.insert(
61 std::pair< std::string, OptionTrait *> (
62 iter->first,
63 new OptionTrait(iter->second->getName(),iter->second->getType(),iter->second->getDescription(), iter->second->getDefaultValue(), iter->second->getShortForm())
64 )
65 );
66 }
[c38826]67 //std::cout << "ActionTraits::ActionTraits(ActionTraits &) with " << getName() << ", type " << getTypeName() << " and description " << getDescription() << std::endl;
[e4afb4]68}
[df32ee]69
[e4afb4]70/** Copy constructor for base class ActionTraits.
71 * we have to make our own copy in order to avoid references and deep-copy everything.
72 * \param &_Traits source OptionTrait class to copy
[df32ee]73 */
[b59da6]74ActionTraits::ActionTraits(const OptionTrait &_Traits, const std::string _MenuTitle, const int _MenuPosition) :
75 OptionTrait(_Traits),
76 MenuTitle(_MenuTitle),
77 MenuPosition(_MenuPosition)
[df32ee]78{
[c38826]79 //std::cout << "ActionTraits::ActionTraits(OptionTrait &) with " << getName() << ", type " << getTypeName() << " and description " << getDescription() << std::endl;
[df32ee]80}
81
[e4afb4]82/** Constructor for base class ActionTraits.
83 * Deletes all present Options.
[df32ee]84 */
[e4afb4]85ActionTraits::~ActionTraits()
[df32ee]86{
[e4afb4]87 for (options_iterator iter = Options.begin(); !Options.empty(); iter = Options.begin()) {
88 delete (iter->second);
89 Options.erase(iter);
90 }
[df32ee]91}
92
[e4afb4]93
[53be34]94/** Returns menu title for this ActionTrait.
95 * \return ActionTraits::MenuTitle as std::string
96 */
[e4afb4]97const std::string& ActionTraits::getMenuName() const
[53be34]98{
99 return MenuTitle;
100}
101
102/** Returns menu title for this ActionTrait.
103 * \return ActionTraits::MenuPosition as std::string
104 */
[b59da6]105int ActionTraits::getMenuPosition() const
[53be34]106{
107 return MenuPosition;
108}
109
110/** Returns Description for the given option of this ActionTrait.
[e4afb4]111 * \param &token token of option
112 * \return reference to OptionTrait
[53be34]113 */
[e4afb4]114OptionTrait const & ActionTraits::getOption(const std::string &token) const
[53be34]115{
[e4afb4]116 ASSERT(Options.find(token) != Options.end(),
117 "ActionTraits::getOption() - Option not found!");
118 return *(Options.find(token)->second);
[53be34]119}
120
[e4afb4]121/** States whether given option (token) is present or not.
122 * \param &token name of option
123 * \return true - option present, false - not
[df32ee]124 */
[e4afb4]125bool ActionTraits::hasOption(const std::string &token) const
[df32ee]126{
[e4afb4]127 return (Options.find(token) != Options.end());
[df32ee]128}
129
[e4afb4]130/** States whether this Action has options at all.
131 * \return true - options present, false - no options
[df32ee]132 */
[e4afb4]133bool ActionTraits::hasOptions() const
[df32ee]134{
[e4afb4]135 return (Options.begin() != Options.end());
[df32ee]136}
137
[53be34]138/** Forward iterator from beginning of list of options.
139 * \return iterator
140 */
141ActionTraits::options_iterator ActionTraits::getBeginIter()
142{
[e4afb4]143 return Options.begin();
[53be34]144}
145
146/** Forward iterator at end of list of options.
147 * \return iterator
148 */
149ActionTraits::options_iterator ActionTraits::getEndIter()
150{
[e4afb4]151 return Options.end();
[53be34]152}
153
154/** Constant forward iterator from beginning of list of options.
155 * \return constant iterator
156 */
157ActionTraits::options_const_iterator ActionTraits::getBeginIter() const
158{
[e4afb4]159 return Options.begin();
[53be34]160}
161
162/** Constant forward iterator at end of list of options.
163 * \return constant iterator
164 */
165ActionTraits::options_const_iterator ActionTraits::getEndIter() const
166{
[e4afb4]167 return Options.end();
[53be34]168}
169
170
Note: See TracBrowser for help on using the repository browser.