BaseRegmas Class Reference

Base class for the regmas application. More...

#include <BaseRegmas.h>

Inheritance diagram for BaseRegmas:

Inheritance graph
[legend]
Collaboration diagram for BaseRegmas:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 BaseRegmas ()
 ~BaseRegmas ()
void msgOut (int msgCode_h, string msg_h, bool refreshGUI_h=true) const
 Overloaded function to print the output log.
void msgOut (int msgCode_h, int msg_h, bool refreshGUI_h=true) const
 Overloaded function to print the output log.
void msgOut (int msgCode_h, double msg_h, bool refreshGUI_h=true) const
 Overloaded function to print the output log.
int s2i (string string_h) const
 string to integer conversion
double s2d (string string_h) const
 string to double conversion
bool s2b (string string_h) const
 string to bool conversion
string i2s (int int_h) const
 integer to string conversion
string d2s (double double_h) const
 double to string conversion
string b2s (bool bool_h) const
 bool to string conversion
vector< int > s2i (vector< string > string_h) const
 string to integer conversion (vector)
vector< double > s2d (vector< string > string_h) const
 string to double conversion (vector)
vector< bool > s2b (vector< string > string_h) const
 string to bool conversion (vector)
vector< string > i2s (vector< int > int_h) const
 integer to string conversion (vector)
vector< string > d2s (vector< double > double_h) const
 double to string conversion (vector)
vector< string > b2s (vector< bool > bool_h) const
 bool to string conversion (vector)
int getType (string &type_h)
void refreshGUI () const
 Ping to periodically return the control to the GUI.
template<typename T>
string toString (const T &x)
template<typename T>
stringTo (const std::string &s)
int iVSum (const vector< int > &intVector_h)
 integer vector sum - sum of an vector of integer;
double dVSum (const vector< double > &doubleVector_h)
 double vector sum - sum of a vectr of double;
void tokenize (const string &str, vector< string > &tokens, const string &delimiter=" ")
 Tokenize a string using a delimiter (default is space).

Protected Attributes

ThreadManagerMTHREAD
 Pointer to the Thread manager.

Private Member Functions

void msgOut2 (int msgCode_h, string msg_h, bool refreshGUI_h) const
 Do the job of the overloaded functions.

Detailed Description

Base class for the regmas application.

This class is the base class for all classes in regmas. \ It provides common methods in all parts of the application for printing the output, converting strings vs. values or regularly "ping" the GUI. \

Author:
Antonello Lobianco

Definition at line 109 of file BaseRegmas.h.


Constructor & Destructor Documentation

BaseRegmas (  ) 

Definition at line 27 of file BaseRegmas.cpp.

~BaseRegmas (  ) 

Definition at line 32 of file BaseRegmas.cpp.


Member Function Documentation

void msgOut ( int  msgCode_h,
string  msg_h,
bool  refreshGUI_h = true 
) const

Overloaded function to print the output log.

Overloaded method for the output log:

Parameters:
msgCode_h,: MSG_DEBUG, MSG_INFO, MSG_WARNING, MSG_ERROR, MSG_CRITICAL_ERROR
msg_h,: message text (string)
refreshGUI_h,: use this call to "ping" the GUI (optional, default=true)

Definition at line 45 of file BaseRegmas.cpp.

