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

Data structure to hold & output probe data probe data is designed to be used to return the number of objects in a given area or areas in specific element or vegetation types or farms. More...

#include <populationmanager.h>

Public Member Functions

void FileOutput (int No, int time, int ProbeNo)
 
void FileAppendOutput (int No, int time)
 
 probe_data ()
 
void SetFile (ofstream *F)
 
ofstream * OpenFile (char *Nme)
 
bool OpenForAppendToFile ()
 
void CloseFile ()
 
 ~probe_data ()
 

Public Attributes

bool m_FileRecord
 
unsigned m_ReportInterval
 
unsigned m_NoAreas
 
rectangle m_Rect [10]
 
unsigned m_NoEleTypes
 
unsigned m_NoVegTypes
 
unsigned m_NoFarms
 
TTypesOfVegetation m_RefVeg [25]
 
TTypesOfLandscapeElement m_RefEle [25]
 
unsigned m_RefFarms [25]
 
bool m_TargetTypes [10]
 

Protected Attributes

ofstream * m_MyFile
 
int m_Time
 
char m_MyFileName [255]
 

Detailed Description

Data structure to hold & output probe data probe data is designed to be used to return the number of objects in a given area or areas in specific element or vegetation types or farms.

Definition at line 283 of file populationmanager.h.

Constructor & Destructor Documentation

◆ probe_data()

probe_data::probe_data ( )

Constructor for probe_data

Definition at line 1479 of file PopulationManager.cpp.

1479  {
1480  m_Time = 0;
1481  m_FileRecord = false;
1482  m_MyFile = NULL;
1483 }

◆ ~probe_data()

probe_data::~probe_data ( )

Destructor for probe_data

Definition at line 1513 of file PopulationManager.cpp.

1513  {
1514 }

Member Function Documentation

◆ CloseFile()

void probe_data::CloseFile ( )

Definition at line 135 of file PopulationManager.cpp.

135  {
136  if ( m_MyFile != NULL ) {
137  if (m_MyFile->is_open()) m_MyFile->close();
138  delete m_MyFile;
139  }
140 };

◆ FileAppendOutput()

void probe_data::FileAppendOutput ( int  No,
int  time 
)

Definition at line 1462 of file PopulationManager.cpp.

1462  {
1463  m_MyFile->open(m_MyFileName,ios::app);
1464  if ( !m_MyFile->is_open() ) {
1465  g_msg->Warn( (MapErrorState)0,"Cannot open file for append: ", m_MyFileName );
1466  exit( 0 );
1467  }
1468  if ( m_FileRecord ) {
1469  (*m_MyFile)<< time << '\t' << No << endl;
1470  }
1471  m_MyFile->close();
1472 }

References g_msg, and MapErrorMsg::Warn().

◆ FileOutput()

void probe_data::FileOutput ( int  No,
int  time,
int  ProbeNo 
)

Basic output function of the default probe data file.
This just counts numbers in specified areas

Definition at line 1447 of file PopulationManager.cpp.

1447  {
1448  if ( m_FileRecord ) {
1449 
1450  if ( ProbeNo == 0 ) {
1451  // First probe so write the time and a new line
1452  (*m_MyFile) << endl;
1453  (*m_MyFile) << time << '\t' << No;
1454  } else
1455  (*m_MyFile) << '\t' << No ;
1456  }
1457  (*m_MyFile).flush();
1458 }

◆ OpenFile()

ofstream * probe_data::OpenFile ( char *  Nme)

Opens the default probe data output file

Definition at line 1490 of file PopulationManager.cpp.

1490  {
1491  m_MyFile = new ofstream( Nme );
1492  if ( !m_MyFile->is_open() ) {
1493  g_msg->Warn( (MapErrorState)0,"probe_data::OpenFile - Cannot open file: ", Nme );
1494  exit( 0 );
1495  }
1496  strcpy( m_MyFileName, Nme );
1497  return m_MyFile;
1498 }

References g_msg, and MapErrorMsg::Warn().

◆ OpenForAppendToFile()

bool probe_data::OpenForAppendToFile ( )
inline

Definition at line 308 of file populationmanager.h.

308  {
309  m_MyFile = new ofstream(m_MyFileName, ios::app);
310  if (!(*m_MyFile).is_open())
311  {
312  g_msg->Warn( WARN_FILE, "PopulationManager::AppendToFile() Unable to open file for append: ", m_MyFileName );
313  exit(1);
314  }
315  return true;
316  }

References g_msg, m_MyFile, m_MyFileName, MapErrorMsg::Warn(), and WARN_FILE.

◆ SetFile()

void probe_data::SetFile ( ofstream *  F)

Sets the filename for the default probe data output

Definition at line 1504 of file PopulationManager.cpp.

1504  {
1505  m_MyFile = F;
1506 }

Member Data Documentation

◆ m_FileRecord

bool probe_data::m_FileRecord

Definition at line 290 of file populationmanager.h.

◆ m_MyFile

ofstream* probe_data::m_MyFile
protected

Definition at line 286 of file populationmanager.h.

Referenced by OpenForAppendToFile().

◆ m_MyFileName

char probe_data::m_MyFileName[255]
protected

Definition at line 288 of file populationmanager.h.

Referenced by OpenForAppendToFile().

◆ m_NoAreas

unsigned probe_data::m_NoAreas

Definition at line 292 of file populationmanager.h.

Referenced by Population_Manager::Probe().

◆ m_NoEleTypes

unsigned probe_data::m_NoEleTypes

Definition at line 294 of file populationmanager.h.

Referenced by Population_Manager::Probe().

◆ m_NoFarms

unsigned probe_data::m_NoFarms

Definition at line 296 of file populationmanager.h.

Referenced by Population_Manager::Probe().

◆ m_NoVegTypes

unsigned probe_data::m_NoVegTypes

Definition at line 295 of file populationmanager.h.

Referenced by Population_Manager::Probe().

◆ m_Rect

rectangle probe_data::m_Rect[10]

Definition at line 293 of file populationmanager.h.

Referenced by Population_Manager::Probe().

◆ m_RefEle

TTypesOfLandscapeElement probe_data::m_RefEle[25]

Definition at line 298 of file populationmanager.h.

Referenced by Population_Manager::Probe().

◆ m_RefFarms

unsigned probe_data::m_RefFarms[25]

Definition at line 299 of file populationmanager.h.

Referenced by Population_Manager::Probe().

◆ m_RefVeg

TTypesOfVegetation probe_data::m_RefVeg[25]

Definition at line 297 of file populationmanager.h.

Referenced by Population_Manager::Probe().

◆ m_ReportInterval

unsigned probe_data::m_ReportInterval

Definition at line 291 of file populationmanager.h.

◆ m_TargetTypes

bool probe_data::m_TargetTypes[10]

Definition at line 301 of file populationmanager.h.

◆ m_Time

int probe_data::m_Time
protected

Definition at line 287 of file populationmanager.h.


The documentation for this class was generated from the following files:
probe_data::m_MyFile
ofstream * m_MyFile
Definition: populationmanager.h:286
probe_data::m_MyFileName
char m_MyFileName[255]
Definition: populationmanager.h:288
g_msg
class MapErrorMsg * g_msg
Definition: maperrormsg.cpp:41
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: maperrormsg.cpp:59
MapErrorState
MapErrorState
Definition: maperrormsg.h:33
probe_data::m_FileRecord
bool m_FileRecord
Definition: populationmanager.h:290
WARN_FILE
Definition: maperrormsg.h:37
probe_data::m_Time
int m_Time
Definition: populationmanager.h:287