Ignore:
Timestamp:
Oct 14, 2011, 3:09:46 PM (13 years ago)
Author:
Frederik Heber <heber@…>
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:
6d0f058
Parents:
db67ea
git-author:
Frederik Heber <heber@…> (09/27/11 09:34:19)
git-committer:
Frederik Heber <heber@…> (10/14/11 15:09:46)
Message:

FormatParserStorage::add...() and ::get...() now use internally the templated functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/FormatParserStorage.cpp

    rdb67ea re114e3  
    3333
    3434#include "CodePatterns/Singleton_impl.hpp"
     35
     36template <> enum ParserTypes getPType<MpqcParser>() { return (enum ParserTypes)mpqc;  }
     37template <> enum ParserTypes getPType<PcpParser>() { return (enum ParserTypes)pcp;  }
     38template <> enum ParserTypes getPType<PdbParser>() { return (enum ParserTypes)pdb;  }
     39template <> enum ParserTypes getPType<TremoloParser>() { return (enum ParserTypes)tremolo;  }
     40template <> enum ParserTypes getPType<XyzParser>() { return (enum ParserTypes)xyz;  }
    3541
    3642/** Increment operator for the enumeration ParserTypes to allow loops.
     
    113119}
    114120
    115 
    116 /** Adds an MpqcParser to the storage.
    117  */
    118 void FormatParserStorage::addMpqc()
    119 {
    120   if (!ParserPresent[mpqc]) {
    121     ParserList[mpqc] = dynamic_cast<FormatParser *>(new MpqcParser);
    122     ParserPresent[mpqc] = true;
    123   }
    124   else
    125     DoeLog(2) && (eLog() << Verbose(2) << "Parser mpqc is already present." << endl
    126         << "Note that you don't need to add '-o mpqc' if the input file is of type mpqc." << endl);
    127 }
    128 
    129 
    130 /** Adds an PcpParser to the storage.
    131  */
    132 void FormatParserStorage::addPcp()
    133 {
    134   if (!ParserPresent[pcp]) {
    135     ParserList[pcp] = new PcpParser();
    136     ParserPresent[pcp] = true;
    137   } else
    138     DoeLog(2) && (eLog() << Verbose(2) << "Parser pcp is already present." << endl
    139         << "Note that you don't need to add '-o pcp' if the input file is of type pcp." << endl);
    140 }
    141 
    142 
    143 /** Adds an PdbParser to the storage.
    144  */
    145 void FormatParserStorage::addPdb()
    146 {
    147   if (!ParserPresent[pdb]) {
    148     ParserList[pdb] = new PdbParser();
    149     ParserPresent[pdb] = true;
    150   } else
    151     DoeLog(2) && (eLog() << Verbose(2) << "Parser pdb is already present." << endl
    152         << "Note that you don't need to add '-o pdb' if the input file is of type pdb." << endl);
    153 }
    154 
    155 
    156 /** Adds an TremoloParser to the storage.
    157  */
    158 void FormatParserStorage::addTremolo()
    159 {
    160   if (!ParserPresent[tremolo]) {
    161     ParserList[tremolo] = new TremoloParser();
    162     ParserPresent[tremolo] = true;
    163   } else
    164     DoeLog(2) && (eLog() << Verbose(2) << "Parser tremolo is already present." << endl
    165         << "Note that you don't need to add '-o tremolo' if the input file is of type tremolo." << endl);
    166 }
    167 
    168 
    169 /** Adds an XyzParser to the storage.
    170  */
    171 void FormatParserStorage::addXyz()
    172 {
    173   if (!ParserPresent[xyz]) {
    174     ParserList[xyz] = new XyzParser();
    175     ParserPresent[xyz] = true;
    176   } else
    177     DoeLog(2) && (eLog() << Verbose(2) << "Parser xyz is already present." << endl
    178         << "Note that you don't need to add '-o xyz' if the input file is of type xyz." << endl);
    179 }
    180121
    181122ParserTypes FormatParserStorage::getTypeFromName(std::string type)
     
    319260}
    320261
    321 /** Returns reference to the output MpqcParser, adds if not present.
    322  * \return reference to the output MpqcParser
    323  */
    324 MpqcParser &FormatParserStorage::getMpqc()
    325 {
    326   if (!ParserPresent[mpqc])
    327     addMpqc();
    328   return dynamic_cast<MpqcParser &>(*ParserList[mpqc]);
    329 }
    330 
    331 /** Returns reference to the output PcpParser, adds if not present.
    332  * \return reference to the output PcpParser
    333  */
    334 PcpParser &FormatParserStorage::getPcp()
    335 {
    336   if (!ParserPresent[pcp])
    337     addPcp();
    338   return dynamic_cast<PcpParser &>(*ParserList[pcp]);
    339 }
    340 
    341 /** Returns reference to the output PdbParser, adds if not present.
    342  * \return reference to the output PdbParser
    343  */
    344 PdbParser &FormatParserStorage::getPdb()
    345 {
    346   if (!ParserPresent[pdb])
    347     addPdb();
    348   return dynamic_cast<PdbParser &>(*ParserList[pdb]);
    349 }
    350 
    351 /** Returns reference to the output TremoloParser, adds if not present.
    352  * \return reference to the output TremoloParser
    353  */
    354 TremoloParser &FormatParserStorage::getTremolo()
    355 {
    356   if (!ParserPresent[tremolo])
    357     addTremolo();
    358   return dynamic_cast<TremoloParser &>(*ParserList[tremolo]);
    359 }
    360 
    361 /** Returns reference to the output XyzParser, adds if not present.
    362  * \return reference to the output XyzParser
    363  */
    364 XyzParser &FormatParserStorage::getXyz()
    365 {
    366   if (!ParserPresent[xyz])
    367     addXyz();
    368   return dynamic_cast<XyzParser &>(*ParserList[xyz]);
    369 }
    370 
    371262/** Returns reference to the desired output parser as FormatParser, adds if not present.
    372263 * \param _type type of desired parser
Note: See TracChangeset for help on using the changeset viewer.