Changeset dc0d21
- Timestamp:
- Jun 23, 2010, 10:35:25 AM (15 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:
- 35b698
- Parents:
- df481f
- Location:
- src/Parser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/Parser/FormatParserStorage.cpp ¶
rdf481f rdc0d21 23 23 24 24 #include "Patterns/Singleton_impl.hpp" 25 26 /** Increment operator for the enumeration ParserTypes to allow loops. 27 * \param &type value 28 * \return value incremented by one 29 */ 30 ParserTypes &operator++(ParserTypes &type) 31 { 32 return type = ParserTypes(type+1); 33 } 25 34 26 35 /** Constructor of class FormatParserStorage. … … 74 83 /** Adds an MpqcParser to the storage. 75 84 */ 76 void FormatParserStorage:: AddMpqc()85 void FormatParserStorage::addMpqc() 77 86 { 78 if (!ParserPresent[mpqc]) 87 if (!ParserPresent[mpqc]) { 79 88 ParserList[mpqc] = dynamic_cast<FormatParser *>(new MpqcParser); 89 ParserPresent[mpqc] = true; 90 } 80 91 else 81 92 DoeLog(1) && (eLog() << Verbose(1) << "Parser mpqc is already present." << endl); … … 84 95 /** Adds an PcpParser to the storage. 85 96 */ 86 void FormatParserStorage:: AddPcp()97 void FormatParserStorage::addPcp() 87 98 { 88 if (!ParserPresent[pcp]) 99 if (!ParserPresent[pcp]) { 89 100 ParserList[pcp] = new PcpParser(); 90 else 101 ParserPresent[pcp] = true; 102 } else 91 103 DoeLog(1) && (eLog() << Verbose(1) << "Parser pcp is already present." << endl); 92 104 } … … 95 107 /** Adds an TremoloParser to the storage. 96 108 */ 97 void FormatParserStorage:: AddTremolo()109 void FormatParserStorage::addTremolo() 98 110 { 99 if (!ParserPresent[tremolo]) 111 if (!ParserPresent[tremolo]) { 100 112 ParserList[tremolo] = new TremoloParser(); 101 else 113 ParserPresent[tremolo] = true; 114 } else 102 115 DoeLog(1) && (eLog() << Verbose(1) << "Parser tremolo is already present." << endl); 103 116 } … … 106 119 /** Adds an XyzParser to the storage. 107 120 */ 108 void FormatParserStorage:: AddXyz()121 void FormatParserStorage::addXyz() 109 122 { 110 if (!ParserPresent[xyz]) 123 if (!ParserPresent[xyz]) { 111 124 ParserList[xyz] = new XyzParser(); 112 else 125 ParserPresent[xyz] = true; 126 } else 113 127 DoeLog(1) && (eLog() << Verbose(1) << "Parser xyz is already present." << endl); 114 128 } 115 129 130 /** Returns reference to the output MpqcParser, adds if not present. 131 * \return reference to the output MpqcParser 132 */ 133 MpqcParser &FormatParserStorage::getMpqc() 134 { 135 if (!ParserPresent[mpqc]) 136 addMpqc(); 137 return dynamic_cast<MpqcParser &>(*ParserList[mpqc]); 138 } 139 140 /** Returns reference to the output PcpParser, adds if not present. 141 * \return reference to the output PcpParser 142 */ 143 PcpParser &FormatParserStorage::getPcp() 144 { 145 if (!ParserPresent[pcp]) 146 addPcp(); 147 return dynamic_cast<PcpParser &>(*ParserList[pcp]); 148 } 149 150 /** Returns reference to the output TremoloParser, adds if not present. 151 * \return reference to the output TremoloParser 152 */ 153 TremoloParser &FormatParserStorage::getTremolo() 154 { 155 if (!ParserPresent[tremolo]) 156 addTremolo(); 157 return dynamic_cast<TremoloParser &>(*ParserList[tremolo]); 158 } 159 160 /** Returns reference to the output XyzParser, adds if not present. 161 * \return reference to the output XyzParser 162 */ 163 XyzParser &FormatParserStorage::getXyz() 164 { 165 if (!ParserPresent[xyz]) 166 addXyz(); 167 return dynamic_cast<XyzParser &>(*ParserList[xyz]); 168 } 169 170 116 171 117 172 CONSTRUCT_SINGLETON(FormatParserStorage) -
TabularUnified src/Parser/FormatParserStorage.hpp ¶
rdf481f rdc0d21 20 20 21 21 class FormatParser; 22 class MpqcParser; 23 class PcpParser; 24 class TremoloParser; 25 class XyzParser; 22 26 23 27 // enum has to be outside of class for operator++ to be possible … … 25 29 typedef enum ParserTypes ParserTypes; 26 30 27 /** Increment operator for the enumeration ParserTypes to allow loops. 28 * \param &type value 29 * \return value incremented by one 30 */ 31 ParserTypes &operator++(ParserTypes &type) 32 { 33 return type = ParserTypes(type+1); 34 } 31 ParserTypes &operator++(ParserTypes &type); 35 32 36 33 class FormatParserStorage : public Singleton<FormatParserStorage> { … … 39 36 40 37 41 void AddMpqc(); 42 void AddPcp(); 43 void AddTremolo(); 44 void AddXyz(); 38 void addMpqc(); 39 void addPcp(); 40 void addTremolo(); 41 void addXyz(); 42 43 MpqcParser &getMpqc(); 44 PcpParser &getPcp(); 45 TremoloParser &getTremolo(); 46 XyzParser &getXyz(); 45 47 46 48 void SetOutputPrefixForAll(std::string &_prefix);
Note:
See TracChangeset
for help on using the changeset viewer.