Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Dialog.hpp

    r163110 r37a67f  
    2222#include "LinearAlgebra/RealSpaceMatrix.hpp"
    2323#include "LinearAlgebra/Vector.hpp"
    24 #include "RandomNumbers/RandomNumberDistribution_Parameters.hpp"
    2524#include "Parameters/Parameter.hpp"
     25#include "Parameters/Specifics/KeyValuePair.hpp"
    2626
    2727class atom;
     
    2929class element;
    3030class molecule;
    31 
    3231
    3332/** Dialog is one of the two main classes of the UIFactory base class.
     
    133132 * Due to the three present UI interfaces we have to add a specific Query for each, here
    134133 * is a list:
    135  *   -# add ValueStorage::setCurrentValue() and ValueStorage::queryCurrentValue() for
    136  *      both types
    137  *   -# add Dialog::query...()
    138  *   -# add Dialog::query<>() specialization calling the above function
    139  *   -# add CommandLineDialog::query...(), TextDialog::query...(), and QtDialog::query...(),
    140  *      i.e. for each of the three interface
    141  *   -# add empty definition DummyDialog::query...() to the stub for Action unittests in DummUI.hpp.
    142  *   -# add Dialog::...Query class with tmp value of desired type
     134 *   -# add a token (i.e. a unique name for the query parameter) and its type to the
     135 *      global list in \ref GlobalListOfParameterQueries.hpp. This will via boost
     136 *      preprocessor magic add definitions and some intermediatr template specializations.
     137 *   -# add a specialization for each of the UI interfaces of Dialog::...Query class.
     138 *   -# add class declaration of QtDialog::...Query in \ref QtQuery.hpp
    143139 *   -# add CommandLineDialog::...Query, TextDialog::...Query, QtDialog::...Query
    144  *   -# you probably also need a QtDialog::...QueryPipe() to handle the signal/slot stuff,
    145  *      Qt's moc does not like nested classes. Hence, this has to go extra.
    146  *   -# TypeEnumContainer add new type to query
     140 *   -# TypeEnumContainer add new type to query. Make the Type name match with the token
    147141 *   -# CommandLineParser::AddOptionToParser() add new type to query
    148142 *   -# CommandLineParser_valdiates.[ch]pp: If given above as a new type
    149143 *      program_options::value, define and implement a validate() function here.
     144 *
     145 * Note that the Empty..Query is always specificly present as it has not type and thus
     146 * does not fit into the preprocessor magic scheme (on the plus side it also serves
     147 * as a kind of visualization of what the preprocessor actually does).
    150148 *
    151149 */
     
    159157
    160158  virtual void queryEmpty(const std::string ="", const std::string = "")=0;
    161   virtual void queryBoolean(Parameter<bool> &, const std::string ="", const std::string = "")=0;
    162   virtual void queryInt(Parameter<int> &, const std::string ="", const std::string = "")=0;
    163   virtual void queryInts(Parameter<std::vector<int> > &, const std::string ="", const std::string = "")=0;
    164   virtual void queryUnsignedInt(Parameter<unsigned int> &, const std::string ="", const std::string = "")=0;
    165   virtual void queryUnsignedInts(Parameter<std::vector<unsigned int> > &, const std::string ="", const std::string = "")=0;
    166   virtual void queryDouble(Parameter<double> &, const std::string ="", const std::string = "")=0;
    167   virtual void queryDoubles(Parameter<std::vector<double> > &, const std::string ="", const std::string = "")=0;
    168   virtual void queryString(Parameter<std::string> &, const std::string ="", const std::string = "")=0;
    169   virtual void queryStrings(Parameter<std::vector<std::string> > &, const std::string ="", const std::string = "")=0;
    170   virtual void queryAtom(Parameter<const atom *> &, const std::string = "", const std::string = "")=0;
    171   virtual void queryAtoms(Parameter<std::vector<const atom *> > &, const std::string = "", const std::string = "")=0;
    172   virtual void queryMolecule(Parameter<const molecule *> &, const std::string ="", const std::string = "")=0;
    173   virtual void queryMolecules(Parameter<std::vector<const molecule *> > &, const std::string ="", const std::string = "")=0;
    174   virtual void queryVector(Parameter<Vector> &, const std::string ="", const std::string = "")=0;
    175   virtual void queryVectors(Parameter<std::vector<Vector> > &, const std::string ="", const std::string = "")=0;
    176   virtual void queryRealSpaceMatrix(Parameter<RealSpaceMatrix> &, const std::string ="", const std::string = "")=0;
    177   virtual void queryElement(Parameter<const element *> &, const std::string ="", const std::string = "")=0;
    178   virtual void queryElements(Parameter<std::vector<const element *> > &, const std::string ="", const std::string = "")=0;
    179   virtual void queryFile(Parameter<boost::filesystem::path> &, const std::string ="", const std::string = "")=0;
    180   virtual void queryFiles(Parameter< std::vector<boost::filesystem::path> > &, const std::string ="", const std::string = "")=0;
    181   virtual void queryRandomNumberDistribution_Parameters(Parameter<RandomNumberDistribution_Parameters> &, const std::string ="", const std::string = "")=0;
     159
     160  /** With the following boost::preprocessor code we generate virtual function
     161   * definitions for all desired query types in the abstract class Dialog.
     162   */
     163#include "UIElements/GlobalListOfParameterQueries.hpp"
     164#include "UIElements/Dialog_impl_pre.hpp"
     165
     166  // iterate over all parameter query types
     167  #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type
     168  #define SUFFIX =0
     169  #define BOOST_PP_LOCAL_MACRO(n) dialog_declaration(~, n, GLOBALLISTOFPARAMETERQUERIES_Token, GLOBALLISTOFPARAMETERQUERIES_Type)
     170  #define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMETERTOKENS-1)
     171  #include BOOST_PP_LOCAL_ITERATE()
     172  #undef dialog_declaration
     173  #undef SUFFIX
     174  #endif
     175
     176#include "Dialog_impl_undef.hpp"
     177  /* End of preprocessor code piece */
    182178
    183179  virtual bool display();
     
    286282};
    287283
    288 
    289284#endif /* DIALOG_HPP_ */
Note: See TracChangeset for help on using the changeset viewer.