ALMaSS Rodenticide ODdox  1.1
The rodenticide model description following ODdox protocol
TAnimal Class Reference

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

#include <PopulationManager.h>

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()

Constructor & Destructor Documentation

◆ TAnimal()

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

TAnimal Constructor

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.

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.

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 }

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

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 }

◆ CopyMyself()

virtual void TAnimal::CopyMyself ( )
inlinevirtual
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.

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

◆ Dying()

virtual void TAnimal::Dying ( )
inlinevirtual
266  {
267  KillThis();
268  }

References KillThis().

◆ EndStep()

virtual void TAnimal::EndStep ( void  )
inlinevirtual

EndStep behaviour - must be implemented in descendent classes.

Reimplemented from TALMaSSObject.

254  {
255  }

◆ KillThis()

virtual void TAnimal::KillThis ( )
inlinevirtual
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
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.

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
240  {
241  m_Location_x = a_x;
242  }

References m_Location_x.

◆ SetY()

void TAnimal::SetY ( int  a_y)
inline
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.

252  {
253  }

◆ Supply_m_Location_x()

int TAnimal::Supply_m_Location_x ( )
inline
213  {
214  return m_Location_x;
215  }

References m_Location_x.

Referenced by CompareX::operator()().

◆ Supply_m_Location_y()

int TAnimal::Supply_m_Location_y ( )
inline
216  {
217  return m_Location_y;
218  }

References m_Location_y.

Referenced by CompareY::operator()().

◆ SupplyFarmOwnerRef()

unsigned TAnimal::SupplyFarmOwnerRef ( )

Provides the farmer reference for the location of a TAnimal

1359  {
1361 }

◆ SupplyPoint()

APoint TAnimal::SupplyPoint ( )
inline
209 { APoint p( m_Location_x, m_Location_y); return p; }

References m_Location_x, and m_Location_y.

◆ SupplyPolygonRef()

int TAnimal::SupplyPolygonRef ( )
inline

◆ SupplyPosition()

AnimalPosition TAnimal::SupplyPosition ( )

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

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
263  {
264  return 0;
265  }

Referenced by CompareState::operator()().

Member Data Documentation

◆ m_Location_x

◆ m_Location_y

◆ m_OurLandscape

Landscape* TAnimal::m_OurLandscape
protected

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
APoint
A simple class defining an x,y coordinate set.
Definition: ALMaSS_Setup.h:52
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
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
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