Referenced by Pixel::acquireObject(), Manager_farmers::act(), Gis::addLayer(), Layers::addLegendItem(), Gis::addLegendItem(), Gis::addReclassificationRule(), RegData::addSetting(), Manager_base::assignObjectsToAgents(), Manager_farmers::assignPlot(), Manager_space::assignSpatialObjectsToAgents(), Manager_farmers::calibrateLandValues(), Pixel::changeValue(), LLData::clean(), Output::cleanScenario(), Agent_farmer::collectProductionEffects(), Gis::countItems(), Layers::countMyPixels(), Manager_farmers::createBehaviours(), Opt::debug(), RegData::delDir(), Layers::filterExogenousDataset(), RegData::getActGisCodeByName(), Opt::getActivityObjValue(), Manager_base::getAgentByLocalID(), Gis::getAllPlots(), Gis::getAllPlotsByValue(), RegData::getBaseData(), InputNode::getBoolContent(), Agent_base::getCalculatedResourceByName(), LLData::getData(), InputNode::getDoubleAttributeByName(), Pixel::getDoubleValue(), Agent_base::getInitialResourceByName(), InputNode::getIntAttributeByName(), RegActivities::getMatrixCoefficientByName(), InputNode::getNodeByName(), InputNode::getNodesByName(), Agent_space::getNPlots(), RegData::getObjectByName(), Output::getOutputFieldDelimiter(), Pixel::getPixelsAtDistLevel(), Agent_space::getPlots(), Manager_base::getRandomAgents(), Gis::getRandomPlotByValue(), RegData::getRegActivityByName(), Agent_base::getResource(), RegData::getResourceByName(), RegData::getScenarioIndex(), Sandbox::getSetting(), Pixel::getStartingRentalCosts(), InputNode::getStringAttributeByName(), Output::getSurveyActivityByName(), RegData::getTable(), getType(), RegData::getVectorBaseData(), Gis::initLayers(), Output::initOutputAggregatedData(), Output::initOutputDetailedData(), Output::initOutputLeavingAgents(), Output::initOutputMaps(), Manager_farmers::landAllocation(), Agent_farmer::leaveActivity(), RegData::loadInput(), Gis::loadLayersDataFromFile(), Manager_farmers::locateMyAgents(), Manager_farmers::Manager_farmers(), Manager_farmers::planNext(), Manager_farmers::prepare(), Layers::print(), Output::printAggregatedData(), Gis::printBinMaps(), Gis::printDebugValues(), Output::printDetailedData(), Gis::printLayers(), Output::printLeavingAgent(), Gis::resetLayer(), Manager_farmers::riseMyAgents(), Scheduler::run(), s2b(), Manager_farmers::setAgentMoulds(), RegData::setBasicData(), RegData::setDefaultSettings(), Init::setInitLevel(), Init::setInitLevel1(), Init::setInitLevel6(), Pixel::setRandomRenting(), RegData::setResources(), RegData::setScenarioActivities(), RegData::setScenarioSettings(), Gis::setSpace(), InputNode::setWorkingFile(), Opt::solveGlpk(), Gis::sub2realID(), Opt::test(), Manager_farmers::update(), and Gis::updateImage().

Here is the caller graph for this function:

void msgOut ( int  msgCode_h,
int  msg_h,
bool  refreshGUI_h = true 
) const

Overloaded function to print the output log.

Overloaded method for the output log:

Parameters:
msgCode_h,: MSG_DEBUG, MSG_INFO, MSG_WARNING, MSG_ERROR, MSG_CRITICAL_ERROR
msg_h,: message text (int)
refreshGUI_h,: use this call to "ping" the GUI (optional, default=true)

Definition at line 60 of file BaseRegmas.cpp.

void msgOut ( int  msgCode_h,
double  msg_h,
bool  refreshGUI_h = true 
) const

Overloaded function to print the output log.

Overloaded method for the output log:

Parameters:
msgCode_h,: MSG_DEBUG, MSG_INFO, MSG_WARNING, MSG_ERROR, MSG_CRITICAL_ERROR
msg_h,: message text (double)
refreshGUI_h,: use this call to "ping" the GUI (optional, default=true)

Definition at line 75 of file BaseRegmas.cpp.

int s2i ( string  string_h  )  const

string to integer conversion

Definition at line 144 of file BaseRegmas.cpp.

Referenced by RegData::getIntSetting(), RegData::getIntVectorSetting(), Manager_farmers::setAgentMoulds(), RegData::setDefaultActivities(), and RegData::setObjectsDefinitions().

Here is the caller graph for this function:

double s2d ( string  string_h  )  const

string to double conversion

Definition at line 155 of file BaseRegmas.cpp.

Referenced by RegData::getDoubleSetting(), RegData::getDoubleVectorSetting(), Manager_farmers::setAgentMoulds(), RegData::setDefaultActivities(), RegData::setObjectsDefinitions(), and RegData::setScenarioActivities().

Here is the caller graph for this function:

bool s2b ( string  string_h  )  const

string to bool conversion

Definition at line 168 of file BaseRegmas.cpp.

Referenced by RegData::getBoolSetting(), RegData::getBoolVectorSetting(), and s2b().

Here is the caller graph for this function:

string i2s ( int  int_h  )  const

integer to string conversion

Definition at line 179 of file BaseRegmas.cpp.

Referenced by Opt::addPixel(), Manager_farmers::calibrateLandValues(), LLData::clean(), ThreadManager::computeQuery(), Layers::countMyPixels(), Opt::debug(), Gis::getAllPlotsByValue(), LLData::getData(), Pixel::getDoubleValue(), Manager_base::getRandomAgents(), Agent_base::getResource(), Pixel::getStartingRentalCosts(), Output::initOutputDetailedData(), Pixel::isAgricultural(), Manager_farmers::landAllocation(), Agent_farmer::leaveActivity(), Manager_farmers::locateMyAgents(), Manager_farmers::planNext(), Layers::print(), Output::printAggregatedData(), Layers::printBinMap(), Gis::printDebugValues(), Output::printDetailedData(), Manager_farmers::riseMyAgents(), Scheduler::run(), Manager_farmers::setAgentMoulds(), RegData::setBasicData(), RegData::setDefaultActivities(), RegData::setDefaultSettings(), RegData::setObjectsDefinitions(), RegData::setScenarioActivities(), RegData::setScenarioSettings(), InputNode::setWorkingFile(), Opt::solveGlpk(), ThreadManager::treeViewerAddAgent(), ThreadManager::treeViewerAddAgentProperty(), ThreadManager::treeViewerAgentPropertyChangeValue(), ThreadManager::treeViewerRemoveAgent(), Manager_farmers::update(), Opt::updateActivities(), and ThreadManager::upgradeYearSBLabel().

