Loading [MathJax]/extensions/ams.js
ALMaSS  1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
YoungForest.h
Go to the documentation of this file.
1 //
2 // YoungForest.h
3 //
4 /*
5 
6 Copyright (c) 2003, National Environmental Research Institute, Denmark (NERI)
7 
8 All rights reserved.
9 
10 
11 Redistribution and use in source and binary forms, with or without
12 modification, are permitted provided that the following conditions are met:
13 
14 *) Redistributions of source code must retain the above copyright notice, this
15 list of conditions and the following disclaimer.
16 *) Redistributions in binary form must reproduce the above copyright notice,
17 this list of conditions and the following disclaimer in the documentation
18 and/or other materials provided with the distribution.
19 *) Neither the name of the NERI nor the names of its contributors
20 may be used to endorse or promote products derived from this software without
21 specific prior written permission.
22 
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 POSSIBILITY OF SUCH DAMAGE.
34 
35 */
36 
37 #ifndef YOUNGFOREST_H
38 #define YOUNGFOREST_H
39 
40 #define YOUNGFOREST_BASE 900
41 
42 typedef enum {
43  yf_start = 1, // Compulsory, start event must always be 1 (one).
48 
49 
50 
51 class YoungForestCrop: public Crop
52 {
53 public:
54  bool Do( Farm *a_farm, LE *a_field, FarmEvent *a_ev );
55  YoungForestCrop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape* a_L) : Crop(a_tov, a_toc, a_L)
56  {
59  }
61  const int elements = 2 + (yf_foobar - YOUNGFOREST_BASE);
63 
64  FarmManagementCategory catlist[elements] =
65  {
66  fmc_Others, // zero element unused but must be here
67  fmc_Others, // yf_start = 1, // Compulsory, start event must always be 1 (one).
68  fmc_Others, // yf_do_nothing_start = YOUNGFOREST_BASE,
69  fmc_Others // yf_do_nothing_stop,
70  // No foobar entry
71  };
72  // Iterate over the catlist elements and copy them to vector
73  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
74  }
75 };
76 
77 #endif // YOUNGFOREST_H
LE::GetMDates
int GetMDates(int a, int b)
Definition: Elements.h:405
YoungForestCrop::Do
bool Do(Farm *a_farm, LE *a_field, FarmEvent *a_ev)
Definition: YoungForest.cpp:32
LE::SetMDates
void SetMDates(int a, int b, int c)
Definition: Elements.h:406
FarmEvent
A struct to hold the information required to trigger a farm event.
Definition: Farm.h:372
LE::ClearManagementActionSum
void ClearManagementActionSum()
clears the management action counters
Definition: Elements.h:247
Calendar::GetYearNumber
int GetYearNumber(void)
Definition: Calendar.h:72
YoungForestCrop
Definition: YoungForest.h:51
FarmEvent::m_first_year
bool m_first_year
Definition: Farm.h:386
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
yf_do_nothing_stop
Definition: YoungForest.h:45
Farm::GetType
TTypesOfFarm GetType(void)
Definition: Farm.h:956
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
Crop::m_first_date
int m_first_date
Definition: Farm.h:501
FarmEvent::m_startday
int m_startday
Definition: Farm.h:385
Crop
The base class for all crops.
Definition: Farm.h:495
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
YoungForestToDo
YoungForestToDo
Definition: YoungForest.h:42
YoungForestCrop::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: YoungForest.h:60
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:142
Calendar::Date
long Date(void)
Definition: Calendar.h:57
yf_start
Definition: YoungForest.h:43
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
yf_do_nothing_start
Definition: YoungForest.h:44
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
yf_foobar
Definition: YoungForest.h:46
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
Crop::m_farm
Farm * m_farm
Definition: Farm.h:498
Crop::m_field
LE * m_field
Definition: Farm.h:499
Crop::m_ManagementCategories
vector< FarmManagementCategory > m_ManagementCategories
Holds the translation between the farm operation enum for each crop and the farm management category ...
Definition: Farm.h:530
FarmEvent::m_todo
int m_todo
Definition: Farm.h:388
TTypesOfCrops
TTypesOfCrops
Definition: LandscapeFarmingEnums.h:781
tof_OptimisingFarm
Definition: LandscapeFarmingEnums.h:696
LE
Definition: Elements.h:86
Crop::m_last_date
int m_last_date
Definition: Farm.h:503
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
Farm
The base class for all farm types.
Definition: Farm.h:755
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
YOUNGFOREST_BASE
#define YOUNGFOREST_BASE
Definition: YoungForest.h:40
YoungForestCrop::YoungForestCrop
YoungForestCrop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: YoungForest.h:55
LE::SetMConstants
void SetMConstants(int a, int c)
Definition: Elements.h:408
Crop::ChooseNextCrop
void ChooseNextCrop(int a_no_dates)
Chooses the next crop to grow in a field.
Definition: Farm.cpp:756
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
WARN_BUG
Definition: MapErrorMsg.h:34
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001