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

Base class for all partridge classes. More...

#include <Partridge_All.h>

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

Public Member Functions

Partridge_Object GetObjectType ()
 Supply object type. More...
bool GetUncleStatus ()
 Supply uncle status. More...
void SetUncleStatus (bool a_Status)
 Set uncle status. More...
bool PossibleMate (Partridge_Base *a_partridge)
 Can we mate? More...
virtual bool ArePaired ()
 Overridden base function. More...
Partridge_CoveyGetCovey (void)
 Supply covey pointer. More...
Partridge_State GetState (void)
 Supply state. More...
void SetState (Partridge_State a_pars)
 Set state. More...
int GetFamily (void)
 Supply family ID. More...
int GetAge (void)
 Supply age. More...
void SetAge (int a_age)
 Set age. More...
long GetID (void)
 Supply ID. More...
void SetFamily (unsigned int family)
 Set family ID. More...
void SetCovey (Partridge_Covey *a_covey)
 Set covey pointer. More...
void MakeCovey ()
 Create our own covey. More...
void SwitchCovey (Partridge_Covey *a_covey)
 Swap coveys. More...
 Partridge_Base (int a_born_x, int a_born_y, int a_x, int a_y, int a_family_counter, Partridge_Covey *a_covey, Landscape *a_map, Partridge_Population_Manager *a_manager)
 Constructor for Partridge_Base. More...
virtual ~Partridge_Base (void)
 Destructor. More...
virtual void CopyMyself (int a_Ptype)
 Duplicate this object. More...
- Public Member Functions inherited from TAnimal
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...

Public Attributes

 Pointer to the population manager. More...

Protected Member Functions

virtual bool DailyMortality ()
 Background mortality test. More...
virtual void CheckMatePointers ()
 Debug. More...
- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...

Protected Attributes

int m_signal
 Used to pass information to outputs. More...
long m_id
 Individual bird ID. More...
int m_family_counter
 Family ID. More...
int m_age
 Age in days. More...
int m_born_x
 x-coord of birth More...
int m_born_y
 y-coord of birth More...
bool m_UncleStatus
 If has uncle status in the covey. More...
Partridge_Object m_object_type
 Type of pob object this is. More...
 Pointer to the covey. More...
Partridge_State m_state
 Current behavioural state. More...
- Protected Attributes inherited from TAnimal
int m_Location_x
int m_Location_y
- 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

Base class for all partridge classes.

Definition at line 401 of file Partridge_All.h.

Constructor & Destructor Documentation

◆ Partridge_Base()

