| [f5a86a] | 1 | /*
 | 
|---|
 | 2 |  * Dialog.hpp
 | 
|---|
 | 3 |  *
 | 
|---|
 | 4 |  *  Created on: Jan 5, 2010
 | 
|---|
 | 5 |  *      Author: crueger
 | 
|---|
 | 6 |  */
 | 
|---|
 | 7 | 
 | 
|---|
 | 8 | #ifndef DIALOG_HPP_
 | 
|---|
 | 9 | #define DIALOG_HPP_
 | 
|---|
 | 10 | 
 | 
|---|
| [56f73b] | 11 | // include config.h
 | 
|---|
 | 12 | #ifdef HAVE_CONFIG_H
 | 
|---|
 | 13 | #include <config.h>
 | 
|---|
 | 14 | #endif
 | 
|---|
 | 15 | 
 | 
|---|
 | 16 | 
 | 
|---|
| [f5a86a] | 17 | #include<string>
 | 
|---|
 | 18 | #include<list>
 | 
|---|
| [104524] | 19 | #include<vector>
 | 
|---|
| [f5a86a] | 20 | 
 | 
|---|
| [6f5dfe] | 21 | #include <boost/filesystem.hpp>
 | 
|---|
| [7d9416] | 22 | #include "LinearAlgebra/RealSpaceMatrix.hpp"
 | 
|---|
| [57f243] | 23 | #include "LinearAlgebra/Vector.hpp"
 | 
|---|
| [0275ad] | 24 | #include "RandomNumbers/RandomNumberDistribution_Parameters.hpp"
 | 
|---|
| [f10b0c] | 25 | #include "Parameters/Parameter.hpp"
 | 
|---|
| [7cd6e7] | 26 | 
 | 
|---|
| [97ebf8] | 27 | class atom;
 | 
|---|
| [7d9416] | 28 | class RealSpaceMatrix;
 | 
|---|
| [97ebf8] | 29 | class element;
 | 
|---|
| [7aa000] | 30 | class molecule;
 | 
|---|
| [45f5d6] | 31 | 
 | 
|---|
| [de8e45] | 32 | 
 | 
