ALMaSS Rabbit ODdox  1.00
The rabbit model description following ODdox protocol
Public Member Functions | Public Attributes | Protected Attributes | List of all members
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 279 of file populationmanager.h.

Constructor & Destructor Documentation

probe_data::probe_data ( )

Constructor for probe_data

Definition at line 1549 of file PopulationManager.cpp.

1549  {
1550  m_Time = 0;
1551  m_FileRecord = false;
1552  m_MyFile = NULL;
1553 }
ofstream * m_MyFile
probe_data::~probe_data ( )

Destructor for probe_data

Definition at line 1583 of file PopulationManager.cpp.

1583  {
1584 }

Member Function Documentation

void probe_data::CloseFile ( )

Definition at line 136 of file PopulationManager.cpp.

136  {
137  if ( m_MyFile != NULL ) {
138  if (m_MyFile->is_open()) m_MyFile->close();
139  delete m_MyFile;
140  }
141 };
ofstream * m_MyFile
void probe_data::FileAppendOutput ( int  No,
int  time 
)

Definition at line 1532 of file PopulationManager.cpp.

References g_msg, and MapErrorMsg::Warn().

1532  {
1533  m_MyFile->open(m_MyFileName,ios::app);
1534  if ( !m_MyFile->is_open() ) {
1535  g_msg->Warn( (MapErrorState)0,"Cannot open file for append: ", m_MyFileName );
1536  exit( 0 );
1537  }
1538  if ( m_FileRecord ) {
1539  (*m_MyFile)<< time << '\t' << No << endl;
1540  }
1541  m_MyFile->close();
1542 }
ofstream * m_MyFile
class MapErrorMsg * g_msg
Definition: maperrormsg.cpp:38
char m_MyFileName[255]
MapErrorState
Definition: maperrormsg.h:33
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: maperrormsg.cpp:56
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 1517 of file PopulationManager.cpp.

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

Opens the default probe data output file

Definition at line 1560 of file PopulationManager.cpp.

References g_msg, and MapErrorMsg::Warn().

1560  {
1561  m_MyFile = new ofstream( Nme );
1562  if ( !m_MyFile->is_open() ) {
1563  g_msg->Warn( (MapErrorState)0,"probe_data::OpenFile - Cannot open file: ", Nme );
1564  exit( 0 );
1565  }
1566  strcpy( m_MyFileName, Nme );
1567  return m_MyFile;
1568 }
ofstream * m_MyFile
class MapErrorMsg * g_msg
Definition: maperrormsg.cpp:38
char m_MyFileName[255]
MapErrorState
Definition: maperrormsg.h:33
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: maperrormsg.cpp:56
bool probe_data::OpenForAppendToFile ( )
inline

Definition at line 304 of file populationmanager.h.

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

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
class MapErrorMsg * g_msg
Definition: maperrormsg.cpp:38
char m_MyFileName[255]
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: maperrormsg.cpp:56
void probe_data::SetFile ( ofstream *  F)

Sets the filename for the default probe data output

Definition at line 1574 of file PopulationManager.cpp.

1574  {
1575  m_MyFile = F;
1576 }
ofstream * m_MyFile

Member Data Documentation

bool probe_data::m_FileRecord

Definition at line 286 of file populationmanager.h.

ofstream* probe_data::m_MyFile
protected

Definition at line 282 of file populationmanager.h.

char probe_data::m_MyFileName[255]
protected

Definition at line 284 of file populationmanager.h.

unsigned probe_data::m_NoAreas

Definition at line 288 of file populationmanager.h.

Referenced by Population_Manager::Probe().

unsigned probe_data::m_NoEleTypes

Definition at line 290 of file populationmanager.h.

Referenced by Population_Manager::Probe().

unsigned probe_data::m_NoFarms

Definition at line 292 of file populationmanager.h.

Referenced by Population_Manager::Probe().

unsigned probe_data::m_NoVegTypes

Definition at line 291 of file populationmanager.h.

Referenced by Population_Manager::Probe().

rectangle probe_data::m_Rect[10]

Definition at line 289 of file populationmanager.h.

Referenced by Population_Manager::Probe().

TTypesOfLandscapeElement probe_data::m_RefEle[25]

Definition at line 294 of file populationmanager.h.

Referenced by Population_Manager::Probe().

unsigned probe_data::m_RefFarms[25]

Definition at line 295 of file populationmanager.h.

Referenced by Population_Manager::Probe().

TTypesOfVegetation probe_data::m_RefVeg[25]

Definition at line 293 of file populationmanager.h.

Referenced by Population_Manager::Probe().

unsigned probe_data::m_ReportInterval

Definition at line 287 of file populationmanager.h.

bool probe_data::m_TargetTypes[10]

Definition at line 297 of file populationmanager.h.

int probe_data::m_Time
protected

Definition at line 283 of file populationmanager.h.


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