Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Dialog.cpp

    r7d9416 r2c5765  
    2626#include "CodePatterns/Verbose.hpp"
    2727
    28 #include "Parameters/ParameterExceptions.hpp"
    29 
    3028class Atom;
     29class Box;
    3130class element;
    3231class RealSpaceMatrix;
     
    6665  bool retval = true;
    6766  for(iter=queries.begin(); iter!=queries.end(); iter++){
    68     try {
    69       retval &= (*iter)->handle();
    70     } catch (ParameterException &e) {
    71       if( const std::string *name=boost::get_error_info<ParameterName>(e) )
    72         ELOG(1, "The following parameter value is not valid: " << *name << ".");
    73       retval = false;
    74       break;
    75     }
     67    retval &= (*iter)->handle();
    7668    // if any query fails (is canceled), we can end the handling process
    7769    if(!retval) {
     
    8678  list<Query*>::iterator iter;
    8779  for(iter=queries.begin(); iter!=queries.end(); iter++) {
    88     try {
    89       (*iter)->setResult();
    90     } catch (ParameterException &e) {
    91       if( const std::string *name=boost::get_error_info<ParameterName>(e) )
    92         ELOG(1, "The following parameter value is not valid: " << *name << ".");
    93       break;
    94     }
     80    (*iter)->setResult();
    9581  }
    9682}
     
    10086}
    10187
    102 template <> void Dialog::query<void *>(Parameter<void *> &param, const char *token, std::string description)
     88template <> void Dialog::query<void *>(const char *token, std::string description)
    10389{
    10490  queryEmpty(token, description);
    10591}
    10692
    107 template <> void Dialog::query<bool>(Parameter<bool> &param, const char *token, std::string description)
    108 {
    109   queryBoolean(param, token, description);
    110 }
    111 
    112 template <> void Dialog::query<int>(Parameter<int> &param, const char *token, std::string description)
    113 {
    114   queryInt(param, token, description);
    115 }
    116 
    117 template <> void Dialog::query< std::vector<int> >(Parameter<std::vector<int> > &param, const char *token, std::string description)
    118 {
    119   queryInts(param, token, description);
    120 }
    121 
    122 template <> void Dialog::query<unsigned int>(Parameter<unsigned int> &param, const char *token, std::string description)
    123 {
    124   queryUnsignedInt(param, token, description);
    125 }
    126 
    127 template <> void Dialog::query< std::vector<unsigned int> >(Parameter<std::vector<unsigned int> > &param, const char *token, std::string description)
    128 {
    129   queryUnsignedInts(param, token, description);
    130 }
    131 
    132 template <> void Dialog::query<double>(Parameter<double> &param, const char *token, std::string description)
    133 {
    134   queryDouble(param, token, description);
    135 }
    136 
    137 template <> void Dialog::query< std::vector<double> >(Parameter<std::vector<double> > &param, const char *token, std::string description)
    138 {
    139   queryDoubles(param, token, description);
    140 }
    141 
    142 template <> void Dialog::query<std::string>(Parameter<std::string> &param, const char *token, std::string description)
    143 {
    144   queryString(param, token, description);
    145 }
    146 
    147 template <> void Dialog::query< std::vector<std::string> >(Parameter<std::vector<std::string> > &param, const char *token, std::string description)
    148 {
    149   queryStrings(param, token, description);
    150 }
    151 
    152 template <> void Dialog::query<const atom *>(Parameter<const atom *> &param, const char *token, std::string description)
    153 {
    154   queryAtom(param, token, description);
    155 }
    156 
    157 template <> void Dialog::query< std::vector<const atom *> >(Parameter<std::vector<const atom *> > &param, const char *token, std::string description)
    158 {
    159   queryAtoms(param, token, description);
    160 }
    161 
    162 template <> void Dialog::query<const molecule *>(Parameter<const molecule *> &param, const char *token, std::string description)
    163 {
    164   queryMolecule(param, token, description);
    165 }
    166 
    167 template <> void Dialog::query< std::vector<const molecule *> >(Parameter<std::vector<const molecule *> > &param, const char *token, std::string description)
    168 {
    169   queryMolecules(param, token, description);
    170 }
    171 
    172 template <> void Dialog::query<Vector>(Parameter<Vector> &param, const char *token, std::string description)
    173 {
    174   queryVector(param, token, false, description);
    175 }
    176 
    177 template <> void Dialog::query< std::vector<Vector> >(Parameter<std::vector<Vector> > &param, const char *token, std::string description)
    178 {
    179   queryVectors(param, token, false, description);
    180 }
    181 
    182 template <> void Dialog::query<BoxVector>(Parameter<BoxVector> &param, const char *token, std::string description)
    183 {
    184   ASSERT(0, "TODO: query<BoxVector>");
    185   //queryVector(param, token, true, description);
    186 }
    187 
    188 template <> void Dialog::query< std::vector<BoxVector> >(Parameter<std::vector<BoxVector> > &param, const char *token, std::string description)
    189 {
    190   ASSERT(0, "TODO: query<vector<BoxVector> >");
    191   //queryVectors(param, token, true, description);
    192 }
    193 
    194 template <> void Dialog::query<RealSpaceMatrix>(Parameter<RealSpaceMatrix> &param, const char *token, std::string description)
    195 {
    196   queryRealSpaceMatrix(param, token, description);
    197 }
    198 
    199 template <> void Dialog::query<const element *>(Parameter<const element *> &param, const char *token, std::string description)
    200 {
    201   queryElement(param, token, description);
    202 }
    203 
    204 template <> void Dialog::query< std::vector<const element *> >(Parameter<std::vector<const element *> > &param, const char *token, std::string description)
    205 {
    206   queryElements(param, token, description);
    207 }
    208 
    209 template <> void Dialog::query< boost::filesystem::path >(Parameter<boost::filesystem::path> &param, const char *token, std::string description)
    210 {
    211   queryFile(param, token, description);
    212 }
    213 
    214 template <> void Dialog::query< RandomNumberDistribution_Parameters >(Parameter<RandomNumberDistribution_Parameters> &param, const char *token, std::string description)
    215 {
    216   queryRandomNumberDistribution_Parameters(param, token, description);
     93template <> void Dialog::query<bool>(const char *token, std::string description)
     94{
     95  queryBoolean(token, description);
     96}
     97
     98template <> void Dialog::query<int>(const char *token, std::string description)
     99{
     100  queryInt(token, description);
     101}
     102
     103template <> void Dialog::query< std::vector<int> >(const char *token, std::string description)
     104{
     105  queryInts(token, description);
     106}
     107
     108template <> void Dialog::query<unsigned int>(const char *token, std::string description)
     109{
     110  queryUnsignedInt(token, description);
     111}
     112
     113template <> void Dialog::query< std::vector<unsigned int> >(const char *token, std::string description)
     114{
     115  queryUnsignedInts(token, description);
     116}
     117
     118template <> void Dialog::query<double>(const char *token, std::string description)
     119{
     120  queryDouble(token, description);
     121}
     122
     123template <> void Dialog::query< std::vector<double> >(const char *token, std::string description)
     124{
     125  queryDoubles(token, description);
     126}
     127
     128template <> void Dialog::query<std::string>(const char *token, std::string description)
     129{
     130  queryString(token, description);
     131}
     132
     133template <> void Dialog::query< std::vector<std::string> >(const char *token, std::string description)
     134{
     135  queryStrings(token, description);
     136}
     137
     138template <> void Dialog::query<const atom *>(const char *token, std::string description)
     139{
     140  queryAtom(token, description);
     141}
     142
     143template <> void Dialog::query< std::vector<const atom *> >(const char *token, std::string description)
     144{
     145  queryAtoms(token, description);
     146}
     147
     148template <> void Dialog::query<const molecule *>(const char *token, std::string description)
     149{
     150  queryMolecule(token, description);
     151}
     152
     153template <> void Dialog::query< std::vector<const molecule *> >(const char *token, std::string description)
     154{
     155  queryMolecules(token, description);
     156}
     157
     158template <> void Dialog::query<Vector>(const char *token, std::string description)
     159{
     160  queryVector(token, false, description);
     161}
     162
     163template <> void Dialog::query< std::vector<Vector> >(const char *token, std::string description)
     164{
     165  queryVectors(token, false, description);
     166}
     167
     168template <> void Dialog::query<BoxVector>(const char *token, std::string description)
     169{
     170  queryVector(token, true, description);
     171}
     172
     173template <> void Dialog::query< std::vector<BoxVector> >(const char *token, std::string description)
     174{
     175  queryVectors(token, true, description);
     176}
     177
     178template <> void Dialog::query<Box>(const char *token, std::string description)
     179{
     180  queryBox(token, description);
     181}
     182
     183template <> void Dialog::query<const element *>(const char *token, std::string description)
     184{
     185  queryElement(token, description);
     186}
     187
     188template <> void Dialog::query< std::vector<const element *> >(const char *token, std::string description)
     189{
     190  queryElements(token, description);
     191}
     192
     193template <> void Dialog::query< boost::filesystem::path >(const char *token, std::string description)
     194{
     195  queryFile(token, description);
     196}
     197
     198template <> void Dialog::query< std::vector<boost::filesystem::path> >(const char *token, std::string description)
     199{
     200  queryFiles(token, description);
     201}
     202
     203template <> void Dialog::query< RandomNumberDistribution_Parameters >(const char *token, std::string description)
     204{
     205  queryRandomNumberDistribution_Parameters(token, description);
    217206}
    218207
Note: See TracChangeset for help on using the changeset viewer.