ALMaSS Rabbit ODdox  1.00
The rabbit model description following ODdox protocol
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Rabbit_Base Class Reference

#include <Rabbit.h>

Inheritance diagram for Rabbit_Base:
TAnimal TALMaSSObject Rabbit_Adult Rabbit_Young Rabbit_Female Rabbit_Male Rabbit_Juvenile

Public Member Functions

TTypeOfRabbitState GetCurrentRState ()
 
void SetAge (int a_age)
 Set age method. More...
 
RabbitObjectTypes GetRabbitType (void)
 Get rabbit type. More...
 
int GetAge (void)
 Get age method. More...
 
void SetweightAge (int a_age)
 Set age method. More...
 
int GetweightAge (void)
 Get age method. More...
 
Rabbit_WarrenGetWarren (void)
 Get warren pointer. More...
 
void SetWarren (Rabbit_Warren *a_warren)
 Set the warren pointer. More...
 
bool GetHasBurrow (void)
 Get burrow status. More...
 
void SetHasBurrow (bool a_status)
 Set/unset burrow status. More...
 
void SetDigging (int a_days)
 Set number of days to dig. More...
 
int GetDigging ()
 Get number of days to dig. More...
 
APoint GetBornLocation ()
 Get location of birth. More...
 
 Rabbit_Base (int p_x, int p_y, int p_x2, int p_y2, Landscape *p_L, Rabbit_Population_Manager *p_NPM, Rabbit_Warren *a_warren)
 Rabbit constructor. More...
 
virtual ~Rabbit_Base (void)
 Rabbit destructor. More...
 
virtual void BeginStep (void)
 The BeginStep is the first 'part' of the timestep that an animal can behave in. It is called once per timestep. More...
 
virtual void Step (void)
 The Step is the second 'part' of the timestep that an animal can behave in. It is called continuously until all animals report that they are 'DONE'. More...
 
virtual void EndStep (void)
 The EndStep is the third 'part' of the timestep that an animal can behave in. It is called once per timestep. More...
 
void OnFed (void)
 Signals food arrived today. More...
 
void OnMumDead (void)
 Signals death of mum. More...
 
void OnEvicted (void)
 Signals mum has a new litter to look after. More...
 
virtual Rabbit_AdultGetMate (void)
 Get mate pointer. More...
 
- Public Member Functions inherited from TAnimal
unsigned SupplyFarmOwnerRef ()
 
AnimalPosition SupplyPosition ()
 
APoint SupplyPoint ()
 
int SupplyPolygonRef ()
 
int Supply_m_Location_x ()
 
int Supply_m_Location_y ()
 
virtual void KillThis ()
 
virtual void CopyMyself ()
 
void SetX (int a_x)
 
void SetY (int a_y)
 
 TAnimal (int x, int y, Landscape *L)
 
virtual void ReinitialiseObject (int x, int y, Landscape *L)
 Used to re-use an object - must be implemented in descendent classes. More...
 
virtual int WhatState ()
 
virtual void Dying ()
 
void CheckManagement (void)
 
void CheckManagementXY (int x, int y)
 
virtual bool OnFarmEvent (FarmToDo)
 
- Public Member Functions inherited from TALMaSSObject
int GetCurrentStateNo ()
 Returns the current state number. More...
 
void SetCurrentStateNo (int a_num)
 Sets the current state number. More...
 
bool GetStepDone ()
 Returns the step done indicator flag. More...
 
void SetStepDone (bool a_bool)
 Sets the step done indicator flag. More...
 
virtual void ReinitialiseObject ()
 Used to re-use an object - must be implemented in descendent classes. More...
 
 TALMaSSObject ()
 The constructor for TALMaSSObject. More...
 
virtual ~TALMaSSObject ()
 The destructor for TALMaSSObject. More...
 
void OnArrayBoundsError ()
 Used for debugging only, tests basic object properties. More...
 

Public Attributes

RabbitObjectTypes m_RabbitType
 The rabbits type. More...
 

Static Public Attributes

static double m_dispersalmortperm = cfg_dispersalmortperm.value()
 The extra dispersal mortality per m travelled. More...
 