|---|
 | 33 | /** Dialog is one of the two main classes of the UIFactory base class.
 | 
|---|
 | 34 |  *
 | 
|---|
| [db7cb0] | 35 |  * The Dialog is meant for asking the user for information needed to perform
 | 
|---|
 | 36 |  * actions he desires, such as asking for a position in space or a length.
 | 
|---|
| [de8e45] | 37 |  *
 | 
|---|
| [db7cb0] | 38 |  * For this purpose there is the base class Query and numerous specializations
 | 
|---|
 | 39 |  * for each of the types to be asked. There are primitives integer, doubles and
 | 
|---|
 | 40 |  * string, but also advanced types such as element, molecule or Vector. There
 | 
|---|
 | 41 |  * is also an empty query for displaying text.
 | 
|---|
| [e4afb4] | 42 |  *
 | 
|---|
 | 43 |  * Note that the templatization of Dialog::query() allows for easy implementation
 | 
|---|
 | 44 |  * of new types that correspond to/are derived from old ones.
 | 
|---|
 | 45 |  *
 | 
|---|
 | 46 |  * <H3>How do Dialogs operate?</H3>
 | 
|---|
 | 47 |  *
 | 
|---|
 | 48 |  * Dialogs are initiated by Action::FillDialog() function calls. Within Action::Call()
 | 
|---|
 | 49 |  * a dialog is created and passed on to FillDialog(), which is specialized in each
 | 
|---|
 | 50 |  * specific Action to ask for the specific parameter it needs.
 | 
|---|
 | 51 |  *
 | 
|---|
 | 52 |  * Dialogs are derived for each of the UI types
 | 
|---|
 | 53 |  *  -# CommandLineDialog
 | 
|---|
 | 54 |  *  -# QtDialog
 | 
|---|
 | 55 |  *  -# TextDialog
 | 
|---|
 | 56 |  *
 | 
|---|
 | 57 |  * This "asking" for parameters is done via the Query class.  There are four types
 | 
|---|
 | 58 |  * of Query types:
 | 
|---|
 | 59 |  *  -# Query, members in class Dialog
 | 
|---|
 | 60 |  *  -# CommandLineQuery, members in class CommandLineDialog
 | 
|---|
 | 61 |  *  -# QtQuery, members in class QtDialog
 | 
|---|
 | 62 |  *  -# TextQuery, members in class TextDialog
 | 
|---|
 | 63 |  * Each embodies a certain way of asking the user for the specific type of parameter
 | 
|---|
 | 64 |  * needed, e.g. a file via the TextMenu interface would be done in member functions of
 | 
|---|
 | 65 |  * TextDialog::FileTextQuery.
 | 
|---|
 | 66 |  *
 | 
|---|
 | 67 |  *
 | 
|---|
 | 68 |  * Generally, the sequence of events is as follows:
 | 
|---|
 | 69 |  *  -# Action::fillDialog() calls upon Dialog::query<T> for some type T, let's say T
 | 
|---|
 | 70 |  *     stands for double
 | 
|---|
 | 71 |  *  -# Dialog::query<double> call a function queryDouble()
 | 
|---|
 | 72 |  *  -# depending on the currently used UIFactory, the Dialog above is actually either
 | 
|---|
 | 73 |  *     of the three specialized types, let's say CommandLine. And we see that within
 | 
|---|
 | 74 |  *     CommandLineDialog we have the respective method ueryDouble() that registers
 | 
|---|
 | 75 |  *     a new instance of the class CommandLineDialog::DoubleCommandLineQuery.
 | 
|---|
 | 76 |  *  -# The Query's are first registered, as multiple parameters may be needed for
 | 
|---|
 | 77 |  *     a single Action and we don't want the popping up of a dialog window for each
 | 
|---|
 | 78 |  *     alone. Rather, we want to merge the Query's into a single Dialog. Therefore,
 | 
|---|
 | 79 |  *     they are first registered and then executed in sequence. This is done in
 | 
|---|
 | 80 |  *     Dialog::display(), i.e. when the dialog is finally shown to the user.
 | 
|---|
 | 81 |  *  -# Then each of the registered Query's, here our CommandLineDialog::
 | 
|---|
 | 82 |  *     DoubleCommandLineQuery, constructor is called.
 | 
|---|
 | 83 |  *     -# This will call the constructor of its base class, where the actual value
 | 
|---|
 | 84 |  *        is stored and later stored into the ValueStorage class by
 | 
|---|
 | 85 |  *        Dialog::Query::setResult().
 | 
|---|
 | 86 |  *     -# Also, e.g. for the Qt interface, the buttons, labels and so forth are
 | 
|---|
 | 87 |  *        created and added to the dialog.
 | 
|---|
 | 88 |  *  -# Now the users enters information for each UI something different happens:
 | 
|---|
 | 89 |  *    -# CommandLine: The actual value retrieval is done by the CommandLineParser and
 | 
|---|
 | 90 |  *       the boost::program_options library, the value is stored therein for the moment.
 | 
|---|
 | 91 |  *       (see here: http://www.boost.org/doc/libs/1_44_0/doc/html/program_options/)
 | 
|---|
 | 92 |  *    -# TextMenu: The value is requested via std::cin from the user.
 | 
|---|
 | 93 |  *    -# QtMenu: The users enters the value in a Dialog. Due to Qt necessities a
 | 
|---|
 | 94 |  *       Pipe class obtains the value from the Dialog with Qt's signal/slot mechanism
 | 
|---|
 | 95 |  *       and put it into Dialog::...Query value.
 | 
|---|
 | 96 |  *  -# in our case DoubleCommandLineQuery::handle() will be called. The value is
 | 
|---|
 | 97 |  *     retrieved and put into Dialog::DoubleQuery::tmp
 | 
|---|
 | 98 |  *  -# Finally, for each Query, also Dialog::DoubleQuery, setResult() is called which
 | 
|---|
 | 99 |  *     puts the value as a string into the ValueStorage under a given token that is
 | 
|---|
 | 100 |  *     associated with a type (and thereby we assure type-safety).
 | 
|---|
 | 101 |  *
 | 
|---|
 | 102 |  * <H3>Regarding derived types of types with already present queries</H3>
 | 
|---|
 | 103 |  *
 | 
|---|
 | 104 |  * Example: We have got a derived Vector class, called BoxVector, that is by any means
 | 
|---|
 | 105 |  * a Vector but with one difference: it is always bound to lie within the current domain.
 | 
|---|
 | 106 |  * With regards to type-casting it to and from a string however, nothing is different
 | 
|---|
 | 107 |  * between Vector and BoxVector.
 | 
|---|
 | 108 |  *
 | 
|---|
 | 109 |  * So, do we need a new Query for this?
 | 
|---|
 | 110 |  * No.
 | 
|---|
 | 111 |  *
 | 
|---|
 | 112 |  * We just have to do this:
 | 
|---|
 | 113 |  *  -# add a specialization of Dialog::query<BoxVector> where queryVector()is used.
 | 
|---|
 | 114 |  *     @code
 | 
|---|
 | 115 |  *     template <> void Dialog::query<BoxVector>(const char *token, std::string description) {
 | 
|---|
 | 116 |  *        queryVector(token, false, description);
 | 
|---|
 | 117 |  *     }
 | 
|---|
 | 118 |  *     @endcode
 | 
|---|
 | 119 |  *  -# make sure that
 | 
|---|
 | 120 |  *     -# ValueStorage::setCurrentValue() the specialization for class Vector has an
 | 
|---|
 | 121 |  *     if case also for BoxVector and does something appropriate.
 | 
|---|
 | 122 |  *     -# ValueStorage::queryCurrentValue() has another specialization doing the same
 | 
|---|
 | 123 |  *     as for Vector but for BoxVector in its signature.
 | 
|---|
 | 124 |  *
 | 
|---|
 | 125 |  * And that's all.
 | 
|---|
 | 126 |  *
 | 
|---|
 | 127 |  *
 | 
|---|
 | 128 |  * <H3>Adding new queries</H3>
 | 
|---|
 | 129 |  *
 | 
|---|
 | 130 |  * Check first whether you really need a new query or whether we can derive it and re-use
 | 
|---|
 | 131 |  * one of the present ones.
 | 
|---|
 | 132 |  *
 | 
|---|
 | 133 |  * Due to the three present UI interfaces we have to add a specific Query for each, here
 | 
|---|
 | 134 |  * 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
 | 
|---|
| [12948c] | 141 |  *   -# add empty definition DummyDialog::query...() to the stub for Action unittests in DummUI.hpp.
 | 
|---|
| [e4afb4] | 142 |  *   -# add Dialog::...Query class with tmp value of desired type
 | 
|---|
 | 143 |  *   -# 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.
 | 
|---|
| [0275ad] | 146 |  *   -# TypeEnumContainer add new type to query
 | 
|---|
 | 147 |  *   -# CommandLineParser::AddOptionToParser() add new type to query
 | 
|---|
 | 148 |  *   -# CommandLineParser_valdiates.[ch]pp: If given above as a new type
 | 
|---|
 | 149 |  *      program_options::value, define and implement a validate() function here.
 | 
|---|
| [e4afb4] | 150 |  *
 | 
|---|
| [de8e45] | 151 |  */
 | 
