ALMaSS Hare ODDox  1.1
The hare model description following ODdox protocol
TAnimal Class Reference

The base class for all ALMaSS animal classes. More...

#include <PopulationManager.h>

Public Member Functions

virtual void BeginStep (void)
 BeingStep behaviour - must be implemented in descendent classes. More...
 
void CheckManagement (void)
 
void CheckManagementXY (int x, int y)
 
virtual void CopyMyself ()
 
virtual void Dying ()
 
virtual void EndStep (void)
 EndStep behaviour - must be implemented in descendent classes. More...
 
virtual void KillThis ()
 
virtual bool OnFarmEvent (FarmToDo)
 
virtual void ReinitialiseObject (int x, int y, Landscape *L)
 Used to re-use an object - must be implemented in descendent classes. More...
 
void SetX (int a_x)
 
void SetY (int a_y)
 
virtual void Step (void)
 Step behaviour - must be implemented in descendent classes. More...
 
int Supply_m_Location_x ()
 
int Supply_m_Location_y ()
 
unsigned SupplyFarmOwnerRef ()
 
APoint SupplyPoint ()
 
int SupplyPolygonRef ()
 
AnimalPosition SupplyPosition ()
 
 TAnimal (int x, int y, Landscape *L)
 
virtual int WhatState ()
 
- Public Member Functions inherited from TALMaSSObject
int GetCurrentStateNo ()
 Returns the current state number. More...
 
bool GetStepDone ()
 Returns the step done indicator flag. More...
 
void OnArrayBoundsError ()
 Used for debugging only, tests basic object properties. More...
 
virtual void ReinitialiseObject ()
 Used to re-use an object - must be implemented in descendent classes. More...
 
void SetCurrentStateNo (int a_num)
 Sets the current state number. More...
 
void SetStepDone (bool a_bool)
 Sets the step done indicator flag. More...
 
 TALMaSSObject ()
 The constructor for TALMaSSObject. More...
 
virtual ~TALMaSSObject ()
 The destructor for TALMaSSObject. More...
 

Protected Member Functions

void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...
 

Protected Attributes

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

The base class for all ALMaSS animal classes.

Includes all the functionality required to be handled by classes derived from Population_Manager, hence a number of empty methods that MUST be reimplemented in descendent classes e.g. CopyMyself()

Definition at line 205 of file PopulationManager.h.

Constructor & Destructor Documentation

◆ TAnimal()

TAnimal::TAnimal ( int  x,
int  y,
Landscape L 
)

TAnimal Constructor

Definition at line 1367 of file PopulationManager.cpp.

1367  {
1368  m_OurLandscape = L;
1369  m_Location_x = x;
1370  m_Location_y = y;
1371 }

Member Function Documentation

◆ BeginStep()

virtual void TAnimal::BeginStep ( void  )
inlinevirtual

BeingStep behaviour - must be implemented in descendent classes.

Reimplemented from TALMaSSObject.

Reimplemented in Hare_Female, Hare_Male, Hare_Juvenile, Hare_Young, Hare_Infant, and THare.

Definition at line 250 of file PopulationManager.h.

250  {
251  }

◆ CheckManagement()

void TAnimal::CheckManagement ( void  )

Checks to see if there has been a management event at the TAnimals' x,y location. If so calls an event handler to handle the management event.

Definition at line 1404 of file PopulationManager.cpp.

1404  {
1405  FarmToDo event;
1406  int i = 0;
1407  while ( ( event = ( FarmToDo )m_OurLandscape->SupplyLastTreatment( m_Location_x, m_Location_y, & i ) ) != sleep_all_day ) {
1408  if ( OnFarmEvent( event ) ) break;
1409  }
1410 }

References sleep_all_day.

Referenced by Hare_Infant::BeginStep(), Hare_Young::BeginStep(), Hare_Juvenile::BeginStep(), Hare_Male::BeginStep(), and Hare_Female::BeginStep().

◆ CheckManagementXY()

void TAnimal::CheckManagementXY ( int  x,
int  y 
)

