source: src/Actions/ActionTraits.cpp@ f844ef

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

Added missing MemDebug include to various implementation files.

  • Property mode set to 100644
File size: 4.7 KB
Line 
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
15// include config.h
16#ifdef HAVE_CONFIG_H
17#include <config.h>
18#endif
19
20#include "Helpers/MemDebug.hpp"
21
22#include "Actions/ActionTraits.hpp"
23
24#include "Helpers/Assert.hpp"
25
26#include <iostream>
27#include <sstream>
28#include <string>
29#include <typeinfo>
30
31/** Copy constructor for base class ActionTraits.
32 * \param &_Traits source ActionTraits class to copy
33 */
34ActionTraits::ActionTraits(const std::string &_token) :
35 OptionTrait(_token,
36 &typeid(void),
37 "this is an invisible action",
38 "",
39 ""
40 )
41{
42 //std::cout << "ActionTraits::ActionTraits(string &) with " << getName() << ", type " << getTypeName() << " and description " << getDescription() << std::endl;
43}
44
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
48 */
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() : ""
55 ),
56 MenuTitle(_Traits.MenuTitle),
57 MenuPosition(_Traits.MenuPosition)
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 }
67 //std::cout << "ActionTraits::ActionTraits(ActionTraits &) with " << getName() << ", type " << getTypeName() << " and description " << getDescription() << std::endl;
68}
69
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
73 */
74ActionTraits::ActionTraits(const OptionTrait &_Traits, const std::string _MenuTitle, const int _MenuPosition) :
75 OptionTrait(_Traits),
76 MenuTitle(_MenuTitle),
77 MenuPosition(_MenuPosition)
78{
79 //std::cout << "ActionTraits::ActionTraits(OptionTrait &) with " << getName() << ", type " << getTypeName() << " and description " << getDescription() << std::endl;
80}
81
82/** Constructor for base class ActionTraits.
83 * Deletes all present Options.
84 */
85ActionTraits::~ActionTraits()
86{
87 for (options_iterator iter = Options.begin(); !Options.empty(); iter = Options.begin()) {
88 delete (iter->second);
89 Options.erase(iter);
90 }
91}
92
93
94/** Returns menu title for this ActionTrait.
95 * \return ActionTraits::MenuTitle as std::string
96 */
97const std::string& ActionTraits::getMenuName() const
98{
99 return MenuTitle;
100}
101
102/** Returns menu title for this ActionTrait.
103 * \return ActionTraits::MenuPosition as std::string
104 */
105int ActionTraits::getMenuPosition() const
106{
107 return MenuPosition;
108}
109
110/** Returns Description for the given option of this ActionTrait.
111 * \param &token token of option
112 * \return reference to OptionTrait
113 */
114OptionTrait const & ActionTraits::getOption(const std::string &token) const
115{
116 ASSERT(Options.find(token) != Options.end(),
117 "ActionTraits::getOption() - Option not found!");
118 return *(Options.find(token)->second);
119}
120
121/** States whether given option (token) is present or not.
122 * \param &token name of option
123 * \return true - option present, false - not
124 */
125bool ActionTraits::hasOption(const std::string &token) const
126{
127 return (Options.find(token) != Options.end());
128}
129
130/** States whether this Action has options at all.
131 * \return true - options present, false - no options
132 */
133bool ActionTraits::hasOptions() const
134{
135 return (Options.begin() != Options.end());
136}
137
138/** Forward iterator from beginning of list of options.
139 * \return iterator
140 */
141ActionTraits::options_iterator ActionTraits::getBeginIter()
142{
143 return Options.begin();
144}
145
146/** Forward iterator at end of list of options.
147 * \return iterator
148 */
149ActionTraits::options_iterator ActionTraits::getEndIter()
150{
151 return Options.end();
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{
159 return Options.begin();
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{
167 return Options.end();
168}
169
170
Note: See TracBrowser for help on using the repository browser.