FFSM++ 1.1.0
French Forest Sector Model ++
Loading...
Searching...
No Matches
Sandbox.h
Go to the documentation of this file.
1/***************************************************************************
2 * Copyright (C) 2015 by Laboratoire d'Economie Forestière *
3 * http://ffsm-project.org *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 3 of the License, or *
8 * (at your option) any later version, given the compliance with the *
9 * exceptions listed in the file COPYING that is distribued together *
10 * with this file. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the *
19 * Free Software Foundation, Inc., *
20 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21 ***************************************************************************/
22#ifndef SANDBOX_H
23#define SANDBOX_H
24
25#include <QtCore>
26#include <QThread>
27#include <QString>
28
29#include "BaseClass.h"
30
31
32/**
33This is a test class used when I need to test some C++ or other library functions. It can safelly be removed by the project if needed.
34
35 @author Antonello Lobianco <antonello@regmas.org>
36*/
37
38struct TestStructure;
39
40class Sandbox : public BaseClass {
41
42public:
43 Sandbox(ThreadManager* MTHREAD_h);
44 Sandbox();
45 ~Sandbox();
46
47 template <class T> T getSetting(string name_h, int type);
48 template <class T> vector <T> getVectorSetting(string name_h, int type);
49 template <class T> T test2(const std::string& s); // e.g. int x = test<int>("123");
50 void printAString(string what){cout << "You printed: "<< what << endl;};
51 vector <TestStructure*> getTestStructure();
52 void testThreads();
53 void basicTest(); ///< Simple tests that doesn't require anything else (are encapsulated) and so they can be run at the beginning of the program. Normally empty
54 void fullTest(); ///< Tests that require a full sandbox object including MTHREAD. Normally empty
55 void testIpopt();
56 int testAdolc();
57 void testPartMatching(); ///< How to partial matching the key of a map
58 void testPartMatching2(); ///< How to partial matching the key of a map
59
60private:
61 vector <TestStructure> testVector;
62 // How to partial matching the key of a map
63// map<string, string>::iterator FindPrefix(const map<string, string>& map, const string& search_for);
64 void testSearchMap(const map<string, string>& map, const string& search_for);
65 void testSearchMap2(const map<string, string>& map_h, const string& search_for);
66};
67
69
70 int i;
71 string s;
73 double random;
74};
75
76
77class testThread : public QThread {
78 Q_OBJECT
79
80public:
81 testThread();
82 void assignJob(TestStructure* agent_h);
83
84protected:
85 void run();
86
87private:
89};
90
91
92
93#endif
This file is the header of BaseClass and it is included by ALL compiled code.
Base class for the regmas application.
Definition BaseClass.h:239
vector< T > getVectorSetting(string name_h, int type)
void fullTest()
Tests that require a full sandbox object including MTHREAD. Normally empty.
Definition Sandbox.cpp:600
void testThreads()
Definition Sandbox.cpp:1596
T getSetting(string name_h, int type)
Definition Sandbox.cpp:1529
vector< TestStructure > testVector
Definition Sandbox.h:61
int testAdolc()
Definition Sandbox.cpp:1769
void testPartMatching2()
How to partial matching the key of a map.
Definition Sandbox.cpp:1881
void printAString(string what)
Definition Sandbox.h:50
T test2(const std::string &s)
Definition Sandbox.cpp:1574
void testSearchMap2(const map< string, string > &map_h, const string &search_for)
Definition Sandbox.cpp:1867
Sandbox()
Definition Sandbox.cpp:85
void basicTest()
Simple tests that doesn't require anything else (are encapsulated) and so they can be run at the begi...
Definition Sandbox.cpp:132
void testPartMatching()
How to partial matching the key of a map.
Definition Sandbox.cpp:1844
~Sandbox()
Definition Sandbox.cpp:90
void testSearchMap(const map< string, string > &map, const string &search_for)
Definition Sandbox.cpp:1829
vector< TestStructure * > getTestStructure()
Definition Sandbox.cpp:1583
void testIpopt()
Definition Sandbox.cpp:1718
Thread manager. Responsable to manage the main thread and "speak" with the GUI.
void run()
Definition Sandbox.cpp:1697
volatile TestStructure * agent
Definition Sandbox.h:88
void assignJob(TestStructure *agent_h)
Definition Sandbox.cpp:1712
string s
Definition Sandbox.h:71
double cachedOffer
Definition Sandbox.h:72
double random
Definition Sandbox.h:73