Here is the caller graph for this function:

string d2s ( double  double_h  )  const

double to string conversion

Definition at line 186 of file BaseRegmas.cpp.

Referenced by Opt::addPixel(), Layers::countMyPixels(), Manager_farmers::createBehaviours(), Layers::filterExogenousDataset(), Gis::getAllPlotsByValue(), Gis::getRandomPlotByValue(), Gis::initLayers(), Pixel::isAgricultural(), Manager_farmers::landAllocation(), Manager_farmers::locateMyAgents(), Layers::print(), Output::printAggregatedData(), Gis::printDebugValues(), Output::printDetailedData(), Scheduler::run(), RegData::setBasicData(), RegData::setDefaultSettings(), Init::setInitLevel5(), RegData::setScenarioSettings(), Gis::setSpace(), Opt::test(), Manager_farmers::update(), Opt::updateActivities(), and Opt::updateResourceNames().

Here is the caller graph for this function:

string b2s ( bool  bool_h  )  const

bool to string conversion

Definition at line 193 of file BaseRegmas.cpp.

Referenced by Output::printDetailedData(), and RegData::setBasicData().

Here is the caller graph for this function:

vector< int > s2i ( vector< string >  string_h  )  const

string to integer conversion (vector)

Definition at line 203 of file BaseRegmas.cpp.

vector< double > s2d ( vector< string >  string_h  )  const

string to double conversion (vector)

Definition at line 220 of file BaseRegmas.cpp.

vector< bool > s2b ( vector< string >  string_h  )  const

string to bool conversion (vector)

Definition at line 239 of file BaseRegmas.cpp.

vector< string > i2s ( vector< int >  int_h  )  const

integer to string conversion (vector)

Definition at line 248 of file BaseRegmas.cpp.

vector< string > d2s ( vector< double >  double_h  )  const

double to string conversion (vector)

Definition at line 259 of file BaseRegmas.cpp.

vector< string > b2s ( vector< bool >  bool_h  )  const

bool to string conversion (vector)

Definition at line 270 of file BaseRegmas.cpp.

int getType ( string &  type_h  ) 

Return a type according to enum TYPE_* from a string (eg: "string" -> TYPE_STRING (2)).
If we pass it an unknow type it generates an error.

Definition at line 283 of file BaseRegmas.cpp.

Referenced by RegData::setDefaultSettings(), and RegData::setScenarioSettings().

Here is the caller graph for this function:

void refreshGUI (  )  const

Ping to periodically return the control to the GUI.

Definition at line 137 of file BaseRegmas.cpp.

Referenced by Manager_farmers::calibrateLandValues(), Manager_farmers::landAllocation(), Gis::loadLayersDataFromFile(), Manager_farmers::locateMyAgents(), msgOut2(), MainProgram::run(), Opt::update(), and Gis::updateImage().

Here is the caller graph for this function:

std::string toString ( const T &  x  ) 

Definition at line 295 of file BaseRegmas.cpp.

T stringTo ( const std::string &  s  ) 

Definition at line 302 of file BaseRegmas.cpp.

int iVSum ( const vector< int > &  intVector_h  ) 

integer vector sum - sum of an vector of integer;

Definition at line 311 of file BaseRegmas.cpp.

Referenced by Output::getSurveyUnusedLand(), Output::printAggregatedData(), and Output::printDetailedData().

Here is the caller graph for this function:

double dVSum ( const vector< double > &  doubleVector_h  ) 

double vector sum - sum of a vectr of double;

Definition at line 320 of file BaseRegmas.cpp.

Referenced by Agent_farmer::getDecoupledPayments().

Here is the caller graph for this function:

void tokenize ( const string &  str,
vector< string > &  tokens,
const string &  delimiter = " " 
)

Tokenize a string using a delimiter (default is space).

Definition at line 330 of file BaseRegmas.cpp.

Referenced by Output::cleanScenario(), and RegData::setScenarioActivities().

Here is the caller graph for this function:

void msgOut2 ( int  msgCode_h,
string  msg_h,
bool  refreshGUI_h 
) const [private]

Do the job of the overloaded functions.

Convenient (private) function to actually do the job of the overloaded functions

Definition at line 88 of file BaseRegmas.cpp.

Referenced by msgOut().

Here is the caller graph for this function:


Member Data Documentation

ThreadManager* MTHREAD [protected]

Pointer to the Thread manager.