Partridge_Base::Partridge_Base ( int  a_born_x,
int  a_born_y,
int  a_x,
int  a_y,
int  a_family_counter,
Partridge_Covey a_covey,
Landscape a_map,
Partridge_Population_Manager a_manager 

Constructor for Partridge_Base.

If a_flock is NULL, then assume this is an animal created during population manager initialization and that covey creation/addtion is controlled by the calling method.

Definition at line 156 of file Partridge_All.cpp.

157  : TAnimal( a_x, a_y, a_map )
158  {
159  m_age = 0;
160  m_born_x = a_born_x;
161  m_born_y = a_born_y;
162  m_UncleStatus = false;
163  m_family_counter = a_family_counter;
164  m_id = g_partridge_id++;
165  m_covey = a_covey;
166  // **CJT** NB it is the responsibility of the calling method
167  // to ensure that if a_covey is NULL, then the bird is added later
168  if ( m_covey ) m_covey->AddMember( this );
170  m_OurPopulationManager = a_manager;
171  m_signal = -9999; // used to trap non-set signal output
172 }

References Partridge_Covey::AddMember(), g_partridge_id, m_age, m_born_x, m_born_y, m_covey, m_family_counter, m_id, m_OurPopulationManager, m_signal, m_state, m_UncleStatus, and pars_Initiation.

◆ ~Partridge_Base()

Partridge_Base::~Partridge_Base ( void  )


The destructor removes an animal from its flock.

Definition at line 192 of file Partridge_All.cpp.

193 {
194  // Line removed because it causes all kinds of concurrency problems
195  // removal from covey must occur when the bird is killed, not later in the day
196  // m_covey->RemoveMember( this );
197 }

Member Function Documentation

◆ ArePaired()

virtual bool Partridge_Base::ArePaired ( )

Overridden base function.

Reimplemented in Partridge_Female, and Partridge_Male.

Definition at line 450 of file Partridge_All.h.

450 { return false; }

◆ CheckMatePointers()

virtual void Partridge_Base::CheckMatePointers ( )


Reimplemented in Partridge_Female, and Partridge_Male.

Definition at line 426 of file Partridge_All.h.

426 {;}

Referenced by Partridge_Clutch::Step().

◆ CopyMyself()

void Partridge_Base::CopyMyself ( int  a_Ptype)

Duplicate this object.

A method required only for experimental manipulations - e.g. sudden doubling of population size.

Definition at line 239 of file Partridge_All.cpp.

239  {
240  AdultPartridge_struct * aps;
241  aps = new AdultPartridge_struct;
242  aps->bx = m_born_x;
243  aps->by = m_born_y;
244  aps->x = m_Location_x;
245  aps->y = m_Location_y;
246  aps->L = m_OurLandscape;
247  aps->family_counter = random(1000000);
248  aps->age = m_age;
249  if (a_Ptype==pob_Male) {
250  aps->sex=true;
251  } else {
252  aps->sex=false;
253  }
255  delete aps;
256 }

References AdultPartridge_struct::age, Partridge_struct::bx, Partridge_struct::by, Partridge_Population_Manager::CreateCloneObjects(), Partridge_struct::family_counter, Partridge_struct::L, m_age, m_born_x, m_born_y, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, m_OurPopulationManager, pob_Male, AdultPartridge_struct::sex, Partridge_struct::x, and Partridge_struct::y.

Referenced by Partridge_Population_Manager::Catastrophe(), and Partridge_Population_Manager::MaleImmigration().

◆ DailyMortality()

bool Partridge_Base::DailyMortality ( void  )

Background mortality test.

This should not really be used.

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

Definition at line 228 of file Partridge_All.cpp.

229 {
230  int chance = random( 100000 );
231  if ( chance < cfg_par_base_mortality.value() ) return true;
232  return false;
233 }

References cfg_par_base_mortality, and CfgInt::value().

◆ GetAge()

int Partridge_Base::GetAge ( void  )

Supply age.

Definition at line 472 of file Partridge_All.h.

472  {
473  return m_age;
474  }

References m_age.

Referenced by Partridge_Population_Manager::DoFirst(), and Partridge_Covey::SupplyChickAge().

◆ GetCovey()

Partridge_Covey* Partridge_Base::GetCovey ( void  )

Supply covey pointer.

Definition at line 453 of file Partridge_All.h.

453  {
454  return m_covey;
455  }

References m_covey.

Referenced by Partridge_Population_Manager::DissolveCovey().

◆ GetFamily()

int Partridge_Base::GetFamily ( void  )

◆ GetID()

long Partridge_Base::GetID ( void  )

Supply ID.

Definition at line 482 of file Partridge_All.h.

482  {
483  return m_id;
484  }

References m_id.

Referenced by Partridge_Covey::RemoveMember().

◆ GetObjectType()

Partridge_Object Partridge_Base::GetObjectType ( )

Supply object type.

Definition at line 432 of file Partridge_All.h.

432  {
433  return m_object_type;
434  }

References m_object_type.

Referenced by Partridge_Population_Manager::DissolveCovey(), and Partridge_Communication::PassMessage().

◆ GetState()

Partridge_State Partridge_Base::GetState ( void  )

Supply state.

Definition at line 457 of file Partridge_All.h.

457  {
458  return m_state;
459  }

References m_state.

◆ GetUncleStatus()

bool Partridge_Base::GetUncleStatus ( )

Supply uncle status.

Definition at line 437 of file Partridge_All.h.

437  {
438  return m_UncleStatus;
439  }

References m_UncleStatus.

Referenced by Partridge_Population_Manager::DissolveCovey().

◆ MakeCovey()

void Partridge_Base::MakeCovey ( void  )

Create our own covey.

Only called when a bird must make a new covey the bird will be the first member and the only one on calling. NB all housekeeping in the population manager is handled by the Covey constructor. The caller is responsible for removing the bird from the present covey before this call is made (or immediately after).

Definition at line 206 of file Partridge_All.cpp.

References m_covey, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, and m_OurPopulationManager.

Referenced by Partridge_Population_Manager::DissolveCovey(), and Partridge_Male::MFindingMate().

◆ PossibleMate()

bool Partridge_Base::PossibleMate ( Partridge_Base a_partridge)

Can we mate?

Checks whether the supplied bird is a potential mate, or is too closely related.

Definition at line 179 of file Partridge_All.cpp.

180 {
181  if ( ( a_partridge->GetFamily() < m_family_counter - 1 || a_partridge->GetFamily() > m_family_counter + 1 )
182  // Possible age check?
183  )
184  {
185  return true;
186  }
187  return false;
188 }

References GetFamily(), and m_family_counter.

◆ SetAge()

void Partridge_Base::SetAge ( int  a_age)

Set age.

Definition at line 477 of file Partridge_All.h.

477  {
478  m_age = a_age;
479  }

References m_age.

Referenced by Partridge_Population_Manager::CreateCloneObjects().

◆ SetCovey()

void Partridge_Base::SetCovey ( Partridge_Covey a_covey)

Set covey pointer.

Definition at line 492 of file Partridge_All.h.

492  {
493  m_covey = a_covey;
494  }

References m_covey.

Referenced by Partridge_Population_Manager::CreateCloneObjects(), Partridge_Population_Manager::CreateInitialObjects(), and Partridge_Covey::ManagerCheckMerge().

◆ SetFamily()

void Partridge_Base::SetFamily ( unsigned int  family)

Set family ID.

Definition at line 487 of file Partridge_All.h.

487  {
488  m_family_counter = family;
489  }

References m_family_counter.

Referenced by Partridge_Male::OnMating().

◆ SetState()

void Partridge_Base::SetState ( Partridge_State  a_pars)

Set state.

Definition at line 462 of file Partridge_All.h.

462  {
463  m_state = a_pars;
464  }

References m_state.

Referenced by Partridge_Population_Manager::Catastrophe(), and Partridge_Covey::SetUncle().

◆ SetUncleStatus()

void Partridge_Base::SetUncleStatus ( bool  a_Status)

◆ SwitchCovey()

void Partridge_Base::SwitchCovey ( Partridge_Covey a_covey)

Swap coveys.

Moves the bird from its cuurent covey to the one supplied.

Definition at line 216 of file Partridge_All.cpp.

217 {
218  m_covey->RemoveMember( this );
219  m_covey = a_covey;
220  m_covey->AddMember( this );
221 }

References Partridge_Covey::AddMember(), m_covey, and Partridge_Covey::RemoveMember().

Referenced by Partridge_Female::OnMating().

Member Data Documentation

◆ m_age

◆ m_born_x

int Partridge_Base::m_born_x

x-coord of birth

Definition at line 412 of file Partridge_All.h.

Referenced by Partridge_Chick2::ChMaturing(), CopyMyself(), and Partridge_Base().

◆ m_born_y

int Partridge_Base::m_born_y

y-coord of birth

Definition at line 414 of file Partridge_All.h.

Referenced by Partridge_Chick2::ChMaturing(), CopyMyself(), and Partridge_Base().

◆ m_covey

◆ m_family_counter

◆ m_id

long Partridge_Base::m_id

Individual bird ID.

Definition at line 406 of file Partridge_All.h.

Referenced by GetID(), and Partridge_Base().

◆ m_object_type

◆ m_OurPopulationManager

◆ m_signal

int Partridge_Base::m_signal

◆ m_state

◆ m_UncleStatus

bool Partridge_Base::m_UncleStatus

If has uncle status in the covey.

Definition at line 416 of file Partridge_All.h.

Referenced by GetUncleStatus(), Partridge_Male::MFindingMate(), Partridge_Female::OnWaitForMale(), Partridge_Base(), and SetUncleStatus().

The documentation for this class was generated from the following files:
Partridge_Object m_object_type
Type of pob object this is.
Definition: Partridge_All.h:418
int RemoveMember(Partridge_Base *a_former_member)
Remove a member from the covey.
Definition: Partridge_Covey.cpp:1664
int m_family_counter
Family ID.
Definition: Partridge_All.h:408
int family_counter
Definition: Partridge_All.h:350
Partridge_State m_state
Current behavioural state.
Definition: Partridge_All.h:422
Landscape * L
Definition: Partridge_All.h:348
Landscape * m_OurLandscape
Definition: populationmanager.h:229
int x
Definition: Partridge_All.h:344
long m_id
Individual bird ID.
Definition: Partridge_All.h:406
TAnimal(int x, int y, Landscape *L)
Definition: PopulationManager.cpp:1367
int m_Location_y
Definition: populationmanager.h:228
static CfgInt cfg_par_base_mortality("PAR_BASE_MORTALITY", CFG_CUSTOM, 0)
int age
Definition: Partridge_All.h:389
bool m_UncleStatus
If has uncle status in the covey.
Definition: Partridge_All.h:416
int m_born_x
x-coord of birth
Definition: Partridge_All.h:412
The collective for a family of partridges
Definition: Partridge_Covey.h:90
int m_signal
Used to pass information to outputs.
Definition: Partridge_All.h:404
int y
Definition: Partridge_All.h:345
bool sex
Definition: Partridge_All.h:388
Struct to pass adult partridge information.
Definition: Partridge_All.h:386
int m_age
Age in days.
Definition: Partridge_All.h:410
int GetFamily(void)
Supply family ID.
Definition: Partridge_All.h:467
Partridge_Population_Manager * m_OurPopulationManager
Pointer to the population manager.
Definition: Partridge_All.h:430
Definition: Partridge_All.h:267
int by
Definition: Partridge_All.h:347
int m_born_y
y-coord of birth
Definition: Partridge_All.h:414
int bx
Definition: Partridge_All.h:346
static long g_partridge_id
Definition: Partridge_All.cpp:151
void CreateCloneObjects(int ob_type, AdultPartridge_struct *as)
Definition: Partridge_Population_Manager.cpp:535
void AddMember(Partridge_Base *a_new_member)
Definition: Partridge_Covey.cpp:1644
int value(void)
Definition: configurator.h:98
Partridge_Covey * m_covey
Pointer to the covey.
Definition: Partridge_All.h:420
Definition: Partridge_All.h:297
int m_Location_x
Definition: populationmanager.h:225