static double m_pesticidedegradationrate = cfg_rabbit_pesticidedegradationrate.value()
 State variable used to hold the daily degredation rate of the pesticide in the body. More...
 

Protected Member Functions

virtual void Explore (void)
 Exploration method. More...
 
virtual void st_Dying (void)
 Default dying state. More...
 
bool MortalityTest (double a_prop)
 A simple probability based test. More...
 
bool WalkTo (int a_x, int a_y)
 Walks to a location from current location. More...
 
virtual void InternalPesticideHandlingAndResponse ()
 Handles internal effects of pesticide exposure. If any effects are needed this method must be re-implemented by descendent classes. More...
 
virtual void GeneralEndocrineDisruptor (double)
 Handles internal effects of endocrine distrupter pesticide exposure. More...
 
virtual void GeneralOrganoPhosphate (double)
 Handles internal effects of organophosphate pesticide exposure. More...
 
- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...
 

Protected Attributes

int m_Age
 The rabbit's age. More...
 
TTypeOfRabbitState m_CurrentRState
 Variable to record current behavioural state. More...
 
Rabbit_Population_Managerm_OurPopulationManager
 This is a time saving pointer to the correct population manager object. More...
 
double m_MyMortChance
 
bool m_haveBurrow
 Flag to record burrow status. More...
 
Rabbit_Warrenm_myWarren
 True if currently mated. More...
 
Rabbit_Femalem_Mum
 Pointer to mum. More...
 
bool m_FedToday
 Flag for been fed today. More...
 
double m_weight
 The weight in g. More...
 
int m_weightAge
 A physiological age parameter, this is the growth age based on an optimal curve (if optimal conditions it will be the same as m_age) More...
 
int m_digging
 Flag to denote digging behaviour. This keeps the rabbit in a warren without burrows whilst it tries to make one. More...
 
APoint m_born_location
 The x,y location at birth. More...
 
double m_pesticide_burden
 State variable used to hold the current body-burden of pesticide. More...
 
bool m_pesticideInfluenced1
 Flag to indicate pesticide effects (e.g. can be used for endocrine distruptors with delayed effects until birth). More...
 
- Protected Attributes inherited from TAnimal
int m_Location_x
 
int m_Location_y
 
Landscapem_OurLandscape
 
- Protected Attributes inherited from TALMaSSObject
int m_CurrentStateNo
 The basic state number for all objects - '-1' indicates death. More...
 
bool m_StepDone
 Indicates whether the iterative step code is done for this timestep. More...
 

Detailed Description

Definition at line 166 of file Rabbit.h.

Constructor & Destructor Documentation

Rabbit_Base::Rabbit_Base ( int  p_x,
int  p_y,
int  p_x2,
int  p_y2,
Landscape p_L,
Rabbit_Population_Manager p_NPM,
Rabbit_Warren a_warren 
)

Rabbit constructor.

Definition at line 161 of file Rabbit.cpp.

References Rabbit_Warren::Join(), m_born_location, m_CurrentRState, m_haveBurrow, m_myWarren, m_OurPopulationManager, m_pesticide_burden, m_pesticideInfluenced1, and toRabbits_InitialState.