Checks to see if there has been a management event at the x,y location. If so calls an event handler to handle the management event.

Definition at line 1417 of file PopulationManager.cpp.

1417  {
1418  FarmToDo event;
1419  int i = 0;
1420  while ( ( event = ( FarmToDo )m_OurLandscape->SupplyLastTreatment( x, y, & i ) ) != sleep_all_day ) {
1421  OnFarmEvent( event );
1422  }
1423 }

References sleep_all_day.

◆ CopyMyself()

virtual void TAnimal::CopyMyself ( )
inlinevirtual

Definition at line 224 of file PopulationManager.h.

224  {
225  };

◆ CorrectWrapRound()

void TAnimal::CorrectWrapRound ( )
inlineprotected

Corrects wrap around co-ordinate problems.

Does the standard wrap around testing of positions. Uses the addition and modulus operators to avoid testing for negative or > landscape extent. This would be an alternative that should be tested for speed at some point.

Definition at line 231 of file PopulationManager.h.

References m_Location_x, m_Location_y, m_OurLandscape, Landscape::SupplySimAreaHeight(), and Landscape::SupplySimAreaWidth().

◆ Dying()

virtual void TAnimal::Dying ( )
inlinevirtual

Definition at line 266 of file PopulationManager.h.

266  {
267  KillThis();
268  }

References KillThis().

Referenced by THare_Population_Manager::Catastrophe(), and THare_Population_Manager::ExtraPopMort().

◆ EndStep()

virtual void TAnimal::EndStep ( void  )
inlinevirtual

EndStep behaviour - must be implemented in descendent classes.

Reimplemented from TALMaSSObject.

Reimplemented in Hare_Female, Hare_Male, Hare_Juvenile, Hare_Young, Hare_Infant, and THare.

Definition at line 254 of file PopulationManager.h.

254  {
255  }

◆ KillThis()

virtual void TAnimal::KillThis ( )
inlinevirtual

Definition at line 219 of file PopulationManager.h.

220  {
221  m_CurrentStateNo = -1;
222  m_StepDone = true;
223  };

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

Referenced by Dying().

◆ OnFarmEvent()

virtual bool TAnimal::OnFarmEvent ( FarmToDo  )
inlinevirtual

Reimplemented in Hare_Young, Hare_Infant, and THare.

Definition at line 271 of file PopulationManager.h.

271  {
272  return false;
273  }

◆ ReinitialiseObject()

virtual void TAnimal::ReinitialiseObject ( int  x,
int  y,
Landscape L 
)
inlinevirtual

Used to re-use an object - must be implemented in descendent classes.

Definition at line 257 of file PopulationManager.h.

257  {
258  m_OurLandscape = L;
259  m_Location_x = x;
260  m_Location_y = y;
262  }

References m_Location_x, m_Location_y, m_OurLandscape, and TALMaSSObject::ReinitialiseObject().

◆ SetX()

void TAnimal::SetX ( int  a_x)
inline

Definition at line 240 of file PopulationManager.h.

240  {
241  m_Location_x = a_x;
242  }

References m_Location_x.

◆ SetY()

void TAnimal::SetY ( int  a_y)
inline

Definition at line 243 of file PopulationManager.h.

243  {
244 
245  m_Location_y = a_y;
246 
247  }

References m_Location_y.

◆ Step()

virtual void TAnimal::Step ( void  )
inlinevirtual

Step behaviour - must be implemented in descendent classes.

Reimplemented from TALMaSSObject.

Reimplemented in Hare_Female, Hare_Male, Hare_Juvenile, Hare_Young, Hare_Infant, and THare.

Definition at line 252 of file PopulationManager.h.

252  {
253  }

◆ Supply_m_Location_x()

int TAnimal::Supply_m_Location_x ( )
inline

◆ Supply_m_Location_y()

int TAnimal::Supply_m_Location_y ( )
inline

◆ SupplyFarmOwnerRef()

unsigned TAnimal::SupplyFarmOwnerRef ( )

