ALMaSS Partridge ODdox  1.1
The partridge model description following ODdox protocol
TAnimal Class Reference

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

#include <populationmanager.h>

Inheritance diagram for TAnimal:
TALMaSSObject Partridge_Base Partridge_Covey Partridge_Chick Partridge_Clutch Partridge_Female Partridge_Male Partridge_Chick2

Public Member Functions

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 BeginStep (void)
 BeingStep behaviour - must be implemented in descendent classes. More...
 
virtual void Step (void)
 Step behaviour - must be implemented in descendent classes. More...
 
virtual void EndStep (void)
 EndStep behaviour - must be implemented in descendent classes. More...
 
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...
 

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 Partridge_Female, Partridge_Male, Partridge_Covey, Partridge_Chick2, Partridge_Chick, and Partridge_Clutch.

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 Partridge_Clutch::BeginStep(), Partridge_Chick::BeginStep(), Partridge_Chick2::BeginStep(), Partridge_Male::BeginStep(), and Partridge_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

Reimplemented in Partridge_Female, Partridge_Male, Partridge_Chick, and Partridge_Clutch.

Definition at line 266 of file populationmanager.h.

266  {
267  KillThis();
268  }

References KillThis().

Referenced by Partridge_Covey::CoveyEmigrate(), and Partridge_Covey::CoveyIndividualEmigrate().

◆ EndStep()

virtual void TAnimal::EndStep ( void  )
inlinevirtual

EndStep behaviour - must be implemented in descendent classes.

Reimplemented from TALMaSSObject.

Reimplemented in Partridge_Female, Partridge_Male, Partridge_Covey, Partridge_Chick2, Partridge_Chick, and Partridge_Clutch.

Definition at line 254 of file populationmanager.h.

254  {
255  }

◆ KillThis()

virtual void TAnimal::KillThis ( )
inlinevirtual

Reimplemented in Partridge_Female, and Partridge_Male.

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 Partridge_Female, Partridge_Male, Partridge_Chick2, Partridge_Chick, and Partridge_Clutch.

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.

Referenced by Partridge_Covey::CoveyUpdateMemberPositions().

◆ 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.

Referenced by Partridge_Covey::CoveyUpdateMemberPositions().

◆ Step()

virtual void TAnimal::Step ( void  )
inlinevirtual

Step behaviour - must be implemented in descendent classes.

Reimplemented from TALMaSSObject.

Reimplemented in Partridge_Female, Partridge_Male, Partridge_Covey, Partridge_Chick2, Partridge_Chick, and Partridge_Clutch.

Definition at line 252 of file populationmanager.h.

252  {
253  }

◆ Supply_m_Location_x()

◆ Supply_m_Location_y()

◆ 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.

◆ 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

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