Pointer to the Thread Manager. \ Through this pointer each deribed subclass (the vast maiority of those used on RegMAS) can "ask" for sending signals to the GUI, like append the log or modify the map.

Definition at line 156 of file BaseRegmas.h.

Referenced by Pixel::acquireObject(), Agent_base::acquireObject(), Manager_farmers::act(), Gis::addLayer(), Opt::addPixel(), Agent_base::Agent_base(), Agent_farmer::Agent_farmer(), Agent_space::Agent_space(), Agent_base::answerStats(), Agent_farmer::applyModulation(), Manager_base::assignObjectsToAgents(), Manager_farmers::assignPlot(), Manager_space::assignSpatialObjectsToAgents(), BaseRegmas(), Manager_farmers::calibrateLandValues(), Output::collectData(), Agent_farmer::collectProductionEffects(), Layers::countMyPixels(), Manager_farmers::createBehaviours(), Opt::debug(), Manager_farmers::endInit(), Agent_farmer::filterActivity(), Gis::filterSubRegion(), ModelObject::getAge(), Gis::getAgrDistCost(), Agent_farmer::getAgrDistCost(), Manager_farmers::getAverageRightsByAct(), RegData::getBaseData(), RegData::getBoolSetting(), RegData::getBoolVectorSetting(), Agent_base::getCalculatedResourceByName(), Layers::getCategory(), Gis::getClosestAgents(), Layers::getColor(), Agent_farmer::getDecoupledPayments(), RegActivities::getDecouplingOption(), Agent_space::getDistance(), RegData::getDoubleSetting(), Pixel::getDoubleValue(), RegData::getDoubleVectorSetting(), RegData::getIntSetting(), RegData::getIntVectorSetting(), RegActivities::getMatrixActRes(), RegActivities::getMatrixCoefficientByName(), RegActivities::getMatrixCoefficients(), ModelObject::getMatrixCoefficients(), RegActivities::getMatrixGrossMargin(), RegData::getModelObjectsBySoilType(), RegData::getObjectByName(), Output::getOutputFieldDelimiter(), Pixel::getPixelsAtDistLevel(), Pixel::getRentingAge(), Agent_base::getResource(), RegData::getScenarioIndex(), Pixel::getStartingRentalCosts(), RegData::getStringSetting(), RegData::getStringVectorSetting(), Output::getSurveyActivityByName(), Output::getSurveyUnusedLand(), RegData::getTable(), Agent_farmer::getUAA(), Scheduler::getYear(), Gis::Gis(), Init::Init(), Gis::initLayers(), Pixel::initObjects(), Output::initOutputAggregatedData(), Output::initOutputDetailedData(), Output::initOutputLeavingAgents(), Output::initOutputMaps(), Gis::isAgrCode(), Pixel::isAgricultural(), Manager_farmers::landAllocation(), Layers::Layers(), Agent_farmer::leaveActivity(), LLData::LLData(), RegData::loadInput(), Gis::loadLayersDataFromFile(), Manager_farmers::locateMyAgents(), MainProgram::MainProgram(), Manager_base::Manager_base(), ModelObject::ModelObject(), msgOut2(), Pixel::newYear(), Agent_farmer::offerRentalPrice(), Opt::Opt(), Output::Output(), Pixel::Pixel(), Manager_farmers::planNext(), Manager_farmers::prepare(), Layers::print(), Output::printAggregatedData(), Layers::printBinMap(), Gis::printBinMaps(), Output::printDebugMatrices(), Gis::printDebugValues(), Output::printDetailedData(), Gis::printLayers(), Output::printLeavingAgent(), Output::printMaps(), Manager_farmers::quotePlot(), Layers::randomShuffle(), refreshGUI(), RegActivities::RegActivities(), RegData::RegData(), Manager_farmers::removeFromModel(), Manager_farmers::riseMyAgents(), Scheduler::run(), MainProgram::run(), Sandbox::Sandbox(), Scheduler::Scheduler(), Manager_farmers::setAgentMoulds(), RegData::setDefaultActivities(), RegData::setDefaultSettings(), Init::setInitLevel1(), Init::setInitLevel3(), Init::setInitLevel5(), RegData::setObjectsDefinitions(), RegData::setOutputDirectory(), ModelObject::setRandomAge(), Pixel::setRandomRenting(), Pixel::setRemainingRentingTerm(), RegData::setScenarioActivities(), RegData::setScenarioSettings(), Gis::setSpace(), Opt::solveGlpk(), Gis::sub2realID(), SuperAgentManager::SuperAgentManager(), SuperAgentManager::update(), Manager_farmers::update(), Agent_farmer::update(), Opt::updateActivities(), Gis::updateImage(), Opt::updateResourceNames(), Opt::updateResourceValues(), Agent_base::withdraw(), Agent_base::~Agent_base(), and Manager_base::~Manager_base().


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