Rev 1117 | Rev 1217 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | |||
677 | werner | 2 | /******************************************************************************************** |
3 | ** iLand - an individual based forest landscape and disturbance model |
||
4 | ** http://iland.boku.ac.at |
||
5 | ** Copyright (C) 2009- Werner Rammer, Rupert Seidl |
||
6 | ** |
||
7 | ** This program is free software: you can redistribute it and/or modify |
||
8 | ** it under the terms of the GNU General Public License as published by |
||
9 | ** the Free Software Foundation, either version 3 of the License, or |
||
10 | ** (at your option) any later version. |
||
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, see <http://www.gnu.org/licenses/>. |
||
19 | ********************************************************************************************/ |
||
20 | #ifndef SNAPSHOT_H |
||
21 | #define SNAPSHOT_H |
||
22 | |||
23 | #include <QString> |
||
1045 | werner | 24 | #include <QHash> |
1213 | werner | 25 | /** @class Snapshot provides a way to save/load the current state of the model to a database. |
26 | * A snapshot contains trees, saplings, snags and soil (carbon/nitrogen pools), i.e. a |
||
27 | * snapshot allows to replicate all state variables of a landscape system. |
||
28 | */ |
||
29 | class ResourceUnit; // forward |
||
30 | class MapGrid; // forward |
||
677 | werner | 31 | class Snapshot |
32 | { |
||
33 | public: |
||
34 | Snapshot(); |
||
35 | bool createSnapshot(const QString &file_name); |
||
36 | bool loadSnapshot(const QString &file_name); |
||
1213 | werner | 37 | // snapshot functions for single stands |
38 | /// save the trees/saplings from a single stand (given by 'stand_id' and 'stand_grid' to a database in 'file_name' |
||
39 | bool saveStandSnapshot(const int stand_id, const MapGrid *stand_grid, const QString &file_name); |
||
40 | /// load the trees/saplings from a single stand (given by 'stand_id' and 'stand_grid' from a database in 'file_name' |
||
41 | bool loadStandSnapshot(const int stand_id, const MapGrid *stand_grid, const QString &file_name); |
||
677 | werner | 42 | private: |
43 | bool openDatabase(const QString &file_name, const bool read); |
||
1213 | werner | 44 | bool openStandDatabase(const QString &file_name, bool read); |
677 | werner | 45 | void saveTrees(); |
46 | void saveSoil(); |
||
47 | void saveSnags(); |
||
695 | werner | 48 | void saveSaplings(); |
677 | werner | 49 | void loadTrees(); |
50 | void loadSoil(); |
||
51 | void loadSnags(); |
||
695 | werner | 52 | void loadSaplings(); |
1117 | werner | 53 | void loadSaplingsOld(); |
1045 | werner | 54 | QHash<int, ResourceUnit* > mRUHash; |
677 | werner | 55 | }; |
56 | |||
57 | #endif // SNAPSHOT_H |