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

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

#include <populationmanager.h>

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

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 201 of file populationmanager.h.

Constructor & Destructor Documentation

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

TAnimal Constructor

Definition at line 1437 of file PopulationManager.cpp.

1437  {
1438  m_OurLandscape = L;
1439  m_Location_x = x;
1440  m_Location_y = y;
1441 }
Landscape * m_OurLandscape

Member Function Documentation

virtual void TAnimal::BeginStep ( void  )
inlinevirtual

BeingStep behaviour - must be implemented in descendent classes.

Reimplemented from TALMaSSObject.

Reimplemented in Rabbit_Warren, and Rabbit_Base.

Definition at line 246 of file populationmanager.h.

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.

Definition at line 1474 of file PopulationManager.cpp.

References sleep_all_day.

1474  {
1475  FarmToDo event;
1476  int i = 0;
1477  while ( ( event = ( FarmToDo )m_OurLandscape->SupplyLastTreatment( m_Location_x, m_Location_y, & i ) ) != sleep_all_day ) {
1478  if ( OnFarmEvent( event ) ) break;
1479  }
1480 }
virtual bool OnFarmEvent(FarmToDo)
FarmToDo
Definition: treatment.h:31
Landscape * m_OurLandscape
int SupplyLastTreatment(int a_polyref, int *a_index)
Definition: landscape.h:1255
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 1487 of file PopulationManager.cpp.

References sleep_all_day.

1487  {
1488  FarmToDo event;
1489  int i = 0;
1490  while ( ( event = ( FarmToDo )m_OurLandscape->SupplyLastTreatment( x, y, & i ) ) != sleep_all_day ) {
1491  OnFarmEvent( event );
1492  }
1493 }
virtual bool OnFarmEvent(FarmToDo)
FarmToDo
Definition: treatment.h:31
Landscape * m_OurLandscape
int SupplyLastTreatment(int a_polyref, int *a_index)
Definition: landscape.h:1255
virtual void TAnimal::CopyMyself ( )
inlinevirtual

Definition at line 220 of file populationmanager.h.

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.

Definition at line 227 of file populationmanager.h.

References Landscape::SupplySimAreaHeight(), and Landscape::SupplySimAreaWidth().

virtual void TAnimal::Dying ( )
inlinevirtual

Definition at line 262 of file populationmanager.h.

262  {
263  KillThis();
264  }
virtual void KillThis()
virtual void TAnimal::EndStep ( void  )
inlinevirtual

EndStep behaviour - must be implemented in descendent classes.

Reimplemented from TALMaSSObject.

Reimplemented in Rabbit_Adult, Rabbit_Juvenile, Rabbit_Young, and Rabbit_Base.

Definition at line 250 of file populationmanager.h.

250  {
251  }
virtual void TAnimal::KillThis ( )
inlinevirtual

Definition at line 215 of file populationmanager.h.

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.
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
virtual bool TAnimal::OnFarmEvent ( FarmToDo  )
inlinevirtual

Definition at line 267 of file populationmanager.h.

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.

Definition at line 253 of file populationmanager.h.

References TALMaSSObject::ReinitialiseObject().

253  {
254  m_OurLandscape = L;
255  m_Location_x = x;
256  m_Location_y = y;
258  }
Landscape * m_OurLandscape
virtual void ReinitialiseObject()
Used to re-use an object - must be implemented in descendent classes.
void TAnimal::SetX ( int  a_x)
inline

Definition at line 236 of file populationmanager.h.

236  {
237  m_Location_x = a_x;
238  }
void TAnimal::SetY ( int  a_y)
inline

Definition at line 239 of file populationmanager.h.

239  {
240 
241  m_Location_y = a_y;
242 
243  }
virtual void TAnimal::Step ( void  )
inlinevirtual

Step behaviour - must be implemented in descendent classes.

Reimplemented from TALMaSSObject.

Reimplemented in Rabbit_Warren, Rabbit_Female, Rabbit_Male, Rabbit_Juvenile, Rabbit_Young, and Rabbit_Base.

Definition at line 248 of file populationmanager.h.

248  {
249  }
int TAnimal::Supply_m_Location_x ( )
inline
int TAnimal::Supply_m_Location_y ( )
inline
unsigned TAnimal::SupplyFarmOwnerRef ( )

Provides the farmer reference for the location of a TAnimal

Definition at line 1429 of file PopulationManager.cpp.

1429  {
1431 }
int SupplyFarmOwner(int a_x, int a_y)
Definition: landscape.h:1073
Landscape * m_OurLandscape
APoint TAnimal::SupplyPoint ( )
inline

Definition at line 205 of file populationmanager.h.

205 { APoint p( m_Location_x, m_Location_y); return p; }
int TAnimal::SupplyPolygonRef ( )
inline

Definition at line 206 of file populationmanager.h.

206  {
208  }
int SupplyPolyRef(int a_x, int a_y)
Definition: landscape.h:1414
Landscape * m_OurLandscape
AnimalPosition TAnimal::SupplyPosition ( )

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

Definition at line 1415 of file PopulationManager.cpp.

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

1415  {
1416  AnimalPosition SkP;
1417  SkP.m_x = m_Location_x;
1418  SkP.m_y = m_Location_y;
1421  return SkP;
1422 }
TTypesOfVegetation SupplyVegType(int a_x, int a_y)
Definition: landscape.h:1243
A class defining an animals position.
TTypesOfLandscapeElement m_EleType
TTypesOfLandscapeElement SupplyElementType(int a_polyref)
Definition: landscape.h:1031
TTypesOfVegetation m_VegType
Landscape * m_OurLandscape
virtual int TAnimal::WhatState ( )
inlinevirtual

Definition at line 259 of file populationmanager.h.

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: