| 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 |  | 
|---|
| 11 | // include config.h | 
|---|
| 12 | #ifdef HAVE_CONFIG_H | 
|---|
| 13 | #include <config.h> | 
|---|
| 14 | #endif | 
|---|
| 15 |  | 
|---|
| 16 |  | 
|---|
| 17 | #include<string> | 
|---|
| 18 | #include<list> | 
|---|
| 19 | #include<vector> | 
|---|
| 20 |  | 
|---|
| 21 | #include <boost/filesystem.hpp> | 
|---|
| 22 | #include "Box.hpp" | 
|---|
| 23 | #include "LinearAlgebra/Vector.hpp" | 
|---|
| 24 | #include "RandomNumbers/RandomNumberDistribution_Parameters.hpp" | 
|---|
| 25 |  | 
|---|
| 26 | class atom; | 
|---|
| 27 | class Box; | 
|---|
| 28 | class element; | 
|---|
| 29 | class molecule; | 
|---|
| 30 |  | 
|---|
| 31 |  | 
|---|
| 32 | /** Dialog is one of the two main classes of the UIFactory base class. | 
|---|
| 33 | * | 
|---|
| 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. | 
|---|
| 36 | * | 
|---|
| 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. | 
|---|
| 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 | 
|---|
| 140 | *   -# add empty definition DummyDialog::query...() to the stub for Action unittests in DummUI.hpp. | 
|---|
| 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. | 
|---|
| 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. | 
|---|
| 149 | * | 
|---|
| 150 | */ | 
|---|
| 151 | class Dialog | 
|---|
| 152 | { | 
|---|
| 153 | public: | 
|---|
| 154 | Dialog(); | 
|---|
| 155 | virtual ~Dialog(); | 
|---|
| 156 |  | 
|---|
| 157 | template <class T> void query(const char *, std::string = ""); | 
|---|
| 158 |  | 
|---|
| 159 | virtual void queryEmpty(const char *, std::string = "")=0; | 
|---|
| 160 | virtual void queryBoolean(const char *, std::string = "")=0; | 
|---|
| 161 | virtual void queryInt(const char *, std::string = "")=0; | 
|---|
| 162 | virtual void queryInts(const char *, std::string = "")=0; | 
|---|
| 163 | virtual void queryUnsignedInt(const char *, std::string = "")=0; | 
|---|
| 164 | virtual void queryUnsignedInts(const char *, std::string = "")=0; | 
|---|
| 165 | virtual void queryDouble(const char*, std::string = "")=0; | 
|---|
| 166 | virtual void queryDoubles(const char*, std::string = "")=0; | 
|---|
| 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; | 
|---|
| 170 | virtual void queryAtoms(const char*,std::string = "")=0; | 
|---|
| 171 | virtual void queryMolecule(const char*, std::string = "")=0; | 
|---|
| 172 | virtual void queryMolecules(const char*, std::string = "")=0; | 
|---|
| 173 | virtual void queryVector(const char*,bool, std::string = "")=0; | 
|---|
| 174 | virtual void queryVectors(const char*,bool, std::string = "")=0; | 
|---|
| 175 | virtual void queryBox(const char*, std::string = "")=0; | 
|---|
| 176 | virtual void queryElement(const char*, std::string = "")=0; | 
|---|
| 177 | virtual void queryElements(const char*, std::string = "")=0; | 
|---|
| 178 | virtual void queryFile(const char*, std::string = "")=0; | 
|---|
| 179 | virtual void queryRandomNumberDistribution_Parameters(const char*, std::string = "")=0; | 
|---|
| 180 |  | 
|---|
| 181 | virtual bool display(); | 
|---|
| 182 |  | 
|---|
| 183 | virtual bool checkAll(); | 
|---|
| 184 | virtual void setAll(); | 
|---|
| 185 |  | 
|---|
| 186 | virtual bool hasQueries(); | 
|---|
| 187 |  | 
|---|
| 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 | 
|---|
| 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 |  | 
|---|
| 199 | /** Base class for all queries. | 
|---|
| 200 | * | 
|---|
| 201 | * | 
|---|
| 202 | * <h1>How to add another query?</h1> | 
|---|
| 203 | * | 
|---|
| 204 | * Let's say  we want to query for a type called \a Value. | 
|---|
| 205 | * | 
|---|
| 206 | * Then, we do the following: | 
|---|
| 207 | *  -# Add a class ValueQuery inside class Dialog, the class contains | 
|---|
| 208 | *    -# constructor/destructor (latter virtual! because of derived class) | 
|---|
| 209 | *    -# virtual bool handle() and virtual void setResult() | 
|---|
| 210 | *    -# a protected member tmp of type Value (NOTE: herein the result is stored) | 
|---|
| 211 | *    -# if temporaries for conversion are needed put them in here | 
|---|
| 212 | *  -# add a function queryValue | 
|---|
| 213 | *  -# now, for each of the GUIs we basically have to repeat the above, i.e. | 
|---|
| 214 | *     add the class and the function that implement the virtual ones above. | 
|---|
| 215 | *    -# QT: an extra class called ValueQtQueryPipe that actually handles | 
|---|
| 216 | *       showing dialogs to obtain the value and placing it into the \a tmp | 
|---|
| 217 | *       variable (via a given pointer to it as reference). handle() will | 
|---|
| 218 | *       simply return true. This is needed because of a restriction of Qt4: | 
|---|
| 219 | *       its meta-object-compiler does not like nested classes. | 
|---|
| 220 | *    -# CommandLine: nothing special, handle() imports value from \a | 
|---|
| 221 | *       CommandLineParser and sets the tmp variable. | 
|---|
| 222 | *    -# Text: nothing special, handle() queries the user and sets the tmp | 
|---|
| 223 | *       variable | 
|---|
| 224 | */ | 
|---|
| 225 | class Query { | 
|---|
| 226 | friend class Dialog; | 
|---|
| 227 | public: | 
|---|
| 228 | Query(std::string _title, std::string _description = ""); | 
|---|
| 229 | virtual ~Query(); | 
|---|
| 230 | virtual bool handle()=0; | 
|---|
| 231 | virtual void setResult()=0; | 
|---|
| 232 | protected: | 
|---|
| 233 | const std::string getTitle() const; | 
|---|
| 234 | const std::string getDescription() const; | 
|---|
| 235 | private: | 
|---|
| 236 | std::string title;  //!< short title of the query | 
|---|
| 237 | std::string description; //!< longer description for tooltips or for help | 
|---|
| 238 | }; | 
|---|
| 239 |  | 
|---|
| 240 | // Empty Query is just meant for showing text, such as version, help, initial message or alike | 
|---|
| 241 | class EmptyQuery : public Query { | 
|---|
| 242 | public: | 
|---|
| 243 | EmptyQuery(std::string title, std::string _description = ""); | 
|---|
| 244 | virtual ~EmptyQuery(); | 
|---|
| 245 | virtual bool handle()=0; | 
|---|
| 246 | virtual void setResult(); | 
|---|
| 247 | }; | 
|---|
| 248 |  | 
|---|
| 249 | //Specialized classes for certain types. GUI-Types are not specialized at this time | 
|---|
| 250 | class BooleanQuery : public Query { | 
|---|
| 251 | public: | 
|---|
| 252 | BooleanQuery(std::string title, std::string _description = ""); | 
|---|
| 253 | virtual ~BooleanQuery(); | 
|---|
| 254 | virtual bool handle()=0; | 
|---|
| 255 | virtual void setResult(); | 
|---|
| 256 | protected: | 
|---|
| 257 | bool tmp; | 
|---|
| 258 | }; | 
|---|
| 259 |  | 
|---|
| 260 | class IntQuery : public Query { | 
|---|
| 261 | public: | 
|---|
| 262 | IntQuery(std::string title, std::string _description = ""); | 
|---|
| 263 | virtual ~IntQuery(); | 
|---|
| 264 | virtual bool handle()=0; | 
|---|
| 265 | virtual void setResult(); | 
|---|
| 266 | protected: | 
|---|
| 267 | int tmp; | 
|---|
| 268 | }; | 
|---|
| 269 |  | 
|---|
| 270 | class IntsQuery : public Query { | 
|---|
| 271 | public: | 
|---|
| 272 | IntsQuery(std::string title, std::string _description = ""); | 
|---|
| 273 | virtual ~IntsQuery(); | 
|---|
| 274 | virtual bool handle()=0; | 
|---|
| 275 | virtual void setResult(); | 
|---|
| 276 | protected: | 
|---|
| 277 | int temp; | 
|---|
| 278 | std::vector<int> tmp; | 
|---|
| 279 | }; | 
|---|
| 280 |  | 
|---|
| 281 | class UnsignedIntQuery : public Query { | 
|---|
| 282 | public: | 
|---|
| 283 | UnsignedIntQuery(std::string title, std::string _description = ""); | 
|---|
| 284 | virtual ~UnsignedIntQuery(); | 
|---|
| 285 | virtual bool handle()=0; | 
|---|
| 286 | virtual void setResult(); | 
|---|
| 287 | protected: | 
|---|
| 288 | unsigned int tmp; | 
|---|
| 289 | }; | 
|---|
| 290 |  | 
|---|
| 291 | class UnsignedIntsQuery : public Query { | 
|---|
| 292 | public: | 
|---|
| 293 | UnsignedIntsQuery(std::string title, std::string _description = ""); | 
|---|
| 294 | virtual ~UnsignedIntsQuery(); | 
|---|
| 295 | virtual bool handle()=0; | 
|---|
| 296 | virtual void setResult(); | 
|---|
| 297 | protected: | 
|---|
| 298 | unsigned int temp; | 
|---|
| 299 | std::vector<unsigned int> tmp; | 
|---|
| 300 | }; | 
|---|
| 301 |  | 
|---|
| 302 | class DoubleQuery : public Query { | 
|---|
| 303 | public: | 
|---|
| 304 | DoubleQuery(std::string title, std::string _description = ""); | 
|---|
| 305 | virtual ~DoubleQuery(); | 
|---|
| 306 | virtual bool handle()=0; | 
|---|
| 307 | virtual void setResult(); | 
|---|
| 308 | protected: | 
|---|
| 309 | double tmp; | 
|---|
| 310 | }; | 
|---|
| 311 |  | 
|---|
| 312 | class DoublesQuery : public Query { | 
|---|
| 313 | public: | 
|---|
| 314 | DoublesQuery(std::string title, std::string _description = ""); | 
|---|
| 315 | virtual ~DoublesQuery(); | 
|---|
| 316 | virtual bool handle()=0; | 
|---|
| 317 | virtual void setResult(); | 
|---|
| 318 | protected: | 
|---|
| 319 | double temp; | 
|---|
| 320 | std::vector<double> tmp; | 
|---|
| 321 | }; | 
|---|
| 322 |  | 
|---|
| 323 | class StringQuery : public Query { | 
|---|
| 324 | public: | 
|---|
| 325 | StringQuery(std::string title, std::string _description = ""); | 
|---|
| 326 | virtual ~StringQuery(); | 
|---|
| 327 | virtual bool handle()=0; | 
|---|
| 328 | virtual void setResult(); | 
|---|
| 329 | protected: | 
|---|
| 330 | std::string tmp; | 
|---|
| 331 | }; | 
|---|
| 332 |  | 
|---|
| 333 | class StringsQuery : public Query { | 
|---|
| 334 | public: | 
|---|
| 335 | StringsQuery(std::string title, std::string _description = ""); | 
|---|
| 336 | virtual ~StringsQuery(); | 
|---|
| 337 | virtual bool handle()=0; | 
|---|
| 338 | virtual void setResult(); | 
|---|
| 339 | protected: | 
|---|
| 340 | std::string temp; | 
|---|
| 341 | std::vector<std::string> tmp; | 
|---|
| 342 | }; | 
|---|
| 343 |  | 
|---|
| 344 | class MoleculeQuery : public Query { | 
|---|
| 345 | public: | 
|---|
| 346 | MoleculeQuery(std::string title, std::string _description = ""); | 
|---|
| 347 | virtual ~MoleculeQuery(); | 
|---|
| 348 | virtual bool handle()=0; | 
|---|
| 349 | virtual void setResult(); | 
|---|
| 350 | protected: | 
|---|
| 351 | const molecule *tmp; | 
|---|
| 352 | }; | 
|---|
| 353 |  | 
|---|
| 354 | class MoleculesQuery : public Query { | 
|---|
| 355 | public: | 
|---|
| 356 | MoleculesQuery(std::string title, std::string _description = ""); | 
|---|
| 357 | virtual ~MoleculesQuery(); | 
|---|
| 358 | virtual bool handle()=0; | 
|---|
| 359 | virtual void setResult(); | 
|---|
| 360 | protected: | 
|---|
| 361 | const molecule * temp; | 
|---|
| 362 | std::vector<const molecule *> tmp; | 
|---|
| 363 | }; | 
|---|
| 364 |  | 
|---|
| 365 | class AtomQuery : public Query { | 
|---|
| 366 | public: | 
|---|
| 367 | AtomQuery(std::string title, std::string _description = ""); | 
|---|
| 368 | virtual ~AtomQuery(); | 
|---|
| 369 | virtual bool handle()=0; | 
|---|
| 370 | virtual void setResult(); | 
|---|
| 371 | protected: | 
|---|
| 372 | const atom *tmp; | 
|---|
| 373 | }; | 
|---|
| 374 |  | 
|---|
| 375 | class AtomsQuery : public Query { | 
|---|
| 376 | public: | 
|---|
| 377 | AtomsQuery(std::string title, std::string _description = ""); | 
|---|
| 378 | virtual ~AtomsQuery(); | 
|---|
| 379 | virtual bool handle()=0; | 
|---|
| 380 | virtual void setResult(); | 
|---|
| 381 | protected: | 
|---|
| 382 | const atom *temp; | 
|---|
| 383 | std::vector<const atom *> tmp; | 
|---|
| 384 | }; | 
|---|
| 385 |  | 
|---|
| 386 | class VectorQuery : public Query { | 
|---|
| 387 | public: | 
|---|
| 388 | VectorQuery(std::string title,bool _check, std::string _description = ""); | 
|---|
| 389 | virtual ~VectorQuery(); | 
|---|
| 390 | virtual bool handle()=0; | 
|---|
| 391 | virtual void setResult(); | 
|---|
| 392 | protected: | 
|---|
| 393 | Vector tmp; | 
|---|
| 394 | bool check; | 
|---|
| 395 | }; | 
|---|
| 396 |  | 
|---|
| 397 | class VectorsQuery : public Query { | 
|---|
| 398 | public: | 
|---|
| 399 | VectorsQuery(std::string title,bool _check, std::string _description = ""); | 
|---|
| 400 | virtual ~VectorsQuery(); | 
|---|
| 401 | virtual bool handle()=0; | 
|---|
| 402 | virtual void setResult(); | 
|---|
| 403 | protected: | 
|---|
| 404 | Vector temp; | 
|---|
| 405 | std::vector<Vector> tmp; | 
|---|
| 406 | bool check; | 
|---|
| 407 | }; | 
|---|
| 408 |  | 
|---|
| 409 | class BoxQuery : public Query { | 
|---|
| 410 | public: | 
|---|
| 411 | BoxQuery(std::string title, std::string _description = ""); | 
|---|
| 412 | virtual ~BoxQuery(); | 
|---|
| 413 | virtual bool handle()=0; | 
|---|
| 414 | virtual void setResult(); | 
|---|
| 415 | protected: | 
|---|
| 416 | Box tmp; | 
|---|
| 417 | }; | 
|---|
| 418 |  | 
|---|
| 419 | class ElementQuery : public Query { | 
|---|
| 420 | public: | 
|---|
| 421 | ElementQuery(std::string title, std::string _description = ""); | 
|---|
| 422 | virtual ~ElementQuery(); | 
|---|
| 423 | virtual bool handle()=0; | 
|---|
| 424 | virtual void setResult(); | 
|---|
| 425 | protected: | 
|---|
| 426 | const element * tmp; | 
|---|
| 427 | }; | 
|---|
| 428 |  | 
|---|
| 429 | class ElementsQuery : public Query { | 
|---|
| 430 | public: | 
|---|
| 431 | ElementsQuery(std::string title, std::string _description = ""); | 
|---|
| 432 | virtual ~ElementsQuery(); | 
|---|
| 433 | virtual bool handle()=0; | 
|---|
| 434 | virtual void setResult(); | 
|---|
| 435 | protected: | 
|---|
| 436 | const element *temp; | 
|---|
| 437 | std::vector<const element *> tmp; | 
|---|
| 438 | }; | 
|---|
| 439 |  | 
|---|
| 440 | class FileQuery : public Query { | 
|---|
| 441 | public: | 
|---|
| 442 | FileQuery(std::string title, std::string _description = ""); | 
|---|
| 443 | virtual ~FileQuery(); | 
|---|
| 444 | virtual bool handle()=0; | 
|---|
| 445 | virtual void setResult(); | 
|---|
| 446 | protected: | 
|---|
| 447 | boost::filesystem::path tmp; | 
|---|
| 448 | }; | 
|---|
| 449 |  | 
|---|
| 450 | class RandomNumberDistribution_ParametersQuery : public Query { | 
|---|
| 451 | public: | 
|---|
| 452 | RandomNumberDistribution_ParametersQuery(std::string title, std::string _description = ""); | 
|---|
| 453 | virtual ~RandomNumberDistribution_ParametersQuery(); | 
|---|
| 454 | virtual bool handle()=0; | 
|---|
| 455 | virtual void setResult(); | 
|---|
| 456 | protected: | 
|---|
| 457 | RandomNumberDistribution_Parameters tmp; | 
|---|
| 458 | }; | 
|---|
| 459 |  | 
|---|
| 460 | void registerQuery(Query* query); | 
|---|
| 461 |  | 
|---|
| 462 | private: | 
|---|
| 463 | std::list<Query*> queries; | 
|---|
| 464 |  | 
|---|
| 465 | }; | 
|---|
| 466 |  | 
|---|
| 467 |  | 
|---|
| 468 | #endif /* DIALOG_HPP_ */ | 
|---|