Changeset 4885f85 for src/Actions


Ignore:
Timestamp:
Oct 30, 2010, 6:44:29 PM (14 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:
bc2990
Parents:
a8188d
git-author:
Frederik Heber <heber@…> (10/26/10 09:27:08)
git-committer:
Frederik Heber <heber@…> (10/30/10 18:44:29)
Message:

Introduced new getters to MapOfActions and ValueStorage.

  • new functions are getCurrentValue (string not as type!), getDescription, getShortForm, getType
  • these are need to short-wire Traits through MapOfActions.
Location:
src/Actions
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/MapOfActions.cpp

    ra8188d r4885f85  
    12251225 * \return Description of the action
    12261226 */
    1227 std::string MapOfActions::getDescription(string actionname)
     1227const std::string MapOfActions::getDescription(string actionname)
    12281228{
    12291229  ASSERT(DescriptionMap.find(actionname) != DescriptionMap.end(), "Unknown action name passed to MapOfActions::getDescription");
     
    12391239 * \return actionname,ShortForm or Description of the action
    12401240 */
    1241 std::string MapOfActions::getKeyAndShortForm(string actionname)
     1241const std::string MapOfActions::getKeyAndShortForm(string actionname)
    12421242{
    12431243  stringstream output;
     
    12541254 * \return ShortForm of the action
    12551255 */
    1256 std::string MapOfActions::getShortForm(string actionname)
    1257 {
    1258   ASSERT(ShortFormMap.find(actionname) != ShortFormMap.end(), "Unknown action name passed to MapOfActions::getShortForm");
    1259   return ShortFormMap[actionname];
     1256const std::string MapOfActions::getShortForm(string actionname)
     1257{
     1258  if (ShortFormMap.find(actionname) != ShortFormMap.end())
     1259    return ShortFormMap[actionname];
     1260  else
     1261    return std::string();
     1262}
     1263
     1264/** Getter for MapOfActions:CurrentValueMap.
     1265 * Note that we assert when action does not exist in CommandLineParser::CurrentValueMap.
     1266 * \param actionname name of the action to lookup
     1267 * \return CurrentValueMap of the action
     1268 */
     1269const std::string MapOfActions::getCurrentValue(string actionname)
     1270{
     1271  if (CurrentValueMap.find(actionname) != CurrentValueMap.end())
     1272    return CurrentValueMap[actionname];
     1273  else
     1274    return std::string();
    12601275}
    12611276
     
    12691284}
    12701285
     1286/** Getter for MapOfActions::TypeMap::name.
     1287 * \param actionname name of the action to look up
     1288 * \return name of type of the action
     1289 */
     1290const std::string MapOfActions::getValueType(string actionname)
     1291{
     1292  return TypeMap[actionname]->name();
     1293}
     1294
    12711295/** Getter for MapOfActions::TypeMap.
    12721296 * \param actionname name of the action to look up
    12731297 * \return type of the action
    12741298 */
    1275 std::string MapOfActions::getValueType(string actionname)
    1276 {
    1277   return TypeMap[actionname]->name();
     1299const std::type_info * MapOfActions::getType(string actionname)
     1300{
     1301  return TypeMap[actionname];
    12781302}
    12791303
  • src/Actions/MapOfActions.hpp

    ra8188d r4885f85  
    141141
    142142  // getter for the action descriptions and short forms
    143   std::string getDescription(std::string actionname);
    144   std::string getKeyAndShortForm(std::string actionname);
    145   std::string getShortForm(std::string actionname);
     143  const std::string getDescription(std::string actionname);
     144  const std::string getKeyAndShortForm(std::string actionname);
     145  const std::string getShortForm(std::string actionname);
    146146  std::map <std::string, std::string> getShortFormToActionMap();
     147  const std::string getCurrentValue(std::string actionname);
    147148
    148149  void AddOptionsToParser();
     
    151152  bool hasValue(std::string actionname);
    152153  bool isShortFormPresent(std::string shortform);
    153   std::string  getValueType(std::string actionname);
     154  const std::string  getValueType(std::string actionname);
     155  const std::type_info * getType(std::string actionname);
    154156
    155157  std::set<std::string> generic;
  • src/Actions/ValueStorage.cpp

    ra8188d r4885f85  
    2929ValueStorage::~ValueStorage() {};
    3030
    31 std::string ValueStorage::getDescription(std::string actionname) {
     31const std::string ValueStorage::getCurrentValue(std::string actionname) {
     32  return MapOfActions::getInstance().getCurrentValue(actionname);
     33}
     34
     35const std::string ValueStorage::getDescription(std::string actionname) {
    3236  return MapOfActions::getInstance().getDescription(actionname);
    3337}
    3438
     39const std::string ValueStorage::getShortForm(std::string actionname) {
     40  return MapOfActions::getInstance().getShortForm(actionname);
     41}
     42
     43const std::type_info * ValueStorage::getType(std::string actionname) {
     44  return MapOfActions::getInstance().getType(actionname);
     45}
     46
    3547CONSTRUCT_SINGLETON(ValueStorage)
  • src/Actions/ValueStorage.hpp

    ra8188d r4885f85  
    4848   * \return text describing the key's contents
    4949   */
    50   std::string getDescription(std::string actionname);
     50  const std::string getCurrentValue(std::string actionname);
     51  const std::string getDescription(std::string actionname);
     52  const std::string getShortForm(std::string actionname);
     53  const std::type_info * getType(std::string actionname);
    5154
    5255protected:
Note: See TracChangeset for help on using the changeset viewer.