161  : TAnimal(p_x, p_y, p_L)
162 {
163  // Assign the pointer to the population manager
164  m_OurPopulationManager = p_NPM;
166  m_haveBurrow = false;
167  m_myWarren = a_warren;
168  m_born_location.m_x = p_x2;
169  m_born_location.m_y = p_y2;
170  if (m_myWarren != NULL) m_myWarren->Join(this);
171  m_pesticideInfluenced1 = false;
172  m_pesticide_burden = 0.0;
173 }
Rabbit_Population_Manager * m_OurPopulationManager
This is a time saving pointer to the correct population manager object.
Definition: Rabbit.h:181
APoint m_born_location
The x,y location at birth.
Definition: Rabbit.h:201
void Join(Rabbit_Base *a_rabbit)
Adds this rabbit to the warren list.
Definition: Rabbit.cpp:2055
Rabbit_Warren * m_myWarren
True if currently mated.
Definition: Rabbit.h:189
double m_pesticide_burden
State variable used to hold the current body-burden of pesticide.
Definition: Rabbit.h:203
bool m_haveBurrow
Flag to record burrow status.
Definition: Rabbit.h:185
TTypeOfRabbitState m_CurrentRState
Variable to record current behavioural state.
Definition: Rabbit.h:179
TAnimal(int x, int y, Landscape *L)
bool m_pesticideInfluenced1
Flag to indicate pesticide effects (e.g. can be used for endocrine distruptors with delayed effects u...
Definition: Rabbit.h:205
Rabbit_Base::~Rabbit_Base ( void  )
virtual

Rabbit destructor.

Definition at line 176 of file Rabbit.cpp.

References Rabbit_Warren::Leave(), and m_myWarren.

177 {
178  if (m_myWarren != NULL ) m_myWarren->Leave(this);
179 }
void Leave(Rabbit_Base *a_rabbit)
Remove this adult from the warren list.
Definition: Rabbit.cpp:2111
Rabbit_Warren * m_myWarren
True if currently mated.
Definition: Rabbit.h:189

Member Function Documentation

void Rabbit_Base::BeginStep ( void  )
virtual

The BeginStep is the first 'part' of the timestep that an animal can behave in. It is called once per timestep.

Reimplemented from TAnimal.

Definition at line 182 of file Rabbit.cpp.

References m_Age, m_OurPopulationManager, Rabbit_Population_Manager::NatalDispersalRecordOutput(), CfgInt::value(), and CfgBool::value().

Referenced by Rabbit_Young::BeingStep().

182  {
184 }
CfgInt cfg_RabbitUseNatalDispersalRecordAge
Flag to denote using lifetime repro output file or not.
Rabbit_Population_Manager * m_OurPopulationManager
This is a time saving pointer to the correct population manager object.
Definition: Rabbit.h:181
void NatalDispersalRecordOutput(Rabbit_Base *a_rabbit)
Records the natal dispersal.
CfgBool cfg_RabbitUseNatalDispersalRecord
Flag to denote using lifetime repro output file or not.
int m_Age
The rabbit&#39;s age.
Definition: Rabbit.h:177
bool value(void)
Definition: configurator.h:123
int value(void)
Definition: configurator.h:92
virtual void Rabbit_Base::EndStep ( void  )
inlinevirtual

The EndStep is the third 'part' of the timestep that an animal can behave in. It is called once per timestep.

Reimplemented from TAnimal.

Reimplemented in Rabbit_Adult, Rabbit_Juvenile, and Rabbit_Young.

Definition at line 272 of file Rabbit.h.

272  {
273  ;
274  }
virtual void Rabbit_Base::Explore ( void  )
inlineprotectedvirtual

Exploration method.

Definition at line 293 of file Rabbit.h.

293  {
294  ;
295  }
virtual void Rabbit_Base::GeneralEndocrineDisruptor ( double  )
inlineprotectedvirtual

Handles internal effects of endocrine distrupter pesticide exposure.

Reimplemented in Rabbit_Female.

Definition at line 307 of file Rabbit.h.

307  {
308  ;
309  }
void Rabbit_Base::GeneralOrganoPhosphate ( double  )
protectedvirtual

Handles internal effects of organophosphate pesticide exposure.

Definition at line 1432 of file Rabbit.cpp.

References m_CurrentRState, m_OurPopulationManager, m_RabbitType, TALMaSSObject::m_StepDone, Rabbit_Population_Manager::PesticideDeathRecord(), and toRabbits_Die.

Referenced by Rabbit_Juvenile::InternalPesticideHandlingAndResponse(), Rabbit_Male::InternalPesticideHandlingAndResponse(), and Rabbit_Female::InternalPesticideHandlingAndResponse().

1432  {
1433  //if (g_rand_uni() > l_pest_daily_mort.value()) return;
1436  m_StepDone = true;
1437  return;
1438 }
Rabbit_Population_Manager * m_OurPopulationManager
This is a time saving pointer to the correct population manager object.
Definition: Rabbit.h:181
RabbitObjectTypes m_RabbitType
The rabbits type.
Definition: Rabbit.h:170
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
TTypeOfRabbitState m_CurrentRState
Variable to record current behavioural state.
Definition: Rabbit.h:179
void PesticideDeathRecord(RabbitObjectTypes ob_type)
Records pesticide poisoning incidents.
int Rabbit_Base::GetAge ( void  )
inline

Get age method.

Definition at line 222 of file Rabbit.h.

222  {
223  return m_Age;
224  }
int m_Age
The rabbit&#39;s age.
Definition: Rabbit.h:177
APoint Rabbit_Base::GetBornLocation ( )
inline

Get location of birth.

Definition at line 258 of file Rabbit.h.

258  {
259  return m_born_location;
260  }
APoint m_born_location
The x,y location at birth.
Definition: Rabbit.h:201
TTypeOfRabbitState Rabbit_Base::GetCurrentRState ( )
inline

DEBUG method to get the current state

Definition at line 210 of file Rabbit.h.

Referenced by Rabbit_Warren::Leave().

210  {
211  return m_CurrentRState;
212  }
TTypeOfRabbitState m_CurrentRState
Variable to record current behavioural state.
Definition: Rabbit.h:179
int Rabbit_Base::GetDigging ( )
inline

Get number of days to dig.

Definition at line 254 of file Rabbit.h.

Referenced by Rabbit_Warren::JoinNMate(), Rabbit_Warren::Leave(), and Rabbit_Warren::Mate().

254  {
255  return m_digging;
256  }
int m_digging
Flag to denote digging behaviour. This keeps the rabbit in a warren without burrows whilst it tries t...
Definition: Rabbit.h:199
bool Rabbit_Base::GetHasBurrow ( void  )
inline

Get burrow status.

Definition at line 242 of file Rabbit.h.

Referenced by Rabbit_Adult::EndStep(), Rabbit_Warren::JoinNMate(), Rabbit_Warren::Leave(), and Rabbit_Warren::Mate().

242  {
243  return m_haveBurrow;
244  }
bool m_haveBurrow
Flag to record burrow status.
Definition: Rabbit.h:185
virtual Rabbit_Adult* Rabbit_Base::GetMate ( void  )
inlinevirtual

Get mate pointer.

Reimplemented in Rabbit_Adult.

Definition at line 288 of file Rabbit.h.

Referenced by Rabbit_Warren::Leave().

288  {
289  return NULL;
290  };
RabbitObjectTypes Rabbit_Base::GetRabbitType ( void  )
inline

Get rabbit type.

Definition at line 218 of file Rabbit.h.

Referenced by Rabbit_Warren::Leave(), Rabbit_Adult::OnMateDead(), Rabbit_Adult::OnMateFinishedDigging(), and Rabbit_Adult::SetMate().

218  {
219  return m_RabbitType;
220  }
RabbitObjectTypes m_RabbitType
The rabbits type.
Definition: Rabbit.h:170
Rabbit_Warren* Rabbit_Base::GetWarren ( void  )
inline

Get warren pointer.

Definition at line 234 of file Rabbit.h.

234  {
235  return m_myWarren;
236  }
Rabbit_Warren * m_myWarren
True if currently mated.
Definition: Rabbit.h:189
int Rabbit_Base::GetweightAge ( void  )
inline

Get age method.

Definition at line 230 of file Rabbit.h.

Referenced by Rabbit_Warren::ChooseNewDominant().

230  {
231  return m_weightAge;
232  }
int m_weightAge
A physiological age parameter, this is the growth age based on an optimal curve (if optimal condition...
Definition: Rabbit.h:197
virtual void Rabbit_Base::InternalPesticideHandlingAndResponse ( )
inlineprotectedvirtual

Handles internal effects of pesticide exposure. If any effects are needed this method must be re-implemented by descendent classes.

Reimplemented in Rabbit_Female, Rabbit_Male, and Rabbit_Juvenile.

Definition at line 303 of file Rabbit.h.

Referenced by Rabbit_Adult::EndStep().

303  {
304  ;
305  }
bool Rabbit_Base::MortalityTest ( double  a_prop)
inlineprotected

A simple probability based test.

Parameters
[in]a_propmust be between 0 and <1.0 This is a simple probability test.

Definition at line 194 of file Rabbit.cpp.

References g_rand_uni.

Referenced by Rabbit_Juvenile::EndStep(), Rabbit_Adult::EndStep(), and Rabbit_Young::st_Develop().

195 {
200  if (g_rand_uni() < a_prop) return true;
201  else return false;
202 }
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni
void Rabbit_Base::OnEvicted ( void  )
inline

Signals mum has a new litter to look after.

Definition at line 284 of file Rabbit.h.

References toRabbits_Weaning.

Referenced by Rabbit_Female::st_GiveBirth().

284  {
286  }
Rabbit_Female * m_Mum
Pointer to mum.
Definition: Rabbit.h:191
TTypeOfRabbitState m_CurrentRState
Variable to record current behavioural state.
Definition: Rabbit.h:179
void Rabbit_Base::OnFed ( void  )
inline

Signals food arrived today.

Definition at line 276 of file Rabbit.h.

Referenced by Rabbit_Female::st_Lactating().

276  {
277  m_FedToday = true;
278  }
bool m_FedToday
Flag for been fed today.
Definition: Rabbit.h:193
void Rabbit_Base::OnMumDead ( void  )
inline

Signals death of mum.

Definition at line 280 of file Rabbit.h.

Referenced by Rabbit_Female::st_Dying().

280  {
281  m_Mum = NULL;
282  }
Rabbit_Female * m_Mum
Pointer to mum.
Definition: Rabbit.h:191
void Rabbit_Base::SetAge ( int  a_age)
inline

Set age method.

Definition at line 214 of file Rabbit.h.

214  {
215  m_Age = a_age;
216  }
int m_Age
The rabbit&#39;s age.
Definition: Rabbit.h:177
void Rabbit_Base::SetDigging ( int  a_days)
inline

Set number of days to dig.

Definition at line 250 of file Rabbit.h.

Referenced by Rabbit_Warren::JoinNMate(), Rabbit_Warren::JoinNOccupy(), Rabbit_Warren::Leave(), Rabbit_Warren::Mate(), Rabbit_Warren::OccupyWarren(), Rabbit_Adult::OnMateFinishedDigging(), Rabbit_Male::st_EvaluateTerritory(), and Rabbit_Female::st_EvaluateTerritory().

250  {
251  m_digging = a_days;
252  }
int m_digging
Flag to denote digging behaviour. This keeps the rabbit in a warren without burrows whilst it tries t...
Definition: Rabbit.h:199
void Rabbit_Base::SetHasBurrow ( bool  a_status)
inline
void Rabbit_Base::SetWarren ( Rabbit_Warren a_warren)
inline

Set the warren pointer.

Definition at line 238 of file Rabbit.h.

Referenced by Rabbit_Warren::Join(), and Rabbit_Warren::Leave().

238  {
239  m_myWarren = a_warren;
240  }
Rabbit_Warren * m_myWarren
True if currently mated.
Definition: Rabbit.h:189
void Rabbit_Base::SetweightAge ( int  a_age)
inline

Set age method.

Definition at line 226 of file Rabbit.h.

226  {
227  m_weightAge = a_age;
228  }
int m_weightAge
A physiological age parameter, this is the growth age based on an optimal curve (if optimal condition...
Definition: Rabbit.h:197
void Rabbit_Base::st_Dying ( void  )
protectedvirtual

Default dying state.

Reimplemented in Rabbit_Female, Rabbit_Adult, Rabbit_Juvenile, and Rabbit_Young.

Definition at line 187 of file Rabbit.cpp.

References TALMaSSObject::m_CurrentStateNo, and TALMaSSObject::m_StepDone.

Referenced by WalkTo().

188 {
189  m_CurrentStateNo = -1; // this will kill the animal object and free up space
190  m_StepDone = true;
191 }
int m_CurrentStateNo
The basic state number for all objects - &#39;-1&#39; indicates death.
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
virtual void Rabbit_Base::Step ( void  )
inlinevirtual

The Step is the second 'part' of the timestep that an animal can behave in. It is called continuously until all animals report that they are 'DONE'.

Reimplemented from TAnimal.

Reimplemented in Rabbit_Female, Rabbit_Male, Rabbit_Juvenile, and Rabbit_Young.

Definition at line 268 of file Rabbit.h.

268  {
269  ;
270  }
bool Rabbit_Base::WalkTo ( int  a_x,
int  a_y 
)
protected

Walks to a location from current location.

Parameters
[in]a_xx-coordinate to move to
[in]a_yy-coordinate to move to
Returns
True if the rabbit still lives, otherwise false if it was killed in dispersal.

Assumes a rectangluar distance movement with associated probability of mortality by distance.

Definition at line 205 of file Rabbit.cpp.

References g_counter, g_rand_uni, m_dispersalmortperm, TAnimal::m_Location_x, TAnimal::m_Location_y, and st_Dying().

Referenced by Rabbit_Male::st_EvaluateTerritory(), and Rabbit_Female::st_EvaluateTerritory().

206 {
214  int dist = abs(a_x-m_Location_x) + abs(a_y-m_Location_y);
215  double prob = dist * m_dispersalmortperm;
216  m_Location_x = a_x;
217  m_Location_y = a_y;
218  if (g_rand_uni() > prob) return true;
219  else
220  {
221  st_Dying();
222  g_counter++;
223  return false;
224  }
225 }
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni
int g_counter
Definition: Rabbit.cpp:76
static double m_dispersalmortperm
The extra dispersal mortality per m travelled.
Definition: Rabbit.h:172
virtual void st_Dying(void)
Default dying state.
Definition: Rabbit.cpp:187

Member Data Documentation

int Rabbit_Base::m_Age
protected
APoint Rabbit_Base::m_born_location
protected

The x,y location at birth.

Definition at line 201 of file Rabbit.h.

Referenced by Rabbit_Base(), Rabbit_Juvenile::st_BecomeAdult(), and Rabbit_Young::st_BecomeJuvenile().

TTypeOfRabbitState Rabbit_Base::m_CurrentRState
protected
int Rabbit_Base::m_digging
protected

Flag to denote digging behaviour. This keeps the rabbit in a warren without burrows whilst it tries to make one.

Definition at line 199 of file Rabbit.h.

Referenced by Rabbit_Adult::EndStep(), Rabbit_Adult::OnMateFinishedDigging(), Rabbit_Adult::Rabbit_Adult(), Rabbit_Male::st_EvaluateTerritory(), and Rabbit_Female::st_EvaluateTerritory().

double Rabbit_Base::m_dispersalmortperm = cfg_dispersalmortperm.value()
static

The extra dispersal mortality per m travelled.

Definition at line 172 of file Rabbit.h.

Referenced by Rabbit_Population_Manager::AssignStaticVariables(), Rabbit_Population_Manager::Rabbit_Population_Manager(), and WalkTo().

bool Rabbit_Base::m_FedToday
protected

Flag for been fed today.

Definition at line 193 of file Rabbit.h.

Referenced by Rabbit_Young::BeingStep(), Rabbit_Young::EndStep(), and Rabbit_Young::Rabbit_Young().

bool Rabbit_Base::m_haveBurrow
protected

Flag to record burrow status.

Definition at line 185 of file Rabbit.h.

Referenced by Rabbit_Adult::OnMateFinishedDigging(), Rabbit_Base(), and Rabbit_Male::st_EvaluateTerritory().

Rabbit_Female* Rabbit_Base::m_Mum
protected
double Rabbit_Base::m_MyMortChance
protected
Rabbit_Warren* Rabbit_Base::m_myWarren
protected
Rabbit_Population_Manager* Rabbit_Base::m_OurPopulationManager
protected
double Rabbit_Base::m_pesticide_burden
protected
double Rabbit_Base::m_pesticidedegradationrate = cfg_rabbit_pesticidedegradationrate.value()
static
bool Rabbit_Base::m_pesticideInfluenced1
protected

Flag to indicate pesticide effects (e.g. can be used for endocrine distruptors with delayed effects until birth).

Definition at line 205 of file Rabbit.h.

Referenced by Rabbit_Female::GeneralEndocrineDisruptor(), Rabbit_Base(), and Rabbit_Female::st_GiveBirth().

RabbitObjectTypes Rabbit_Base::m_RabbitType
double Rabbit_Base::m_weight
protected
int Rabbit_Base::m_weightAge
protected

The documentation for this class was generated from the following files: