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