|---|
| [f5a86a] | 152 | class Dialog
 | 
|---|
 | 153 | {
 | 
|---|
 | 154 | public:
 | 
|---|
 | 155 |   Dialog();
 | 
|---|
 | 156 |   virtual ~Dialog();
 | 
|---|
 | 157 | 
 | 
|---|
| [f10b0c] | 158 |   template <class T> void query(Parameter<T> &, const char *, std::string = "");
 | 
|---|
| [9ee38b] | 159 | 
 | 
|---|
| [86466e] | 160 |   virtual void queryEmpty(const char *, std::string = "")=0;
 | 
|---|
| [f10b0c] | 161 |   virtual void queryBoolean(Parameter<bool> &, const char *, std::string = "")=0;
 | 
|---|
 | 162 |   virtual void queryInt(Parameter<int> &, const char *, std::string = "")=0;
 | 
|---|
 | 163 |   virtual void queryInts(Parameter<std::vector<int> > &, const char *, std::string = "")=0;
 | 
|---|
 | 164 |   virtual void queryUnsignedInt(Parameter<unsigned int> &, const char *, std::string = "")=0;
 | 
|---|
 | 165 |   virtual void queryUnsignedInts(Parameter<std::vector<unsigned int> > &, const char *, std::string = "")=0;
 | 
|---|
 | 166 |   virtual void queryDouble(Parameter<double> &, const char*, std::string = "")=0;
 | 
|---|
 | 167 |   virtual void queryDoubles(Parameter<std::vector<double> > &, const char*, std::string = "")=0;
 | 
|---|
 | 168 |   virtual void queryString(Parameter<std::string> &, const char*, std::string = "")=0;
 | 
|---|
 | 169 |   virtual void queryStrings(Parameter<std::vector<std::string> > &, const char*, std::string = "")=0;
 | 
|---|
 | 170 |   virtual void queryAtom(Parameter<const atom *> &, const char*,std::string = "")=0;
 | 
|---|
 | 171 |   virtual void queryAtoms(Parameter<std::vector<const atom *> > &, const char*,std::string = "")=0;
 | 
|---|
 | 172 |   virtual void queryMolecule(Parameter<const molecule *> &, const char*, std::string = "")=0;
 | 
|---|
 | 173 |   virtual void queryMolecules(Parameter<std::vector<const molecule *> > &, const char*, std::string = "")=0;
 | 
|---|
| [9d5531] | 174 |   virtual void queryVector(Parameter<Vector> &, const char*, std::string = "")=0;
 | 
|---|
 | 175 |   virtual void queryVectors(Parameter<std::vector<Vector> > &, const char*, std::string = "")=0;
 | 
|---|
| [7d9416] | 176 |   virtual void queryRealSpaceMatrix(Parameter<RealSpaceMatrix> &, const char*, std::string = "")=0;
 | 
|---|
| [f10b0c] | 177 |   virtual void queryElement(Parameter<const element *> &, const char*, std::string = "")=0;
 | 
|---|
 | 178 |   virtual void queryElements(Parameter<std::vector<const element *> > &, const char*, std::string = "")=0;
 | 
|---|
 | 179 |   virtual void queryFile(Parameter<boost::filesystem::path> &, const char*, std::string = "")=0;
 | 
|---|
| [bd81f9] | 180 |   virtual void queryFiles(Parameter< std::vector<boost::filesystem::path> > &, const char*, std::string = "")=0;
 | 
|---|
| [f10b0c] | 181 |   virtual void queryRandomNumberDistribution_Parameters(Parameter<RandomNumberDistribution_Parameters> &, const char*, std::string = "")=0;
 | 
|---|
| [f5a86a] | 182 | 
 | 
|---|
| [45f5d6] | 183 |   virtual bool display();
 | 
|---|
| [f5a86a] | 184 | 
 | 
|---|
| [d3a5ea] | 185 |   virtual bool checkAll();
 | 
|---|
 | 186 |   virtual void setAll();
 | 
|---|
 | 187 | 
 | 
|---|
| [c508ef5] | 188 |   virtual bool hasQueries();
 | 
|---|
 | 189 | 
 | 
|---|
| [7dfd07] | 190 |   virtual void update(){}
 | 
|---|
 | 191 | 
 | 
|---|
| [f5a86a] | 192 | protected:
 | 
|---|
 | 193 |   // methodology for handling queries
 | 
|---|
 | 194 |   // all queries are stored and then performed at appropriate times
 | 
|---|
 | 195 | 
 | 
|---|
 | 196 |   //these queries can be handled by this dialog
 | 
|---|
| [45f5d6] | 197 | 
 | 
|---|
 | 198 |   //TODO: Find a way to reduce complexity...
 | 
|---|
 | 199 |   //needs O(N*M) query classes, where N is the number of query types and M is the number of GUIs
 | 
|---|
 | 200 |   //usual approach for reducing inheritance complexity (strategy pattern) does not work,
 | 
|---|
 | 201 |   //due to lack of common code for query types as well as GUI-Types (all subtypes differ a lot)
 | 
|---|
 | 202 | 
 | 
|---|
| [db7cb0] | 203 |   /** Base class for all queries.
 | 
|---|
 | 204 |    *
 | 
|---|
| [b2c302] | 205 |    * A query is request to the user for a value of a specific type.
 | 
|---|
 | 206 |    * E.g. All \ref Action's need parameters to perform a specific function.
 | 
|---|
 | 207 |    * These are obtained from the user at run-time via a Query regardless
 | 
|---|
 | 208 |    * of the interface that the user is using.
 | 
|---|
| [db7cb0] | 209 |    *
 | 
|---|
| [b2c302] | 210 |    * A Query always contains a protected member variable of the specific type.
 | 
|---|
 | 211 |    * For each type there is a derived class, e.g. for a boolean there is
 | 
|---|
 | 212 |    * \ref BooleanQuery deriving from \ref Query. Each specific UI derives
 | 
|---|
 | 213 |    * again from a specific Query, e.g. for the \link userinterfaces-textmenu
 | 
|---|
 | 214 |    * textmenu \endlink we have \ref BooleanTextQuery that derives from
 | 
|---|
 | 215 |    * \ref BooleanQuery. This derived class has to implement the Query::handle
 | 
|---|
 | 216 |    * function that actually sets the protected member variable to something
 | 
|---|
 | 217 |    * the user has entered. Also it implements Query::setResult that actually
 | 
|---|
 | 218 |    * places the obtained value in the \ref ValueStorage.
 | 
|---|
 | 219 |    *
 | 
|---|
 | 220 |    * \section query-howto How to add another query?
 | 
|---|
| [db7cb0] | 221 |    *
 | 
|---|
 | 222 |    * Let's say  we want to query for a type called \a Value.
 | 
|---|
 | 223 |    *
 | 
|---|
 | 224 |    * Then, we do the following:
 | 
|---|
 | 225 |    *  -# Add a class ValueQuery inside class Dialog, the class contains
 | 
|---|
 | 226 |    *    -# constructor/destructor (latter virtual! because of derived class)
 | 
|---|
 | 227 |    *    -# virtual bool handle() and virtual void setResult()
 | 
|---|
 | 228 |    *    -# a protected member tmp of type Value (NOTE: herein the result is stored)
 | 
|---|
 | 229 |    *    -# if temporaries for conversion are needed put them in here
 | 
|---|
 | 230 |    *  -# add a function queryValue
 | 
|---|
 | 231 |    *  -# now, for each of the GUIs we basically have to repeat the above, i.e.
 | 
|---|
 | 232 |    *     add the class and the function that implement the virtual ones above.
 | 
|---|
| [4cf323d] | 233 |    *    -# QT: an extra class called ValueQtQueryPipe that actually handles
 | 
|---|
| [db7cb0] | 234 |    *       showing dialogs to obtain the value and placing it into the \a tmp
 | 
|---|
 | 235 |    *       variable (via a given pointer to it as reference). handle() will
 | 
|---|
| [4cf323d] | 236 |    *       simply return true. This is needed because of a restriction of Qt4:
 | 
|---|
| [db7cb0] | 237 |    *       its meta-object-compiler does not like nested classes.
 | 
|---|
 | 238 |    *    -# CommandLine: nothing special, handle() imports value from \a
 | 
|---|
 | 239 |    *       CommandLineParser and sets the tmp variable.
 | 
|---|
 | 240 |    *    -# Text: nothing special, handle() queries the user and sets the tmp
 | 
|---|
 | 241 |    *       variable
 | 
|---|
 | 242 |    */
 | 
|---|
| [45f5d6] | 243 |   class Query {
 | 
|---|
| [94d131] | 244 |     friend class Dialog;
 | 
|---|
| [45f5d6] | 245 |   public:
 | 
|---|
| [a2ab15] | 246 |     Query(std::string _title, std::string _description = "");
 | 
|---|
| [5a7243] | 247 |     virtual ~Query();
 | 
|---|
| [45f5d6] | 248 |     virtual bool handle()=0;
 | 
|---|
 | 249 |     virtual void setResult()=0;
 | 
|---|
 | 250 |   protected:
 | 
|---|
 | 251 |     const std::string getTitle() const;
 | 
|---|
| [a2ab15] | 252 |     const std::string getDescription() const;
 | 
|---|
| [45f5d6] | 253 |   private:
 | 
|---|
| [a2ab15] | 254 |     std::string title;  //!< short title of the query
 | 
|---|
 | 255 |     std::string description; //!< longer description for tooltips or for help
 | 
|---|
| [f5a86a] | 256 |   };
 | 
|---|
 | 257 | 
 | 
|---|
| [86466e] | 258 |   // Empty Query is just meant for showing text, such as version, help, initial message or alike
 | 
|---|
 | 259 |   class EmptyQuery : public Query {
 | 
|---|
 | 260 |   public:
 | 
|---|
 | 261 |     EmptyQuery(std::string title, std::string _description = "");
 | 
|---|
 | 262 |     virtual ~EmptyQuery();
 | 
|---|
 | 263 |     virtual bool handle()=0;
 | 
|---|
 | 264 |     virtual void setResult();
 | 
|---|
| [f5a86a] | 265 |   };
 | 
|---|
 | 266 | 
 | 
|---|
| [45f5d6] | 267 |   //Specialized classes for certain types. GUI-Types are not specialized at this time
 | 
|---|
| [97ebf8] | 268 |   class BooleanQuery : public Query {
 | 
|---|
 | 269 |   public:
 | 
|---|
| [9d5531] | 270 |     BooleanQuery(Parameter<bool> &_param, std::string title, std::string _description = "");
 | 
|---|
| [97ebf8] | 271 |     virtual ~BooleanQuery();
 | 
|---|
 | 272 |     virtual bool handle()=0;
 | 
|---|
 | 273 |     virtual void setResult();
 | 
|---|
 | 274 |   protected:
 | 
|---|
| [9d5531] | 275 |     bool temp;
 | 
|---|
 | 276 |     Parameter<bool> ¶m;
 | 
|---|
| [97ebf8] | 277 |   };
 | 
|---|
 | 278 | 
 | 
|---|
| [45f5d6] | 279 |   class IntQuery : public Query {
 | 
|---|
 | 280 |   public:
 | 
|---|
| [9d5531] | 281 |     IntQuery(Parameter<int> &_param, std::string title, std::string _description = "");
 | 
|---|
| [5a7243] | 282 |     virtual ~IntQuery();
 | 
|---|
| [45f5d6] | 283 |     virtual bool handle()=0;
 | 
|---|
 | 284 |     virtual void setResult();
 | 
|---|
 | 285 |   protected:
 | 
|---|
| [9d5531] | 286 |     int temp;
 | 
|---|
 | 287 |     Parameter<int> ¶m;
 | 
|---|
| [45f5d6] | 288 |   };
 | 
|---|
 | 289 | 
 | 
|---|
| [7cd6e7] | 290 |   class IntsQuery : public Query {
 | 
|---|
 | 291 |   public:
 | 
|---|
| [f10b0c] | 292 |     IntsQuery(Parameter<std::vector<int> > &, std::string title, std::string _description = "");
 | 
|---|
| [7cd6e7] | 293 |     virtual ~IntsQuery();
 | 
|---|
 | 294 |     virtual bool handle()=0;
 | 
|---|
 | 295 |     virtual void setResult();
 | 
|---|
 | 296 |   protected:
 | 
|---|
| [9d5531] | 297 |     int temp_element;
 | 
|---|
 | 298 |     std::vector<int> temp;
 | 
|---|
 | 299 |     Parameter<std::vector<int> > ¶m;
 | 
|---|
| [7cd6e7] | 300 |   };
 | 
|---|
 | 301 | 
 | 
|---|
| [838cd0] | 302 |   class UnsignedIntQuery : public Query {
 | 
|---|
 | 303 |   public:
 | 
|---|
| [f10b0c] | 304 |     UnsignedIntQuery(Parameter<unsigned int> &, std::string title, std::string _description = "");
 | 
|---|
| [838cd0] | 305 |     virtual ~UnsignedIntQuery();
 | 
|---|
 | 306 |     virtual bool handle()=0;
 | 
|---|
 | 307 |     virtual void setResult();
 | 
|---|
 | 308 |   protected:
 | 
|---|
| [9d5531] | 309 |     unsigned int temp;
 | 
|---|
 | 310 |     Parameter<unsigned int> ¶m;
 | 
|---|
| [838cd0] | 311 |   };
 | 
|---|
 | 312 | 
 | 
|---|
| [12948c] | 313 |   class UnsignedIntsQuery : public Query {
 | 
|---|
 | 314 |   public:
 | 
|---|
| [f10b0c] | 315 |     UnsignedIntsQuery(Parameter<std::vector<unsigned int> > &, std::string title, std::string _description = "");
 | 
|---|
| [12948c] | 316 |     virtual ~UnsignedIntsQuery();
 | 
|---|
 | 317 |     virtual bool handle()=0;
 | 
|---|
 | 318 |     virtual void setResult();
 | 
|---|
 | 319 |   protected:
 | 
|---|
| [9d5531] | 320 |     unsigned int temp_element;
 | 
|---|
 | 321 |     std::vector<unsigned int> temp;
 | 
|---|
 | 322 |     Parameter<std::vector<unsigned int> > ¶m;
 | 
|---|
| [12948c] | 323 |   };
 | 
|---|
 | 324 | 
 | 
|---|
| [2ededc2] | 325 |   class DoubleQuery : public Query {
 | 
|---|
 | 326 |   public:
 | 
|---|
| [f10b0c] | 327 |     DoubleQuery(Parameter<double> &, std::string title, std::string _description = "");
 | 
|---|
| [5a7243] | 328 |     virtual ~DoubleQuery();
 | 
|---|
| [2ededc2] | 329 |     virtual bool handle()=0;
 | 
|---|
 | 330 |     virtual void setResult();
 | 
|---|
 | 331 |   protected:
 | 
|---|
| [9d5531] | 332 |     double temp;
 | 
|---|
 | 333 |     Parameter<double> ¶m;
 | 
|---|
| [2ededc2] | 334 |   };
 | 
|---|
 | 335 | 
 | 
|---|
| [7cd6e7] | 336 |   class DoublesQuery : public Query {
 | 
|---|
 | 337 |   public:
 | 
|---|
| [f10b0c] | 338 |     DoublesQuery(Parameter<std::vector<double> > &, std::string title, std::string _description = "");
 | 
|---|
| [7cd6e7] | 339 |     virtual ~DoublesQuery();
 | 
|---|
 | 340 |     virtual bool handle()=0;
 | 
|---|
 | 341 |     virtual void setResult();
 | 
|---|
 | 342 |   protected:
 | 
|---|
| [9d5531] | 343 |     double temp_element;
 | 
|---|
 | 344 |     std::vector<double> temp;
 | 
|---|
 | 345 |     Parameter<std::vector<double> > ¶m;
 | 
|---|
| [7cd6e7] | 346 |   };
 | 
|---|
 | 347 | 
 | 
|---|
| [45f5d6] | 348 |   class StringQuery : public Query {
 | 
|---|
 | 349 |   public:
 | 
|---|
| [9d5531] | 350 |     StringQuery(Parameter<std::string> &_param, std::string title, std::string _description = "");
 | 
|---|
| [5a7243] | 351 |     virtual ~StringQuery();
 | 
|---|
| [45f5d6] | 352 |     virtual bool handle()=0;
 | 
|---|
 | 353 |     virtual void setResult();
 | 
|---|
 | 354 |   protected:
 | 
|---|
| [9d5531] | 355 |     std::string temp;
 | 
|---|
 | 356 |     Parameter<std::string> ¶m;
 | 
|---|
| [45f5d6] | 357 |   };
 | 
|---|
 | 358 | 
 | 
|---|
| [cd8e55] | 359 |   class StringsQuery : public Query {
 | 
|---|
 | 360 |   public:
 | 
|---|
| [9d5531] | 361 |     StringsQuery(Parameter<std::vector<std::string> > &_param, std::string title, std::string _description = "");
 | 
|---|
| [cd8e55] | 362 |     virtual ~StringsQuery();
 | 
|---|
 | 363 |     virtual bool handle()=0;
 | 
|---|
 | 364 |     virtual void setResult();
 | 
|---|
 | 365 |   protected:
 | 
|---|
| [9d5531] | 366 |     std::string temp_element;
 | 
|---|
 | 367 |     std::vector<std::string> temp;
 | 
|---|
 | 368 |     Parameter<std::vector<std::string> > ¶m;
 | 
|---|
| [cd8e55] | 369 |   };
 | 
|---|
 | 370 | 
 | 
|---|
| [7aa000] | 371 |   class MoleculeQuery : public Query {
 | 
|---|
 | 372 |   public:
 | 
|---|
| [9d5531] | 373 |     MoleculeQuery(Parameter<const molecule *> &_param, std::string title, std::string _description = "");
 | 
|---|
| [5a7243] | 374 |     virtual ~MoleculeQuery();
 | 
|---|
| [7aa000] | 375 |     virtual bool handle()=0;
 | 
|---|
 | 376 |     virtual void setResult();
 | 
|---|
 | 377 |   protected:
 | 
|---|
| [9d5531] | 378 |     const molecule * temp;
 | 
|---|
 | 379 |     Parameter<const molecule *> ¶m;
 | 
|---|
| [7aa000] | 380 |   };
 | 
|---|
 | 381 | 
 | 
|---|
| [7cd6e7] | 382 |   class MoleculesQuery : public Query {
 | 
|---|
 | 383 |   public:
 | 
|---|
| [9d5531] | 384 |     MoleculesQuery(Parameter<std::vector<const molecule *> > &_param, std::string title, std::string _description = "");
 | 
|---|
| [7cd6e7] | 385 |     virtual ~MoleculesQuery();
 | 
|---|
 | 386 |     virtual bool handle()=0;
 | 
|---|
 | 387 |     virtual void setResult();
 | 
|---|
 | 388 |   protected:
 | 
|---|
| [9d5531] | 389 |     const molecule * temp_element;
 | 
|---|
 | 390 |     std::vector<const molecule *> temp;
 | 
|---|
 | 391 |     Parameter<std::vector<const molecule *> > ¶m;
 | 
|---|
| [7cd6e7] | 392 |   };
 | 
|---|
 | 393 | 
 | 
|---|
| [97ebf8] | 394 |   class AtomQuery : public Query {
 | 
|---|
 | 395 |   public:
 | 
|---|
| [9d5531] | 396 |     AtomQuery(Parameter<const atom *> &_param, std::string title, std::string _description = "");
 | 
|---|
| [97ebf8] | 397 |     virtual ~AtomQuery();
 | 
|---|
 | 398 |     virtual bool handle()=0;
 | 
|---|
 | 399 |     virtual void setResult();
 | 
|---|
 | 400 |   protected:
 | 
|---|
| [9d5531] | 401 |     const atom *temp;
 | 
|---|
 | 402 |     Parameter<const atom *> ¶m;
 | 
|---|
| [97ebf8] | 403 |   };
 | 
|---|
 | 404 | 
 | 
|---|
| [7cd6e7] | 405 |   class AtomsQuery : public Query {
 | 
|---|
 | 406 |   public:
 | 
|---|
| [9d5531] | 407 |     AtomsQuery(Parameter<std::vector<const atom *> > &_param, std::string title, std::string _description = "");
 | 
|---|
| [7cd6e7] | 408 |     virtual ~AtomsQuery();
 | 
|---|
 | 409 |     virtual bool handle()=0;
 | 
|---|
 | 410 |     virtual void setResult();
 | 
|---|
 | 411 |   protected:
 | 
|---|
| [9d5531] | 412 |     const atom *temp_element;
 | 
|---|
 | 413 |     std::vector<const atom *> temp;
 | 
|---|
 | 414 |     Parameter<std::vector<const atom *> > ¶m;
 | 
|---|
| [7cd6e7] | 415 |   };
 | 
|---|
 | 416 | 
 | 
|---|
| [2ededc2] | 417 |   class VectorQuery : public Query {
 | 
|---|
 | 418 |   public:
 | 
|---|
| [9d5531] | 419 |       VectorQuery(Parameter<Vector> &_param, std::string title, std::string _description = "");
 | 
|---|
| [5a7243] | 420 |       virtual ~VectorQuery();
 | 
|---|
| [2ededc2] | 421 |       virtual bool handle()=0;
 | 
|---|
 | 422 |       virtual void setResult();
 | 
|---|
 | 423 |     protected:
 | 
|---|
| [9d5531] | 424 |       Vector temp;
 | 
|---|
 | 425 |       Parameter<Vector> ¶m;
 | 
|---|
| [7cd6e7] | 426 |   };
 | 
|---|
 | 427 | 
 | 
|---|
 | 428 |   class VectorsQuery : public Query {
 | 
|---|
 | 429 |   public:
 | 
|---|
| [9d5531] | 430 |       VectorsQuery(Parameter<std::vector<Vector> > &_param, std::string title, std::string _description = "");
 | 
|---|
| [7cd6e7] | 431 |       virtual ~VectorsQuery();
 | 
|---|
 | 432 |       virtual bool handle()=0;
 | 
|---|
 | 433 |       virtual void setResult();
 | 
|---|
 | 434 |     protected:
 | 
|---|
| [9d5531] | 435 |       Vector temp_element;
 | 
|---|
 | 436 |       std::vector<Vector> temp;
 | 
|---|
 | 437 |       Parameter<std::vector<Vector> > ¶m;
 | 
|---|
| [2ededc2] | 438 |   };
 | 
|---|
 | 439 | 
 | 
|---|
| [7d9416] | 440 |   class RealSpaceMatrixQuery : public Query {
 | 
|---|
| [97ebf8] | 441 |   public:
 | 
|---|
| [9d5531] | 442 |       RealSpaceMatrixQuery(Parameter<RealSpaceMatrix> &_param, std::string title, std::string _description = "");
 | 
|---|
| [7d9416] | 443 |       virtual ~RealSpaceMatrixQuery();
 | 
|---|
| [97ebf8] | 444 |       virtual bool handle()=0;
 | 
|---|
 | 445 |       virtual void setResult();
 | 
|---|
 | 446 |     protected:
 | 
|---|
| [9d5531] | 447 |       RealSpaceMatrix temp;
 | 
|---|
 | 448 |       Parameter<RealSpaceMatrix> ¶m;
 | 
|---|
| [97ebf8] | 449 |   };
 | 
|---|
 | 450 | 
 | 
|---|
| [5a7243] | 451 |   class ElementQuery : public Query {
 | 
|---|
 | 452 |   public:
 | 
|---|
| [9d5531] | 453 |     ElementQuery(Parameter<const element*> &_param, std::string title, std::string _description = "");
 | 
|---|
| [5a7243] | 454 |     virtual ~ElementQuery();
 | 
|---|
 | 455 |     virtual bool handle()=0;
 | 
|---|
 | 456 |     virtual void setResult();
 | 
|---|
 | 457 |   protected:
 | 
|---|
| [9d5531] | 458 |     const element *temp;
 | 
|---|
 | 459 |     Parameter<const element *> ¶m;
 | 
|---|
| [7cd6e7] | 460 |   };
 | 
|---|
 | 461 | 
 | 
|---|
 | 462 |   class ElementsQuery : public Query {
 | 
|---|
 | 463 |   public:
 | 
|---|
| [9d5531] | 464 |     ElementsQuery(Parameter<std::vector<const element *> > &_param, std::string title, std::string _description = "");
 | 
|---|
| [7cd6e7] | 465 |     virtual ~ElementsQuery();
 | 
|---|
 | 466 |     virtual bool handle()=0;
 | 
|---|
 | 467 |     virtual void setResult();
 | 
|---|
 | 468 |   protected:
 | 
|---|
| [9d5531] | 469 |     const element *temp_element;
 | 
|---|
 | 470 |     std::vector<const element *> temp;
 | 
|---|
 | 471 |     Parameter<std::vector<const element *> > ¶m;
 | 
|---|
| [5a7243] | 472 |   };
 | 
|---|
 | 473 | 
 | 
|---|
| [6f5dfe] | 474 |   class FileQuery : public Query {
 | 
|---|
 | 475 |   public:
 | 
|---|
| [9d5531] | 476 |     FileQuery(Parameter<boost::filesystem::path> &_param, std::string title, std::string _description = "");
 | 
|---|
| [6f5dfe] | 477 |     virtual ~FileQuery();
 | 
|---|
 | 478 |     virtual bool handle()=0;
 | 
|---|
 | 479 |     virtual void setResult();
 | 
|---|
 | 480 |   protected:
 | 
|---|
| [9d5531] | 481 |     boost::filesystem::path temp;
 | 
|---|
 | 482 |     Parameter<boost::filesystem::path> ¶m;
 | 
|---|
| [6f5dfe] | 483 |   };
 | 
|---|
 | 484 | 
 | 
|---|
| [2c5765] | 485 |   class FilesQuery : public Query {
 | 
|---|
 | 486 |   public:
 | 
|---|
| [9d5531] | 487 |     FilesQuery(Parameter<std::vector<boost::filesystem::path> > &_param, std::string title, std::string _description = "");
 | 
|---|
| [2c5765] | 488 |     virtual ~FilesQuery();
 | 
|---|
 | 489 |     virtual bool handle()=0;
 | 
|---|
 | 490 |     virtual void setResult();
 | 
|---|
 | 491 |   protected:
 | 
|---|
| [9d5531] | 492 |     boost::filesystem::path temp_element;
 | 
|---|
 | 493 |     std::vector<boost::filesystem::path> temp;
 | 
|---|
 | 494 |     Parameter<std::vector<boost::filesystem::path> > ¶m;
 | 
|---|
| [2c5765] | 495 |   };
 | 
|---|
 | 496 | 
 | 
|---|
| [0275ad] | 497 |   class RandomNumberDistribution_ParametersQuery : public Query {
 | 
|---|
 | 498 |   public:
 | 
|---|
| [9d5531] | 499 |     RandomNumberDistribution_ParametersQuery(Parameter<RandomNumberDistribution_Parameters> &_param, std::string title, std::string _description = "");
 | 
|---|
| [0275ad] | 500 |     virtual ~RandomNumberDistribution_ParametersQuery();
 | 
|---|
 | 501 |     virtual bool handle()=0;
 | 
|---|
 | 502 |     virtual void setResult();
 | 
|---|
 | 503 |   protected:
 | 
|---|
| [9d5531] | 504 |     RandomNumberDistribution_Parameters temp;
 | 
|---|
 | 505 |     Parameter<RandomNumberDistribution_Parameters> ¶m;
 | 
|---|
| [0275ad] | 506 |   };
 | 
|---|
 | 507 | 
 | 
|---|
| [45f5d6] | 508 | void registerQuery(Query* query);
 | 
|---|
 | 509 | 
 | 
|---|
 | 510 | private:
 | 
|---|
 | 511 |   std::list<Query*> queries;
 | 
|---|
| [f5a86a] | 512 | 
 | 
|---|
 | 513 | };
 | 
|---|
 | 514 | 
 | 
|---|
| [a2ab15] | 515 | 
 | 
|---|
| [f5a86a] | 516 | #endif /* DIALOG_HPP_ */
 | 
|---|