Sandbox.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2007-2008 by Antonello Lobianco                              *
00003  *   antonello@regmas.org                                                  *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Library General Public License as       *
00007  *   published by the Free Software Foundation; either version 3 of the    *
00008  *   License, or (at your option) any later version.                       *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU Library General Public     *
00016  *   License along with this program; if not, write to the                 *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef SANDBOX_H
00021 #define SANDBOX_H
00022 
00023 #include <QtCore>
00024 #include <QThread>
00025 #include <QString>
00026 
00027 #include "BaseRegmas.h"
00028 
00029 
00036 struct TestStructure;
00037 
00038 class Sandbox : public BaseRegmas {
00039 
00040 public:
00041                              Sandbox(ThreadManager* MTHREAD_h);
00042                             ~Sandbox();
00043     void                     test();
00044     template <class T> T     getSetting(string name_h, int type);
00045     template <class T> vector <T> getVectorSetting(string name_h, int type);
00046     template <class T> T      test2(const std::string& s); // e.g. int x = test<int>("123");
00047     void                     printAString(string what){cout << "You printed: "<< what << endl;};
00048     vector <TestStructure*>  getTestStructure();
00049     void                     testThreads();
00050 
00051 private:
00052     vector <TestStructure>  testVector;
00053     
00054 
00055 };
00056 
00057 struct TestStructure {
00058 
00059     int                                        i;
00060     string                                     s;
00061     double                           cachedOffer;
00062     double                                random;
00063 };
00064 
00065 
00066 class testThread : public QThread {
00067     Q_OBJECT
00068 
00069 public:
00070     testThread();
00071     void                assignJob(TestStructure* agent_h);
00072 
00073 protected:
00074     void run();
00075 
00076 private:
00077     volatile TestStructure* agent;
00078 };
00079 
00080 
00081 
00082 #endif