Ignore:
Timestamp:
Jun 11, 2012, 9:53:19 AM (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:
95f965
Parents:
b9c69d
git-author:
Michael Ankele <ankele@…> (04/24/12 13:55:16)
git-committer:
Frederik Heber <heber@…> (06/11/12 09:53:19)
Message:

disastrously big and ugly commit

  • using new Parameter<T> classes:
    • Actions
    • Queries (all UIs)
  • TODO:
    • actions crash cause Value is unset
    • no query<BoxVector>
Location:
src/UIElements/TextUI/Query
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/TextUI/Query/AtomTextQuery.cpp

    rb9c69d rf10b0c  
    3030#include "World.hpp"
    3131
    32 TextDialog::AtomTextQuery::AtomTextQuery(std::string title, std::string _description) :
    33     Dialog::AtomQuery(title,_description)
     32TextDialog::AtomTextQuery::AtomTextQuery(Parameter<const atom *> &param, std::string title, std::string _description) :
     33    Dialog::AtomQuery(param, title,_description)
    3434{}
    3535
     
    5151    }
    5252
    53     tmp = World::getInstance().getAtom(AtomById(idxOfAtom));
    54     if(!tmp && idxOfAtom!=-1){
     53    const atom * temp_atom = World::getInstance().getAtom(AtomById(idxOfAtom));
     54    if(!temp_atom && idxOfAtom!=-1){
    5555      std::cout << "Invalid Atom Index" << idxOfAtom << std::endl;
    5656      badInput = true;
    5757    }
     58    tmp.set(temp_atom);
    5859
    5960  } while(badInput);
  • src/UIElements/TextUI/Query/AtomsTextQuery.cpp

    rb9c69d rf10b0c  
    3131
    3232
    33 TextDialog::AtomsTextQuery::AtomsTextQuery(std::string title, std::string _description) :
    34     Dialog::AtomsQuery(title,_description)
     33TextDialog::AtomsTextQuery::AtomsTextQuery(Parameter<std::vector<const atom *> > &param, std::string title, std::string _description) :
     34    Dialog::AtomsQuery(param, title,_description)
    3535{}
    3636
     
    4444  // dissect by " "
    4545  std::string::iterator olditer = line.begin();
     46  std::vector<const atom *> temp_atoms;
    4647  for(std::string::iterator iter = line.begin(); iter != line.end(); ++iter) {
    4748    if (*iter == ' ') {
     
    5354        break;
    5455      }
    55       tmp.push_back(temp);
     56      temp_atoms.push_back(temp);
    5657      olditer = iter;
    5758    }
     
    6364    if(!temp && idxOfAtom!=-1) {
    6465      std::cout << "Invalid Atom Index" << idxOfAtom << std::endl;
    65       tmp.push_back(temp);
     66      temp_atoms.push_back(temp);
    6667    }
    6768  }
     69  tmp.set(temp_atoms);
    6870
    6971  return (idxOfAtom!=-1);
  • src/UIElements/TextUI/Query/BooleanTextQuery.cpp

    rb9c69d rf10b0c  
    2828
    2929
    30 TextDialog::BooleanTextQuery::BooleanTextQuery(std::string title, std::string _description) :
    31     Dialog::BooleanQuery(title,_description)
     30TextDialog::BooleanTextQuery::BooleanTextQuery(Parameter<bool> &param, std::string title, std::string _description) :
     31    Dialog::BooleanQuery(param, title,_description)
    3232{}
    3333
     
    4242    std::cin >> input;
    4343    if ((input == 'y' ) || (input == 'Y')) {
    44       tmp = true;
     44      tmp.set(true);
    4545    } else if ((input == 'n' ) || (input == 'N')) {
    46       tmp = false;
     46      tmp.set(false);
    4747    } else {
    4848      badInput=true;
  • src/UIElements/TextUI/Query/BoxTextQuery.cpp

    rb9c69d rf10b0c  
    2929
    3030
    31 TextDialog::BoxTextQuery::BoxTextQuery(std::string title, std::string _description) :
    32     Dialog::BoxQuery(title,_description)
     31TextDialog::BoxTextQuery::BoxTextQuery(Parameter<Box> &param, std::string title, std::string _description) :
     32    Dialog::BoxQuery(param, title,_description)
    3333{}
    3434
     
    5656  M.set(2,1, temp[4]);
    5757  M.set(2,2, temp[5]);
    58   tmp.setM(M);
     58  Box temp_box;
     59  temp_box.setM(M);
     60  tmp.set(temp_box);
    5961  return true;
    6062}
  • src/UIElements/TextUI/Query/DoubleTextQuery.cpp

    rb9c69d rf10b0c  
    2828
    2929
    30 TextDialog::DoubleTextQuery::DoubleTextQuery(std::string title, std::string _description) :
    31     Dialog::DoubleQuery(title,_description)
     30TextDialog::DoubleTextQuery::DoubleTextQuery(Parameter<double> &param, std::string title, std::string _description) :
     31    Dialog::DoubleQuery(param, title,_description)
    3232{}
    3333
     
    3838  do{
    3939    badInput = false;
    40     std::cout << getDescription() << ": ";
    41     std::cin >> tmp;
     40    std::cout << getDescription() << ": ";\
     41    double temp_double;
     42    std::cin >> temp_double;
    4243    if(std::cin.fail()){
    4344      badInput = true;
     
    4647      std::cout << "Input was not a number!" << std::endl;
    4748    }
     49    tmp.set(temp_double);
    4850  }while(badInput);
    4951  std::cin.ignore(std::numeric_limits<streamsize>::max(),'\n');
  • src/UIElements/TextUI/Query/DoublesTextQuery.cpp

    rb9c69d rf10b0c  
    2828
    2929
    30 TextDialog::DoublesTextQuery::DoublesTextQuery(std::string title, std::string _description) :
    31     Dialog::DoublesQuery(title,_description)
     30TextDialog::DoublesTextQuery::DoublesTextQuery(Parameter<std::vector<double> > &param, std::string title, std::string _description) :
     31    Dialog::DoublesQuery(param, title,_description)
    3232{}
    3333
     
    4040  // dissect by " "
    4141  std::string::iterator olditer = line.begin();
     42  std::vector<double> temp_doubles;
    4243  for(std::string::iterator iter = line.begin(); iter != line.end(); ++iter) {
    4344    if (*iter == ' ') {
    4445      std::istringstream stream(std::string(iter, olditer));
    4546      stream >> temp;
    46       tmp.push_back(temp);
     47      temp_doubles.push_back(temp);
    4748      olditer = iter;
    4849    }
     
    5152    std::istringstream stream(std::string(olditer, line.end()));
    5253    stream >> temp;
    53     tmp.push_back(temp);
     54    temp_doubles.push_back(temp);
    5455  }
     56  tmp.set(temp_doubles);
    5557
    5658  return true;
  • src/UIElements/TextUI/Query/ElementTextQuery.cpp

    rb9c69d rf10b0c  
    3131
    3232
    33 TextDialog::ElementTextQuery::ElementTextQuery(std::string title, std::string _description) :
    34     Dialog::ElementQuery(title,_description)
     33TextDialog::ElementTextQuery::ElementTextQuery(Parameter<const element *> &param, std::string title, std::string _description) :
     34    Dialog::ElementQuery(param, title,_description)
    3535{}
    3636
  • src/UIElements/TextUI/Query/ElementsTextQuery.cpp

    rb9c69d rf10b0c  
    3535
    3636
    37 TextDialog::ElementsTextQuery::ElementsTextQuery(std::string title, std::string _description) :
    38     Dialog::ElementsQuery(title,_description)
     37TextDialog::ElementsTextQuery::ElementsTextQuery(Parameter<std::vector<const element *> > &param, std::string title, std::string _description) :
     38    Dialog::ElementsQuery(param, title,_description)
    3939{}
    4040
     
    5050  // dissect by " "
    5151  std::string::iterator olditer = line.begin();
     52  std::vector<const element *> temp_elements;
    5253  for(std::string::iterator iter = line.begin(); iter != line.end(); ++iter) {
    5354    if (*iter == ' ') {
     
    6465        break;
    6566      }
    66       tmp.push_back(temp);
     67      temp_elements.push_back(temp);
    6768      olditer = iter;
    6869    }
     
    7980    if(!temp && Z!=-1) {
    8081      std::cout << "Invalid Element" << shorthand << std::endl;
    81       tmp.push_back(temp);
     82      temp_elements.push_back(temp);
    8283    }
    8384  }
     85  tmp.set(temp_elements);
    8486
    8587  return (Z!=-1);
  • src/UIElements/TextUI/Query/FileTextQuery.cpp

    rb9c69d rf10b0c  
    3131
    3232
    33 TextDialog::FileTextQuery::FileTextQuery(std::string title, std::string _description) :
    34     Dialog::FileQuery(title,_description)
     33TextDialog::FileTextQuery::FileTextQuery(Parameter<boost::filesystem::path> &param, std::string title, std::string _description) :
     34    Dialog::FileQuery(param, title,_description)
    3535{}
    3636
     
    5353  } while(badInput);
    5454  std::cin.ignore(std::numeric_limits<streamsize>::max(),'\n');
    55   tmp = tempstring;
     55  tmp.set(tempstring);
    5656  return true;
    5757}
  • src/UIElements/TextUI/Query/IntTextQuery.cpp

    rb9c69d rf10b0c  
    2828
    2929
    30 TextDialog::IntTextQuery::IntTextQuery(std::string title, std::string _description) :
    31     Dialog::IntQuery(title,_description)
     30TextDialog::IntTextQuery::IntTextQuery(Parameter<int> &param, std::string title, std::string _description) :
     31    Dialog::IntQuery(param, title,_description)
    3232{}
    3333
     
    3939    badInput = false;
    4040    std::cout << getDescription() << ": ";
    41     std::cin >> tmp;
     41    int temp_int;
     42    std::cin >> temp_int;
     43    tmp.set(temp_int);
    4244    if(std::cin.fail()){
    4345      badInput=true;
  • src/UIElements/TextUI/Query/IntsTextQuery.cpp

    rb9c69d rf10b0c  
    2828
    2929
    30 TextDialog::IntsTextQuery::IntsTextQuery(std::string title, std::string _description) :
    31     Dialog::IntsQuery(title,_description)
     30TextDialog::IntsTextQuery::IntsTextQuery(Parameter<std::vector<int> > &param, std::string title, std::string _description) :
     31    Dialog::IntsQuery(param, title,_description)
    3232{}
    3333
     
    3939  getline(std::cin,line);
    4040  // dissect by " "
     41  std::vector<int> temp_int;
    4142  std::string::iterator olditer = line.begin();
    4243  for(std::string::iterator iter = line.begin(); iter != line.end(); ++iter) {
     
    4445      std::istringstream stream(std::string(iter, olditer));
    4546      stream >> temp;
    46       tmp.push_back(temp);
     47      temp_int.push_back(temp);
    4748      olditer = iter;
    4849    }
     
    5152    std::istringstream stream(std::string(olditer, line.end()));
    5253    stream >> temp;
    53     tmp.push_back(temp);
     54    temp_int.push_back(temp);
    5455  }
     56  tmp.set(temp_int);
    5557
    5658  return true;
  • src/UIElements/TextUI/Query/MoleculeTextQuery.cpp

    rb9c69d rf10b0c  
    3131
    3232
    33 TextDialog::MoleculeTextQuery::MoleculeTextQuery(std::string title, std::string _description) :
    34     Dialog::MoleculeQuery(title,_description)
     33TextDialog::MoleculeTextQuery::MoleculeTextQuery(Parameter<const molecule *> &param, std::string title, std::string _description) :
     34    Dialog::MoleculeQuery(param, title,_description)
    3535{}
    3636
     
    5252    }
    5353
    54     tmp = World::getInstance().getMolecule(MoleculeById(idxOfMol));
    55     if(!tmp && idxOfMol!=-1){
     54    const molecule *temp_mol = World::getInstance().getMolecule(MoleculeById(idxOfMol));
     55    if(!temp_mol && idxOfMol!=-1){
    5656      std::cout << "Invalid Molecule Index" << std::endl;
    5757      badInput = true;
    5858    }
     59    tmp.set(temp_mol);
    5960
    6061  } while(badInput);
  • src/UIElements/TextUI/Query/MoleculesTextQuery.cpp

    rb9c69d rf10b0c  
    3131
    3232
    33 TextDialog::MoleculesTextQuery::MoleculesTextQuery(std::string title, std::string _description) :
    34     Dialog::MoleculesQuery(title,_description)
     33TextDialog::MoleculesTextQuery::MoleculesTextQuery(Parameter<std::vector<const molecule *> > &param, std::string title, std::string _description) :
     34    Dialog::MoleculesQuery(param, title,_description)
    3535{}
    3636
     
    4343  getline(std::cin,line);
    4444  // dissect by " "
     45  std::vector<const molecule *> temp_mols;
    4546  std::string::iterator olditer = line.begin();
    4647  for(std::string::iterator iter = line.begin(); iter != line.end(); ++iter) {
     
    5354        break;
    5455      }
    55       tmp.push_back(temp);
     56      temp_mols.push_back(temp);
    5657      olditer = iter;
    5758    }
     
    6364    if(!temp && idxOfMol!=-1){
    6465      std::cout << "Invalid Molecule Index" << idxOfMol << std::endl;
    65       tmp.push_back(temp);
     66      temp_mols.push_back(temp);
    6667    }
    6768  }
     69  tmp.set(temp_mols);
    6870
    6971  return (idxOfMol!=-1);
  • src/UIElements/TextUI/Query/RandomNumberDistribution_ParametersTextQuery.cpp

    rb9c69d rf10b0c  
    3030#include "RandomNumbers/RandomNumberDistribution_Parameters.hpp"
    3131
    32 TextDialog::RandomNumberDistribution_ParametersTextQuery::RandomNumberDistribution_ParametersTextQuery(std::string title, std::string _description) :
    33     Dialog::RandomNumberDistribution_ParametersQuery(title,_description)
     32TextDialog::RandomNumberDistribution_ParametersTextQuery::RandomNumberDistribution_ParametersTextQuery(Parameter<RandomNumberDistribution_Parameters> &param, std::string title, std::string _description) :
     33    Dialog::RandomNumberDistribution_ParametersQuery(param, title,_description)
    3434{}
    3535
     
    4343    std::cout << "Please enter parameters as follows: 'p=0.5;'";
    4444    std::cout << "Empty line terminates." << std::endl;
    45     std::cin >> tmp;
     45    RandomNumberDistribution_Parameters temp_params;
     46    std::cin >> temp_params;
     47    tmp.set(temp_params);
    4648    if(std::cin.fail()){
    4749      badInput = true;
  • src/UIElements/TextUI/Query/StringTextQuery.cpp

    rb9c69d rf10b0c  
    2828
    2929
    30 TextDialog::StringTextQuery::StringTextQuery(std::string title, std::string _description) :
    31     Dialog::StringQuery(title,_description)
     30TextDialog::StringTextQuery::StringTextQuery(Parameter<std::string> &param, std::string title, std::string _description) :
     31    Dialog::StringQuery(param, title,_description)
    3232{}
    3333
     
    3636bool TextDialog::StringTextQuery::handle() {
    3737  std::cout << getDescription() << ": ";
    38   getline(std::cin,tmp);
     38  std::string temp_string;
     39  getline(std::cin,temp_string);
     40  tmp.set(temp_string);
    3941  return true;
    4042}
  • src/UIElements/TextUI/Query/StringsTextQuery.cpp

    rb9c69d rf10b0c  
    2828
    2929
    30 TextDialog::StringsTextQuery::StringsTextQuery(std::string title, std::string _description) :
    31     Dialog::StringsQuery(title,_description)
     30TextDialog::StringsTextQuery::StringsTextQuery(Parameter<std::vector<std::string> > &param, std::string title, std::string _description) :
     31    Dialog::StringsQuery(param, title,_description)
    3232{}
    3333
     
    3838  getline(std::cin,temp);
    3939  // dissect by " "
     40  std::vector<std::string> temp_strings;
    4041  std::string::iterator olditer = temp.begin();
    4142  for(std::string::iterator iter = temp.begin(); iter != temp.end(); ++iter) {
    4243    if (*iter == ' ') {
    43       tmp.push_back(std::string(iter, olditer));
     44      temp_strings.push_back(std::string(iter, olditer));
    4445      olditer = iter;
    4546    }
    4647  }
    4748  if (olditer != temp.begin())  // insert last part also
    48     tmp.push_back(std::string(olditer, temp.end()));
     49    temp_strings.push_back(std::string(olditer, temp.end()));
     50  tmp.set(temp_strings);
    4951
    5052  return true;
  • src/UIElements/TextUI/Query/TextQuery.hpp

    rb9c69d rf10b0c  
    1919class TextDialog::AtomTextQuery : public Dialog::AtomQuery {
    2020public:
    21   AtomTextQuery(std::string title, std::string _description = NULL);
     21  AtomTextQuery(Parameter<const atom *> &, std::string title, std::string _description = NULL);
    2222  virtual ~AtomTextQuery();
    2323  virtual bool handle();
     
    2626class TextDialog::AtomsTextQuery : public Dialog::AtomsQuery {
    2727public:
    28   AtomsTextQuery(std::string title, std::string _description = NULL);
     28  AtomsTextQuery(Parameter<std::vector<const atom *> > &, std::string title, std::string _description = NULL);
    2929  virtual ~AtomsTextQuery();
    3030  virtual bool handle();
     
    3333class TextDialog::BooleanTextQuery : public Dialog::BooleanQuery {
    3434public:
    35   BooleanTextQuery(std::string title, std::string _description = NULL);
     35  BooleanTextQuery(Parameter<bool> &, std::string title, std::string _description = NULL);
    3636  virtual ~BooleanTextQuery();
    3737  virtual bool handle();
     
    4040class TextDialog::BoxTextQuery : public Dialog::BoxQuery {
    4141public:
    42   BoxTextQuery(std::string title, std::string _description = NULL);
     42  BoxTextQuery(Parameter<Box> &, std::string title, std::string _description = NULL);
    4343  virtual ~BoxTextQuery();
    4444  virtual bool handle();
     
    4747class TextDialog::DoubleTextQuery : public Dialog::DoubleQuery {
    4848public:
    49   DoubleTextQuery(std::string title, std::string _description = NULL);
     49  DoubleTextQuery(Parameter<double> &, std::string title, std::string _description = NULL);
    5050  virtual ~DoubleTextQuery();
    5151  virtual bool handle();
     
    5454class TextDialog::DoublesTextQuery : public Dialog::DoublesQuery {
    5555public:
    56   DoublesTextQuery(std::string title, std::string _description = NULL);
     56  DoublesTextQuery(Parameter<std::vector<double> > &, std::string title, std::string _description = NULL);
    5757  virtual ~DoublesTextQuery();
    5858  virtual bool handle();
     
    6161class TextDialog::ElementTextQuery : public Dialog::ElementQuery {
    6262public:
    63   ElementTextQuery(std::string title, std::string _description = NULL);
     63  ElementTextQuery(Parameter<const element *> &, std::string title, std::string _description = NULL);
    6464  virtual ~ElementTextQuery();
    6565  virtual bool handle();
     
    6868class TextDialog::ElementsTextQuery : public Dialog::ElementsQuery {
    6969public:
    70   ElementsTextQuery(std::string title, std::string _description = NULL);
     70  ElementsTextQuery(Parameter<std::vector<const element *> > &, std::string title, std::string _description = NULL);
    7171  virtual ~ElementsTextQuery();
    7272  virtual bool handle();
     
    8282class TextDialog::FileTextQuery : public Dialog::FileQuery {
    8383public:
    84   FileTextQuery(std::string title, std::string _description = NULL);
     84  FileTextQuery(Parameter<boost::filesystem::path> &, std::string title, std::string _description = NULL);
    8585  virtual ~FileTextQuery();
    8686  virtual bool handle();
     
    8989class TextDialog::IntTextQuery : public Dialog::IntQuery {
    9090public:
    91   IntTextQuery(std::string title, std::string _description = NULL);
     91  IntTextQuery(Parameter<int> &, std::string title, std::string _description = NULL);
    9292  virtual ~IntTextQuery();
    9393  virtual bool handle();
     
    9696class TextDialog::IntsTextQuery : public Dialog::IntsQuery {
    9797public:
    98   IntsTextQuery(std::string title, std::string _description = NULL);
     98  IntsTextQuery(Parameter<std::vector<int> > &, std::string title, std::string _description = NULL);
    9999  virtual ~IntsTextQuery();
    100100  virtual bool handle();
     
    103103class TextDialog::MoleculeTextQuery : public Dialog::MoleculeQuery {
    104104public:
    105   MoleculeTextQuery(std::string title, std::string _description = NULL);
     105  MoleculeTextQuery(Parameter<const molecule *> &, std::string title, std::string _description = NULL);
    106106  virtual ~MoleculeTextQuery();
    107107  virtual bool handle();
     
    110110class TextDialog::MoleculesTextQuery : public Dialog::MoleculesQuery {
    111111public:
    112   MoleculesTextQuery(std::string title, std::string _description = NULL);
     112  MoleculesTextQuery(Parameter<std::vector<const molecule *> > &, std::string title, std::string _description = NULL);
    113113  virtual ~MoleculesTextQuery();
    114114  virtual bool handle();
     
    117117class TextDialog::StringTextQuery : public Dialog::StringQuery {
    118118public:
    119   StringTextQuery(std::string title, std::string _description = NULL);
     119  StringTextQuery(Parameter<std::string> &, std::string title, std::string _description = NULL);
    120120  virtual ~StringTextQuery();
    121121  virtual bool handle();
     
    124124class TextDialog::StringsTextQuery : public Dialog::StringsQuery {
    125125public:
    126   StringsTextQuery(std::string title, std::string _description = NULL);
     126  StringsTextQuery(Parameter<std::vector<std::string> > &, std::string title, std::string _description = NULL);
    127127  virtual ~StringsTextQuery();
    128128  virtual bool handle();
     
    131131class TextDialog::UnsignedIntTextQuery : public Dialog::UnsignedIntQuery {
    132132public:
    133   UnsignedIntTextQuery(std::string title, std::string _description = NULL);
     133  UnsignedIntTextQuery(Parameter<unsigned int> &, std::string title, std::string _description = NULL);
    134134  virtual ~UnsignedIntTextQuery();
    135135  virtual bool handle();
     
    138138class TextDialog::UnsignedIntsTextQuery : public Dialog::UnsignedIntsQuery {
    139139public:
    140   UnsignedIntsTextQuery(std::string title, std::string _description = NULL);
     140  UnsignedIntsTextQuery(Parameter<std::vector<unsigned int> > &, std::string title, std::string _description = NULL);
    141141  virtual ~UnsignedIntsTextQuery();
    142142  virtual bool handle();
     
    145145class TextDialog::VectorTextQuery : public Dialog::VectorQuery {
    146146public:
    147   VectorTextQuery(std::string title,bool _check, std::string _description = NULL);
     147  VectorTextQuery(Parameter<Vector> &, std::string title,bool _check, std::string _description = NULL);
    148148  virtual ~VectorTextQuery();
    149149  virtual bool handle();
     
    152152class TextDialog::VectorsTextQuery : public Dialog::VectorsQuery {
    153153public:
    154   VectorsTextQuery(std::string title,bool _check, std::string _description = NULL);
     154  VectorsTextQuery(Parameter<std::vector<Vector> > &, std::string title,bool _check, std::string _description = NULL);
    155155  virtual ~VectorsTextQuery();
    156156  virtual bool handle();
     
    159159class TextDialog::RandomNumberDistribution_ParametersTextQuery : public Dialog::RandomNumberDistribution_ParametersQuery {
    160160public:
    161   RandomNumberDistribution_ParametersTextQuery(std::string title, std::string _description = NULL);
     161  RandomNumberDistribution_ParametersTextQuery(Parameter<RandomNumberDistribution_Parameters> &, std::string title, std::string _description = NULL);
    162162  virtual ~RandomNumberDistribution_ParametersTextQuery();
    163163  virtual bool handle();
  • src/UIElements/TextUI/Query/UnsignedIntTextQuery.cpp

    rb9c69d rf10b0c  
    2828
    2929
    30 TextDialog::UnsignedIntTextQuery::UnsignedIntTextQuery(std::string title, std::string _description) :
    31     Dialog::UnsignedIntQuery(title,_description)
     30TextDialog::UnsignedIntTextQuery::UnsignedIntTextQuery(Parameter<unsigned int> &param, std::string title, std::string _description) :
     31    Dialog::UnsignedIntQuery(param, title,_description)
    3232{}
    3333
     
    3939    badInput = false;
    4040    std::cout << getDescription() << ": ";
    41     std::cin >> tmp;
     41    unsigned int temp_uint;
     42    std::cin >> temp_uint;
    4243    if(std::cin.fail()){
    4344      badInput=true;
     
    4647      std::cout << "Input was not a number!" << std::endl;
    4748    }
     49    tmp.set(temp_uint);
    4850  } while(badInput);
    4951  // clear the input buffer of anything still in the line
  • src/UIElements/TextUI/Query/UnsignedIntsTextQuery.cpp

    rb9c69d rf10b0c  
    2828
    2929
    30 TextDialog::UnsignedIntsTextQuery::UnsignedIntsTextQuery(std::string title, std::string _description) :
    31     Dialog::UnsignedIntsQuery(title,_description)
     30TextDialog::UnsignedIntsTextQuery::UnsignedIntsTextQuery(Parameter<std::vector<unsigned int> > &param, std::string title, std::string _description) :
     31    Dialog::UnsignedIntsQuery(param, title,_description)
    3232{}
    3333
     
    3939  getline(std::cin,line);
    4040  // dissect by " "
     41  std::vector<unsigned int> temp_uints;
    4142  std::string::iterator olditer = line.begin();
    4243  for(std::string::iterator iter = line.begin(); iter != line.end(); ++iter) {
     
    4445      std::istringstream stream(std::string(iter, olditer));
    4546      stream >> temp;
    46       tmp.push_back(temp);
     47      temp_uints.push_back(temp);
    4748      olditer = iter;
    4849    }
     
    5152    std::istringstream stream(std::string(olditer, line.end()));
    5253    stream >> temp;
    53     tmp.push_back(temp);
     54    temp_uints.push_back(temp);
    5455  }
     56  tmp.set(temp_uints);
    5557
    5658  return true;
  • src/UIElements/TextUI/Query/VectorTextQuery.cpp

    rb9c69d rf10b0c  
    3131
    3232
    33 TextDialog::VectorTextQuery::VectorTextQuery(std::string title, bool _check, std::string _description) :
    34     Dialog::VectorQuery(title,_check,_description)
     33TextDialog::VectorTextQuery::VectorTextQuery(Parameter<Vector> &param, std::string title, bool _check, std::string _description) :
     34    Dialog::VectorQuery(param, title,_check,_description)
    3535{}
    3636
     
    4848  getline(std::cin,line);
    4949
     50  Vector temp_vector;
     51
    5052  // dissect by ","
    5153  double coord = 0.;
     
    5658      std::istringstream stream(std::string(iter, olditer));
    5759      stream >> coord;
    58       tmp[counter++] = coord;
     60      temp_vector[counter++] = coord;
    5961      olditer = iter;
    6062    }
     
    6365    std::istringstream stream(std::string(olditer, line.end()));
    6466    stream >> coord;
    65     tmp[counter++] = coord;
     67    temp_vector[counter++] = coord;
    6668  }
     69  tmp.set(temp_vector);
    6770
    6871  // check vector
    69   return World::getInstance().getDomain().isValid(tmp);
     72  return World::getInstance().getDomain().isValid(temp_vector);
    7073}
    7174
  • src/UIElements/TextUI/Query/VectorsTextQuery.cpp

    rb9c69d rf10b0c  
    3131
    3232
    33 TextDialog::VectorsTextQuery::VectorsTextQuery(std::string title, bool _check, std::string _description) :
    34     Dialog::VectorsQuery(title,_check,_description)
     33TextDialog::VectorsTextQuery::VectorsTextQuery(Parameter<std::vector<Vector> > &param, std::string title, bool _check, std::string _description) :
     34    Dialog::VectorsQuery(param, title,_check,_description)
    3535{}
    3636
     
    5050  // dissect by ","
    5151  double coord = 0.;
     52  std::vector<Vector> temp_vectors;
    5253  std::string::iterator olditerspace = line.begin();
    5354  std::string::iterator olditercomma = line.begin();
     
    7273      }
    7374      if (World::getInstance().getDomain().isValid(temp))
    74         tmp.push_back(temp);
     75        temp_vectors.push_back(temp);
    7576      olditerspace = vectoriter;
    7677    }
    7778  }
     79  tmp.set(temp_vectors);
    7880
    7981  return true;
Note: See TracChangeset for help on using the changeset viewer.