Provides the farmer reference for the location of a TAnimal

Definition at line 1359 of file PopulationManager.cpp.

1359  {
1361 }

◆ SupplyPoint()

APoint TAnimal::SupplyPoint ( )
inline

Definition at line 209 of file PopulationManager.h.

209 { APoint p( m_Location_x, m_Location_y); return p; }

References m_Location_x, and m_Location_y.

Referenced by THare_Population_Manager::HuntingDifferentiatedBeetleBankArea().

◆ SupplyPolygonRef()

int TAnimal::SupplyPolygonRef ( )
inline

Definition at line 210 of file PopulationManager.h.

210  {
212  }

References m_Location_x, m_Location_y, m_OurLandscape, and Landscape::SupplyPolyRef().

◆ SupplyPosition()

AnimalPosition TAnimal::SupplyPosition ( )

Provides the location of an animal in terms of x,y,elementtype and vegetation type

Definition at line 1345 of file PopulationManager.cpp.

1345  {
1346  AnimalPosition SkP;
1347  SkP.m_x = m_Location_x;
1348  SkP.m_y = m_Location_y;
1351  return SkP;
1352 }

References AnimalPosition::m_EleType, AnimalPosition::m_VegType, AnimalPosition::m_x, and AnimalPosition::m_y.

◆ WhatState()

virtual int TAnimal::WhatState ( )
inlinevirtual

Definition at line 263 of file PopulationManager.h.

263  {
264  return 0;
265  }

Referenced by CompareState::operator()().

Member Data Documentation

◆ m_Location_x

◆ m_Location_y

◆ m_OurLandscape


The documentation for this class was generated from the following files:
TAnimal::KillThis
virtual void KillThis()
Definition: PopulationManager.h:219
Landscape::SupplyVegType
TTypesOfVegetation SupplyVegType(int a_x, int a_y)
Definition: Landscape.h:1321
Landscape::SupplyElementType
TTypesOfLandscapeElement SupplyElementType(int a_polyref)
Definition: Landscape.h:1110
TAnimal::m_OurLandscape
Landscape * m_OurLandscape
Definition: PopulationManager.h:229
AnimalPosition::m_x
unsigned m_x
Definition: PopulationManager.h:172
Landscape::SupplySimAreaHeight
int SupplySimAreaHeight(void)
Definition: Landscape.h:1637
Landscape::SupplyFarmOwner
int SupplyFarmOwner(int a_x, int a_y)
Definition: Landscape.h:1152
Landscape::SupplySimAreaWidth
int SupplySimAreaWidth(void)
Definition: Landscape.h:1632
TAnimal::m_Location_y
int m_Location_y
Definition: PopulationManager.h:228
TAnimal::OnFarmEvent
virtual bool OnFarmEvent(FarmToDo)
Definition: PopulationManager.h:271
AnimalPosition
A class defining an animals position.
Definition: PopulationManager.h:168
TALMaSSObject::m_StepDone
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: PopulationManager.h:118
AnimalPosition::m_EleType
TTypesOfLandscapeElement m_EleType
Definition: PopulationManager.h:174
AnimalPosition::m_y
unsigned m_y
Definition: PopulationManager.h:173
TALMaSSObject::ReinitialiseObject
virtual void ReinitialiseObject()
Used to re-use an object - must be implemented in descendent classes.
Definition: PopulationManager.h:143
FarmToDo
FarmToDo
Definition: treatment.h:31
TALMaSSObject::m_CurrentStateNo
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:116
Landscape::SupplyLastTreatment
int SupplyLastTreatment(int a_polyref, int *a_index)
Definition: Landscape.h:1331
sleep_all_day
Definition: treatment.h:33
TAnimal::m_Location_x
int m_Location_x
Definition: PopulationManager.h:225
Landscape::SupplyPolyRef
int SupplyPolyRef(int a_x, int a_y)
Definition: Landscape.h:1488
AnimalPosition::m_VegType
TTypesOfVegetation m_VegType
Definition: PopulationManager.h:175