ALMaSS Rodenticide Model ODdox  1.0
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 CloseFile ()
 
void FileAppendOutput (int No, int time)
 
void FileOutput (int No, int time, int ProbeNo)
 
ofstream * OpenFile (char *Nme)
 
bool OpenForAppendToFile ()
 
 probe_data ()
 
void SetFile (ofstream *F)
 
 ~probe_data ()
 

Public Attributes

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

Protected Attributes

ofstream * m_MyFile
 
char m_MyFileName [255]
 
int m_Time
 

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.

Constructor & Destructor Documentation

probe_data::probe_data ( )

Constructor for probe_data

1548  {
1549  m_Time = 0;
1550  m_FileRecord = false;
1551  m_MyFile = NULL;
1552 }
ofstream * m_MyFile
Definition: PopulationManager.h:282
bool m_FileRecord
Definition: PopulationManager.h:286
int m_Time
Definition: PopulationManager.h:283
probe_data::~probe_data ( )

Destructor for probe_data

1582  {
1583 }

Member Function Documentation

void probe_data::CloseFile ( )

Referenced by CloseDownSim().

136  {
137  if ( m_MyFile != NULL ) {
138  if (m_MyFile->is_open()) m_MyFile->close();
139  delete m_MyFile;
140  }
141 };
ofstream * m_MyFile
Definition: PopulationManager.h:282
void probe_data::FileAppendOutput ( int  No,
int  time 
)
1531  {
1532  m_MyFile->open(m_MyFileName,ios::app);
1533  if ( !m_MyFile->is_open() ) {
1534  g_msg->Warn( (MapErrorState)0,"Cannot open file for append: ", m_MyFileName );
1535  exit( 0 );
1536  }
1537  if ( m_FileRecord ) {
1538  (*m_MyFile)<< time << '\t' << No << endl;
1539  }
1540  m_MyFile->close();
1541 }
ofstream * m_MyFile
Definition: PopulationManager.h:282
char m_MyFileName[255]
Definition: PopulationManager.h:284
bool m_FileRecord
Definition: PopulationManager.h:286
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

1516  {
1517  if ( m_FileRecord ) {
1518 
1519  if ( ProbeNo == 0 ) {
1520  // First probe so write the time and a new line
1521  (*m_MyFile) << endl;
1522  (*m_MyFile) << time << '\t' << No;
1523  } else
1524  (*m_MyFile) << '\t' << No ;
1525  }
1526  (*m_MyFile).flush();
1527 }
ofstream * m_MyFile
Definition: PopulationManager.h:282
bool m_FileRecord
Definition: PopulationManager.h:286
ofstream * probe_data::OpenFile ( char *  Nme)

Opens the default probe data output file

Referenced by GetProbeInput_ini().

1559  {
1560  m_MyFile = new ofstream( Nme );
1561  if ( !m_MyFile->is_open() ) {
1562  g_msg->Warn( (MapErrorState)0,"probe_data::OpenFile - Cannot open file: ", Nme );
1563  exit( 0 );
1564  }
1565  strcpy( m_MyFileName, Nme );
1566  return m_MyFile;
1567 }
ofstream * m_MyFile
Definition: PopulationManager.h:282
char m_MyFileName[255]
Definition: PopulationManager.h:284
bool probe_data::OpenForAppendToFile ( )
inline
304  {
305  m_MyFile = new ofstream(m_MyFileName, ios::app);
306  if (!(*m_MyFile).is_open())
307  {
308  g_msg->Warn( WARN_FILE, "PopulationManager::AppendToFile() Unable to open file for append: ", m_MyFileName );
309  exit(1);
310  }
311  return true;
312  }
ofstream * m_MyFile
Definition: PopulationManager.h:282
char m_MyFileName[255]
Definition: PopulationManager.h:284
void probe_data::SetFile ( ofstream *  F)

Sets the filename for the default probe data output

Referenced by GetProbeInput_ini().

1573  {
1574  m_MyFile = F;
1575 }
ofstream * m_MyFile
Definition: PopulationManager.h:282

Member Data Documentation

bool probe_data::m_FileRecord
ofstream* probe_data::m_MyFile
protected
char probe_data::m_MyFileName[255]
protected
unsigned probe_data::m_NoAreas
unsigned probe_data::m_NoEleTypes
unsigned probe_data::m_NoFarms
unsigned probe_data::m_NoVegTypes
rectangle probe_data::m_Rect[10]
TTypesOfLandscapeElement probe_data::m_RefEle[25]
unsigned probe_data::m_RefFarms[25]
TTypesOfVegetation probe_data::m_RefVeg[25]
unsigned probe_data::m_ReportInterval
bool probe_data::m_TargetTypes[10]
int probe_data::m_Time
protected

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