ALMaSS Rodenticide Model ODdox  1.0
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()

Constructor & Destructor Documentation

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

TAnimal Constructor

1436  {
1437  m_OurLandscape = L;
1438  m_Location_x = x;
1439  m_Location_y = y;
1440 }
int m_Location_x
Definition: PopulationManager.h:221
int m_Location_y
Definition: PopulationManager.h:224
Landscape * m_OurLandscape
Definition: PopulationManager.h:225

Member Function Documentation

virtual void TAnimal::BeginStep ( void  )
inlinevirtual

BeingStep behaviour - must be implemented in descendent classes.

Reimplemented from TALMaSSObject.

246  {
247  }
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.

1473  {
1474  FarmToDo event;
1475  int i = 0;
1476  while ( ( event = ( FarmToDo )m_OurLandscape->SupplyLastTreatment( m_Location_x, m_Location_y, & i ) ) != sleep_all_day ) {
1477  if ( OnFarmEvent( event ) ) break;
1478  }
1479 }
virtual bool OnFarmEvent(FarmToDo)
Definition: PopulationManager.h:267
int m_Location_x
Definition: PopulationManager.h:221
int m_Location_y
Definition: PopulationManager.h:224
Landscape * m_OurLandscape
Definition: PopulationManager.h:225
int SupplyLastTreatment(int a_polyref, int *a_index)
Definition: landscape.h:1253
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.

1486  {
1487  FarmToDo event;
1488  int i = 0;
1489  while ( ( event = ( FarmToDo )m_OurLandscape->SupplyLastTreatment( x, y, & i ) ) != sleep_all_day ) {
1490  OnFarmEvent( event );
1491  }
1492 }
virtual bool OnFarmEvent(FarmToDo)
Definition: PopulationManager.h:267
Landscape * m_OurLandscape
Definition: PopulationManager.h:225
int SupplyLastTreatment(int a_polyref, int *a_index)
Definition: landscape.h:1253
virtual void TAnimal::CopyMyself ( )
inlinevirtual
220  {
221  };
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 Landscape::SupplySimAreaHeight(), and Landscape::SupplySimAreaWidth().

227  {
234  }
int SupplySimAreaWidth(void)
Definition: landscape.h:1556
int m_Location_x
Definition: PopulationManager.h:221
int m_Location_y
Definition: PopulationManager.h:224
int SupplySimAreaHeight(void)
Definition: landscape.h:1561
Landscape * m_OurLandscape
Definition: PopulationManager.h:225
virtual void TAnimal::Dying ( )
inlinevirtual
262  {
263  KillThis();
264  }
virtual void KillThis()
Definition: PopulationManager.h:215
virtual void TAnimal::EndStep ( void  )
inlinevirtual

EndStep behaviour - must be implemented in descendent classes.

Reimplemented from TALMaSSObject.

250  {
251  }
virtual void TAnimal::KillThis ( )
inlinevirtual
216  {
217  m_CurrentStateNo = -1;
218  m_StepDone = true;
219  };
int m_CurrentStateNo
The basic state number for all objects - &#39;-1&#39; indicates death.
Definition: PopulationManager.h:112
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: PopulationManager.h:114
virtual bool TAnimal::OnFarmEvent ( FarmToDo  )
inlinevirtual
267  {
268  return false;
269  }
virtual void TAnimal::ReinitialiseObject ( int  x,
int  y,
Landscape L 
)
inlinevirtual

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

References TALMaSSObject::ReinitialiseObject().

253  {
254  m_OurLandscape = L;
255  m_Location_x = x;
256  m_Location_y = y;
258  }
int m_Location_x
Definition: PopulationManager.h:221
int m_Location_y
Definition: PopulationManager.h:224
Landscape * m_OurLandscape
Definition: PopulationManager.h:225
virtual void ReinitialiseObject()
Used to re-use an object - must be implemented in descendent classes.
Definition: PopulationManager.h:139
void TAnimal::SetX ( int  a_x)
inline
236  {
237  m_Location_x = a_x;
238  }
int m_Location_x
Definition: PopulationManager.h:221
void TAnimal::SetY ( int  a_y)
inline
239  {
240 
241  m_Location_y = a_y;
242 
243  }
int m_Location_y
Definition: PopulationManager.h:224
virtual void TAnimal::Step ( void  )
inlinevirtual

Step behaviour - must be implemented in descendent classes.

Reimplemented from TALMaSSObject.

248  {
249  }
int TAnimal::Supply_m_Location_x ( )
inline

Referenced by CompareX::operator()().

209  {
210  return m_Location_x;
211  }
int m_Location_x
Definition: PopulationManager.h:221
int TAnimal::Supply_m_Location_y ( )
inline

Referenced by CompareY::operator()().

212  {
213  return m_Location_y;
214  }
int m_Location_y
Definition: PopulationManager.h:224
unsigned TAnimal::SupplyFarmOwnerRef ( )

Provides the farmer reference for the location of a TAnimal

1428  {
1430 }
int m_Location_x
Definition: PopulationManager.h:221
int m_Location_y
Definition: PopulationManager.h:224
int SupplyFarmOwner(int a_x, int a_y)
Definition: landscape.h:1071
Landscape * m_OurLandscape
Definition: PopulationManager.h:225
APoint TAnimal::SupplyPoint ( )
inline
205 { APoint p( m_Location_x, m_Location_y); return p; }
int m_Location_x
Definition: PopulationManager.h:221
int m_Location_y
Definition: PopulationManager.h:224
A simple class defining an x,y coordinate set.
Definition: ALMaSS_Setup.h:50
int TAnimal::SupplyPolygonRef ( )
inline
206  {
208  }
int SupplyPolyRef(int a_x, int a_y)
Definition: landscape.h:1412
int m_Location_x
Definition: PopulationManager.h:221
int m_Location_y
Definition: PopulationManager.h:224
Landscape * m_OurLandscape
Definition: PopulationManager.h:225
AnimalPosition TAnimal::SupplyPosition ( )

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

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

1414  {
1415  AnimalPosition SkP;
1416  SkP.m_x = m_Location_x;
1417  SkP.m_y = m_Location_y;
1420  return SkP;
1421 }
TTypesOfVegetation SupplyVegType(int a_x, int a_y)
Definition: landscape.h:1241
A class defining an animals position.
Definition: PopulationManager.h:164
TTypesOfLandscapeElement m_EleType
Definition: PopulationManager.h:170
unsigned m_y
Definition: PopulationManager.h:169
TTypesOfLandscapeElement SupplyElementType(int a_polyref)
Definition: landscape.h:1029
int m_Location_x
Definition: PopulationManager.h:221
TTypesOfVegetation m_VegType
Definition: PopulationManager.h:171
int m_Location_y
Definition: PopulationManager.h:224
Landscape * m_OurLandscape
Definition: PopulationManager.h:225
unsigned m_x
Definition: PopulationManager.h:168
virtual int TAnimal::WhatState ( )
inlinevirtual

Referenced by CompareState::operator()().

259  {
260  return 0;
261  }

Member Data Documentation

int TAnimal::m_Location_x
protected
int TAnimal::m_Location_y
protected
Landscape* TAnimal::m_OurLandscape
protected

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