File failed to load: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/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
OFirstYearDanger Class Reference

#include <OFirstYearDanger.h>

Inheritance diagram for OFirstYearDanger:
Crop

Public Member Functions

bool Do (Farm *a_farm, LE *a_field, FarmEvent *a_ev)
 
 OFirstYearDanger (TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
 
void SetUpFarmCategoryInformation ()
 
- Public Member Functions inherited from Crop
virtual ~Crop ()
 
 Crop (TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
 
int GetFirstDate (void)
 
void ChooseNextCrop (int a_no_dates)
 Chooses the next crop to grow in a field. More...
 
int GetCropClassification ()
 
void SetCropClassification (int a_classification)
 
void GetCropType (TTypesOfCrops a_toc)
 
TTypesOfCrops GetCropType ()
 
FarmManagementCategory LookUpManagementCategory (int a_todo)
 
bool GetForceSpringOK ()
 

Additional Inherited Members

- Public Attributes inherited from Crop
TTypesOfVegetation m_tov
 
- Protected Member Functions inherited from Crop
void SimpleEvent (long a_date, int a_todo, bool a_lock)
 Adds an event to this crop management. More...
 
void SimpleEvent_ (long a_date, int a_todo, bool a_lock, Farm *a_farm, LE *a_field)
 Adds an event to this crop management without relying on member variables. More...
 
bool StartUpCrop (int a_spring, std::vector< std::vector< int >> a_flexdates, int a_todo)
 
Holds the translation between the farm operation enum for each cropand the farm management category associated with it More...
 
bool AphidDamage (LE *a_field)
 Compares aphid numbers per m2 with a threshold to return true if threshold is exceeded. More...
 
- Protected Attributes inherited from Crop
Farmm_farm
 
LEm_field
 
FarmEventm_ev
 
int m_first_date
 
int m_count
 
int m_last_date
 
int m_ddegstoharvest
 
int m_base_elements_no
 
Landscapem_OurLandscape
 
bool m_forcespringpossible = false
 Used to signal that the crop can be forced to start in spring. More...
 
TTypesOfCrops m_toc
 The Crop type in terms of the TTypesOfCrops list (smaller list than tov, no country designation) More...
 
int m_CropClassification
 Contains information on whether this is a winter crop, spring crop, or catch crop that straddles the year boundary (0,1,2) More...
 
vector< FarmManagementCategorym_ManagementCategories
 Holds the translation between the farm operation enum for each crop and the farm management category associated with it. More...
 
- Static Protected Attributes inherited from Crop
static int m_date_modifier = 0
 Holds a value that shifts test pesticide use by this many days in crops modified to use it. More...
 

Constructor & Destructor Documentation

◆ OFirstYearDanger()

OFirstYearDanger::OFirstYearDanger ( TTypesOfVegetation  a_tov,
TTypesOfCrops  a_toc,
Landscape a_L 
)
inline
43  : Crop(a_tov, a_toc, a_L)
44  {
45  ;
47  }

References SetUpFarmCategoryInformation().

Member Function Documentation

◆ Do()

bool OFirstYearDanger::Do ( Farm a_farm,
LE a_field,
FarmEvent a_ev 
)
virtual

Reimplemented from Crop.

33 {
34  m_farm = a_farm;
35  m_field = a_field;
36  m_ev = a_ev;
37 
38  bool done = false;
39 
40  switch ( m_ev->m_todo )
41  {
42  case ofyd_start:
43  {
44  // ***CJT*** Adjust ending date for this dummy management
45  // plan as needed. FN.
46  a_field->ClearManagementActionSum();
47 
48  int d1 = g_date->OldDays() + g_date->DayInYear( 1,8 );
49  SimpleEvent( d1, ofyd_end, false );
50  }
51  break;
52 
53  case ofyd_end:
54  done = true;
55  break;
56 
57  default:
58  g_msg->Warn( WARN_BUG, "OFirstYearDanger::Do(): "
59  "Unknown event type! ", "" );
60  exit( 1 );
61  }
62 
63  return done;
64 }

References LE::ClearManagementActionSum(), Calendar::DayInYear(), g_date, g_msg, Crop::m_ev, Crop::m_farm, Crop::m_field, FarmEvent::m_todo, ofyd_end, ofyd_start, Calendar::OldDays(), Crop::SimpleEvent(), MapErrorMsg::Warn(), and WARN_BUG.

◆ SetUpFarmCategoryInformation()

void OFirstYearDanger::SetUpFarmCategoryInformation ( )
inline
48  {
49  const int elements = 2 + (ofyd_foobar - O_FIRST_YEAR_DANGER_BASE);
51 
52  FarmManagementCategory catlist[elements] =
53  {
54  fmc_Others, // zero element unused but must be here
55  fmc_Others, // ofyd_start = 1, // Compulsory, start event must always be 1 (one).
56  fmc_Others // ofyd_end = O_FIRST_YEAR_DANGER_BASE,
57 
58 
59  // no foobar entry
60 
61  };
62  // Iterate over the catlist elements and copy them to vector
63  copy(begin(catlist), end(catlist), back_inserter(m_ManagementCategories));
64 
65  }

References fmc_Others, Crop::m_base_elements_no, Crop::m_ManagementCategories, O_FIRST_YEAR_DANGER_BASE, and ofyd_foobar.

Referenced by OFirstYearDanger().


The documentation for this class was generated from the following files:
LE::ClearManagementActionSum
void ClearManagementActionSum()
clears the management action counters
Definition: Elements.h:247
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
Crop::m_base_elements_no
int m_base_elements_no
Definition: Farm.h:505
Crop::SimpleEvent
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
Definition: Farm.cpp:747
ofyd_end
Definition: OFirstYearDanger.h:35
ofyd_start
Definition: OFirstYearDanger.h:34
fmc_Others
Definition: LandscapeFarmingEnums.h:1003
Calendar::OldDays
long OldDays(void)
Definition: Calendar.h:60
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
OFirstYearDanger::SetUpFarmCategoryInformation
void SetUpFarmCategoryInformation()
Definition: OFirstYearDanger.h:48
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
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
ofyd_foobar
Definition: OFirstYearDanger.h:36
O_FIRST_YEAR_DANGER_BASE
#define O_FIRST_YEAR_DANGER_BASE
Definition: OFirstYearDanger.h:31
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
Crop::Crop
Crop(TTypesOfVegetation a_tov, TTypesOfCrops a_toc, Landscape *a_L)
Definition: Farm.cpp:733
Crop::m_ev
FarmEvent * m_ev
Definition: Farm.h:500
WARN_BUG
Definition: MapErrorMsg.h:34
FarmManagementCategory
FarmManagementCategory
Definition: LandscapeFarmingEnums.h:1001