Changeset 73faf4 for src/UIElements/CommandLineUI/Query
- Timestamp:
- May 8, 2017, 2:00:47 PM (9 years ago)
- Branches:
- ForceAnnealing_goodresults, ForceAnnealing_tocheck
- Children:
- c8165c
- Parents:
- ce254c (diff), cb6357 (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. - Location:
- src/UIElements/CommandLineUI/Query
- Files:
-
- 3 edited
-
CommandLineQuery.hpp (modified) (1 diff)
-
VectorCommandLineQuery.cpp (modified) (1 diff)
-
VectorsCommandLineQuery.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/CommandLineUI/Query/CommandLineQuery.hpp
rce254c r73faf4 24 24 }; 25 25 26 class CommandLineDialog::VectorCommandLineQuery : public Dialog::TQuery<Vector> { 27 public: 28 VectorCommandLineQuery(Parameter<Vector> &_param, const std::string &_title, const std::string &_description = ""); 29 virtual ~VectorCommandLineQuery(); 30 virtual bool handle(); 31 }; 32 33 class CommandLineDialog::VectorsCommandLineQuery : public Dialog::TQuery< std::vector<Vector> > { 34 public: 35 VectorsCommandLineQuery(Parameter< std::vector<Vector> > &_param, const std::string &_title, const std::string &_description = ""); 36 virtual ~VectorsCommandLineQuery(); 37 virtual bool handle(); 38 }; 39 26 40 /** With the following boost::preprocessor code we generate forward declarations 27 41 * of query class for all desired query types in the Qt specialization class of -
src/UIElements/CommandLineUI/Query/VectorCommandLineQuery.cpp
rce254c r73faf4 53 53 54 54 bool CommandLineDialog::VectorCommandLineQuery::handle() { 55 VectorValue _temp;55 VectorValue temporary; 56 56 if (CommandLineParser::getInstance().vm.count(getTitle())) { 57 try { 58 _temp = CommandLineParser::getInstance().vm[getTitle()].as< VectorValue >(); 59 } catch(boost::bad_any_cast &e) { 60 for (size_t i=0;i<NDIM;++i) 61 _temp.vector[i] = 0.; 62 return false; 63 } 64 temp = _temp.toVector(); 57 temporary = CommandLineParser::getInstance().vm[getTitle()].as< VectorValue >(); 58 temp = temporary.vectorstring; 65 59 return true; 66 60 } -
src/UIElements/CommandLineUI/Query/VectorsCommandLineQuery.cpp
rce254c r73faf4 46 46 47 47 CommandLineDialog::VectorsCommandLineQuery::VectorsCommandLineQuery(Parameter<std::vector<Vector> > &_param, const std::string &_title, const std::string &_description) : 48 Dialog::TQuery< std::vector<Vector> >(_param, _title, _description)48 Dialog::TQuery< std::vector<Vector> >(_param, _title, _description) 49 49 {} 50 50 … … 53 53 54 54 bool CommandLineDialog::VectorsCommandLineQuery::handle() { 55 std::vector<VectorValue> temporary; 55 std::vector<std::string> temporary; 56 std::stringstream output; 56 57 if (CommandLineParser::getInstance().vm.count(getTitle())) { 57 try { 58 temporary = CommandLineParser::getInstance().vm[getTitle()].as< std::vector<VectorValue> >(); 59 } catch(boost::bad_any_cast &e) { 60 temporary.clear(); 61 return false; 62 } 63 for(std::vector<VectorValue>::iterator iter = temporary.begin(); iter != temporary.end(); ++iter) { 64 Vector temp_element = (*iter).toVector(); 65 temp.push_back(temp_element); 66 } 58 temp = CommandLineParser::getInstance().vm[getTitle()].as< std::vector<std::string> >(); 67 59 return true; 68 60 }
Note:
See TracChangeset
for help on using the changeset viewer.
