Changeset fd4905 for src/Parser/FormatParserStorage.cpp
- Timestamp:
- Aug 28, 2010, 1:45:13 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, Candidate_v1.7.0, 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:
- 6c438f
- Parents:
- 8fd934 (diff), 653542 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
src/Parser/FormatParserStorage.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/FormatParserStorage.cpp
r8fd934 rfd4905 28 28 #include "Parser/MpqcParser.hpp" 29 29 #include "Parser/PcpParser.hpp" 30 #include "Parser/PdbParser.hpp" 30 31 #include "Parser/TremoloParser.hpp" 31 32 #include "Parser/XyzParser.hpp" … … 56 57 ParserSuffix.resize(ParserTypes_end, ""); 57 58 59 ParserNames[mpqc] = "mpqc"; 60 ParserNames[pcp] = "pcp"; 61 ParserNames[pdb] = "pdb"; 62 ParserNames[tremolo] = "tremolo"; 63 ParserNames[xyz] = "xyz"; 64 65 for (std::map<ParserTypes, std::string>::const_iterator it = ParserNames.begin(); it != ParserNames.end(); ++it) 66 ParserLookupNames.insert(pair<std::string, ParserTypes>(it->second,it->first) ); 67 58 68 ParserSuffix[mpqc] = "in"; 59 69 ParserSuffix[pcp] = "conf"; 70 ParserSuffix[pdb] = "pdb"; 60 71 ParserSuffix[tremolo] = "data"; 61 72 ParserSuffix[xyz] = "xyz"; 73 74 ParserAddFunction[mpqc] = &FormatParserStorage::addMpqc; 75 ParserAddFunction[pcp] = &FormatParserStorage::addPcp; 76 ParserAddFunction[pdb] = &FormatParserStorage::addPdb; 77 ParserAddFunction[tremolo] = &FormatParserStorage::addTremolo; 78 ParserAddFunction[xyz] = &FormatParserStorage::addXyz; 62 79 } 63 80 … … 112 129 } 113 130 131 114 132 /** Adds an PcpParser to the storage. 115 133 */ … … 124 142 125 143 144 /** Adds an PdbParser to the storage. 145 */ 146 void FormatParserStorage::addPdb() 147 { 148 if (!ParserPresent[pdb]) { 149 ParserList[pdb] = new PdbParser(); 150 ParserPresent[pdb] = true; 151 } else 152 DoeLog(1) && (eLog() << Verbose(1) << "Parser pdb is already present." << endl); 153 } 154 155 126 156 /** Adds an TremoloParser to the storage. 127 157 */ … … 146 176 DoeLog(1) && (eLog() << Verbose(1) << "Parser xyz is already present." << endl); 147 177 } 178 179 ParserTypes FormatParserStorage::getType(std::string type) 180 { 181 if (ParserLookupNames.find(type) == ParserLookupNames.end()) { 182 DoeLog(1) && (eLog() << Verbose(1) << "Unknown type " << type << "." << endl); 183 return ParserTypes_end; 184 } else 185 return ParserLookupNames[type]; 186 } 187 188 bool FormatParserStorage::add(ParserTypes ptype) 189 { 190 if (ptype != ParserTypes_end) { 191 if (ParserAddFunction.find(ptype) != ParserAddFunction.end()) { 192 DoLog(0) && (Log() << Verbose(0) << "Adding " << ParserNames[ptype] << " type to output." << endl); 193 (getInstance().*(ParserAddFunction[ptype]))(); // we still need an object to work on ... 194 return true; 195 } else { 196 DoeLog(1) && (eLog() << Verbose(1) << "No parser to add for this known type " << ParserNames[ptype] << ", not implemented?" << endl); 197 return false; 198 } 199 } else { 200 return false; 201 } 202 } 203 204 bool FormatParserStorage::add(std::string type) 205 { 206 return add(getType(type)); 207 } 208 148 209 149 210 /** Parses an istream depending on its suffix … … 158 219 } else if (suffix == ParserSuffix[pcp]) { 159 220 getPcp().load(&input); 221 } else if (suffix == ParserSuffix[pdb]) { 222 getPdb().load(&input); 160 223 } else if (suffix == ParserSuffix[tremolo]) { 161 224 getTremolo().load(&input); … … 163 226 getXyz().load(&input); 164 227 } else { 165 DoeLog(1) && (eLog() << Verbose(1) << "Unknown suffix to for FormatParserStorage::get()." << endl);228 DoeLog(1) && (eLog() << Verbose(1) << "Unknown suffix " << suffix << " to for FormatParserStorage::get()." << endl); 166 229 return false; 167 230 } … … 189 252 } 190 253 254 /** Returns reference to the output PdbParser, adds if not present. 255 * \return reference to the output PdbParser 256 */ 257 PdbParser &FormatParserStorage::getPdb() 258 { 259 if (!ParserPresent[pdb]) 260 addPdb(); 261 return dynamic_cast<PdbParser &>(*ParserList[pdb]); 262 } 263 191 264 /** Returns reference to the output TremoloParser, adds if not present. 192 265 * \return reference to the output TremoloParser
Note:
See TracChangeset
for help on using the changeset viewer.
