ALMaSS Rabbit ODdox  1.1
The rabbit model description following ODdox protocol
RabbitMemory Class Reference

A class to describe the data held in a rabbit memory. Warren locations and quality. More...

#include <Rabbit.h>

Public Member Functions

 RabbitMemory (void)
 Rabbit Memory constructor. More...
 
void Update (void)
 daily update of the memory More...
 
void AddMemory (RabbitMemoryLocation a_mem)
 Add a memory location. More...
 
RabbitMemoryLocation GetBestLocation (void)
 Get the best current location
More...
 

Public Attributes

vector< RabbitMemoryLocationm_MyMemory
 A list of memory locations. More...
 

Detailed Description

A class to describe the data held in a rabbit memory. Warren locations and quality.

Definition at line 150 of file Rabbit.h.

Constructor & Destructor Documentation

◆ RabbitMemory()

RabbitMemory::RabbitMemory ( void  )

Rabbit Memory constructor.

Definition at line 127 of file Rabbit.cpp.

128 {
129  m_MyMemory.resize(0);
130 }

Member Function Documentation

◆ AddMemory()

void RabbitMemory::AddMemory ( RabbitMemoryLocation  a_mem)

Add a memory location.

Definition at line 140 of file Rabbit.cpp.

141 {
142  a_mem.m_decay=100; // Assuming 100 days memory
143  m_MyMemory.push_back(a_mem);
144 }

References RabbitMemoryLocation::m_decay.

◆ GetBestLocation()

RabbitMemoryLocation RabbitMemory::GetBestLocation ( void  )

Get the best current location

Definition at line 146 of file Rabbit.cpp.

147 {
148  vector<RabbitMemoryLocation>::iterator best;
149  int score = -1;
150  for(vector<RabbitMemoryLocation>::iterator it = m_MyMemory.begin(); it != m_MyMemory.end(); ++it)
151  {
152  if ((*it).m_quality > score) best=it;
153  }
154  return (*best);
155 }

◆ Update()

void RabbitMemory::Update ( void  )

daily update of the memory

Definition at line 132 of file Rabbit.cpp.

133 {
134  for(vector<RabbitMemoryLocation>::iterator it = m_MyMemory.begin(); it != m_MyMemory.end(); ++it)
135  {
136  if ((*it).m_decay-- < 1) m_MyMemory.erase(it);
137  }
138 }

Member Data Documentation

◆ m_MyMemory

vector<RabbitMemoryLocation> RabbitMemory::m_MyMemory

A list of memory locations.

Definition at line 156 of file Rabbit.h.


The documentation for this class was generated from the following files:
RabbitMemory::m_MyMemory
vector< RabbitMemoryLocation > m_MyMemory
A list of memory locations.
Definition: Rabbit.h:156
RabbitMemoryLocation::m_decay
int m_decay
Definition: Rabbit.h:136