iLand
expressionwrapper.h
Go to the documentation of this file.
1/********************************************************************************************
2** iLand - an individual based forest landscape and disturbance model
3** http://iland-model.org
4** Copyright (C) 2009- Werner Rammer, Rupert Seidl
5**
6** This program is free software: you can redistribute it and/or modify
7** it under the terms of the GNU General Public License as published by
8** the Free Software Foundation, either version 3 of the License, or
9** (at your option) any later version.
10**
11** This program is distributed in the hope that it will be useful,
12** but WITHOUT ANY WARRANTY; without even the implied warranty of
13** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14** GNU General Public License for more details.
15**
16** You should have received a copy of the GNU General Public License
17** along with this program. If not, see <http://www.gnu.org/licenses/>.
18********************************************************************************************/
19
20#ifndef EXPRESSIONWRAPPER_H
21#define EXPRESSIONWRAPPER_H
22#include <QtCore/QString>
27{
28public:
30 virtual ~ExpressionWrapper() {}
31 virtual const QStringList getVariablesList();
32 virtual double value(const int variableIndex);
33 virtual double valueByName(const QString &variableName);
34 virtual int variableIndex(const QString &variableName);
35};
36
40class Tree;
42{
43public:
44 TreeWrapper() : mTree(nullptr) {}
45 TreeWrapper(const Tree* tree) : mTree(tree) {}
46 void setTree(const Tree* tree) { mTree = tree; }
47 virtual const QStringList getVariablesList();
48 virtual double value(const int variableIndex);
49
50private:
51 const Tree *mTree;
52};
53
56class ResourceUnit;
58{
59public:
60 RUWrapper() : mRU(nullptr) {}
61 RUWrapper(const ResourceUnit* resourceUnit) : mRU(resourceUnit) {}
62 void setResourceUnit(const ResourceUnit* resourceUnit) { mRU = resourceUnit; }
63 virtual const QStringList getVariablesList();
64 virtual double value(const int variableIndex);
65
66private:
67 const ResourceUnit *mRU;
68};
69
72struct SaplingTree;
74{
75public:
76 SaplingWrapper() : mSapling(nullptr) {}
77 SaplingWrapper(const SaplingTree* saplingTree, const ResourceUnit *ru) : mSapling(saplingTree), mRU(ru) {}
78 void setSaplingTree(const SaplingTree* saplingTree, const ResourceUnit *ru) { mSapling = saplingTree; mRU=ru; }
79 virtual const QStringList getVariablesList();
80 virtual double value(const int variableIndex);
81
82private:
83 const SaplingTree *mSapling;
84 const ResourceUnit *mRU;
85};
86
87#endif // EXPRESSIONWRAPPER_H
ExpressionWrapper is the base class for exposing C++ elements to the built-in Expression engine.
Definition: expressionwrapper.h:27
virtual double valueByName(const QString &variableName)
Definition: expressionwrapper.cpp:71
virtual ~ExpressionWrapper()
Definition: expressionwrapper.h:30
virtual const QStringList getVariablesList()
Definition: expressionwrapper.cpp:52
virtual int variableIndex(const QString &variableName)
Definition: expressionwrapper.cpp:66
virtual double value(const int variableIndex)
Definition: expressionwrapper.cpp:57
ExpressionWrapper()
Definition: expressionwrapper.cpp:45
Definition: expressionwrapper.h:58
RUWrapper()
Definition: expressionwrapper.h:60
virtual const QStringList getVariablesList()
Definition: expressionwrapper.cpp:146
RUWrapper(const ResourceUnit *resourceUnit)
Definition: expressionwrapper.h:61
virtual double value(const int variableIndex)
Definition: expressionwrapper.cpp:152
void setResourceUnit(const ResourceUnit *resourceUnit)
Definition: expressionwrapper.h:62
ResourceUnit is the spatial unit that encapsulates a forest stand and links to several environmental ...
Definition: resourceunit.h:49
Definition: expressionwrapper.h:74
void setSaplingTree(const SaplingTree *saplingTree, const ResourceUnit *ru)
Definition: expressionwrapper.h:78
SaplingWrapper()
Definition: expressionwrapper.h:76
virtual double value(const int variableIndex)
Definition: expressionwrapper.cpp:208
virtual const QStringList getVariablesList()
Definition: expressionwrapper.cpp:203
SaplingWrapper(const SaplingTree *saplingTree, const ResourceUnit *ru)
Definition: expressionwrapper.h:77
A tree is the basic simulation entity of iLand and represents a single tree.
Definition: tree.h:44
Definition: expressionwrapper.h:42
TreeWrapper(const Tree *tree)
Definition: expressionwrapper.h:45
virtual double value(const int variableIndex)
Definition: expressionwrapper.cpp:94
TreeWrapper()
Definition: expressionwrapper.h:44
void setTree(const Tree *tree)
Definition: expressionwrapper.h:46
virtual const QStringList getVariablesList()
Definition: expressionwrapper.cpp:88
Definition: saplings.h:29