ALMaSS  1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
CfgInt Class Reference

Integer configurator entry class. More...

#include <Configurator.h>

Inheritance diagram for CfgInt:
CfgBase

Public Member Functions

 CfgInt (const std::string &a_key, CfgSecureLevel a_level, int a_defval)
 
 CfgInt (const std::string &a_key, CfgSecureLevel a_level, int a_defval, int a_min, int a_max)
 
 CfgInt (const std::string &a_key, CfgSecureLevel a_level, int a_defval, bool a_definedinconfig)
 
 CfgInt (const std::string &a_key, CfgSecureLevel a_level, int a_defval, int a_min, int a_max, bool a_definconf)
 
int value () const
 
void set (int a_newval)
 
CfgType gettype () override
 
double getmax () const
 
double getmin () const
 
- Public Member Functions inherited from CfgBase
 CfgBase (const std::string &a_key, CfgSecureLevel a_level)
 
 CfgBase (const std::string &a_key, CfgSecureLevel a_level, bool a_definedinconfig)
 
virtual ~CfgBase ()
 
std::string getkey ()
 
CfgSecureLevel getlevel (void)
 
void set_definedinconfig (bool flag)
 
bool get_definedinconfig () const
 
bool get_rangetest () const
 

Protected Attributes

int m_int
 
int m_max {}
 
int m_min {}
 
- Protected Attributes inherited from CfgBase
std::string m_key
 
CfgSecureLevel m_level
 
bool m_rangetest
 
bool m_definedinconfig {false}
 

Detailed Description

Integer configurator entry class.

Constructor & Destructor Documentation

◆ CfgInt() [1/4]

CfgInt::CfgInt ( const std::string &  a_key,
CfgSecureLevel  a_level,
int  a_defval 
)
113  :CfgBase(a_key, a_level)
114 {
115  m_int = a_defval;
116  g_cfg->Register( this, a_key );
117 }

References g_cfg, and m_int.

◆ CfgInt() [2/4]

CfgInt::CfgInt ( const std::string &  a_key,
CfgSecureLevel  a_level,
int  a_defval,
int  a_min,
int  a_max 
)

Constructor with max min checking enabled

125  :CfgBase(a_key, a_level)
126 {
128  m_min = a_min;
129  m_max = a_max;
130  m_int = a_defval;
131  m_rangetest = true;
132  g_cfg->Register( this, a_key );
133 }

References g_cfg, m_int, m_max, m_min, and CfgBase::m_rangetest.

◆ CfgInt() [3/4]

CfgInt::CfgInt ( const std::string &  a_key,
CfgSecureLevel  a_level,
int  a_defval,
bool  a_definedinconfig 
)

A special constructor to be used for dynamically allocated configs

119  :CfgBase{a_key, a_level,a_definconf}
120 {
122  m_int = a_defval;
123 }

◆ CfgInt() [4/4]

CfgInt::CfgInt ( const std::string &  a_key,
CfgSecureLevel  a_level,
int  a_defval,
int  a_min,
int  a_max,
bool  a_definconf 
)

Constructor with max min checking enabled

134  :CfgBase(a_key, a_level)
135 {
137  m_min = a_min;
138  m_max = a_max;
139  m_rangetest = true;
140  m_int = a_defval;
141  g_cfg->Register( this, a_key );
142 }

References g_cfg, m_int, m_max, m_min, and CfgBase::m_rangetest.

Member Function Documentation

◆ getmax()

double CfgInt::getmax ( ) const
inline
119 {return m_max;}

References m_max.

◆ getmin()

double CfgInt::getmin ( ) const
inline
120 {return m_min;}

References m_min.

◆ gettype()

CfgType CfgInt::gettype ( void  )
inlineoverridevirtual

Reimplemented from CfgBase.

118 { return CFG_INT; }

References CFG_INT.

◆ set()

void CfgInt::set ( int  a_newval)
144  {
145  if (m_rangetest) {
146  if ((a_newval<m_min) || (a_newval>m_max))
147  {
148  g_msg->Warn(WARN_FILE, "CfgInt::set Value out of range: ", a_newval);
149  g_msg->Warn("Name: ", m_key);
150  g_msg->Warn(WARN_FILE, "CfgInt::set Max allowed: ", m_max);
151  g_msg->Warn(WARN_FILE, "CfgInt::set Min allowed: ", m_min);
152  }
153  }
154  m_int = a_newval;
155 }

References g_msg, m_int, CfgBase::m_key, m_max, m_min, CfgBase::m_rangetest, MapErrorMsg::Warn(), and WARN_FILE.

◆ value()

int CfgInt::value ( ) const
inline
116 { return m_int; }

References m_int.

Referenced by Landscape::AddBeetleBankIfPossible(), Landscape::AddBeetleBanks(), Landscape::AddPatches(), Landscape::AddPatchIfPossible(), PesticideStore::addPesticide(), Hare_Female::AllYoungKilled(), Hare_Female::AllYoungMatured(), AOR_Probe::AOR_Probe(), Crop::AphidDamage(), Spider_Juvenile::AssessHabitat(), Spider_Juvenile::BalloonTo(), Beetle_Population_Manager::Beetle_Population_Manager(), Population_Manager::BeginningOfMonth(), Ladybird_Larvae1::BeginStep(), Ladybird_Pupae::BeginStep(), Hare_Young::BeginStep(), Hare_Juvenile::BeginStep(), Hare_Male::BeginStep(), Hare_Female::BeginStep(), Bembidion_Population_Manager::Bembidion_Population_Manager(), Landscape::BorderAdd(), Landscape::BuildingDesignationCalc(), Landscape::CalHaibitatFlowerResource(), Vole_Male::CanFeed(), Erigone_Population_Manager::Catastrophe(), Oedothorax_Population_Manager::Catastrophe(), Vole_Population_Manager::Catastrophe(), Skylark_Population_Manager::Catastrophe(), THare_Population_Manager::Catastrophe(), Beetle_Population_Manager::Catastrophe(), Beetle_Population_Manager::Catastrophe2(), Beetle_Adult::CheckForDispersal(), Beetle_Adult::CheckReproduction(), FarmManager::CreateFarms(), CreatePopulationManager(), Crop::Crop(), Beetle_Egg_List::DailyMortality(), Ladybird_Population_Manager::DayDegreeCalculations(), Beetle_Adult::DDepMort(), Pesticide::DiffusionVectorInit(), Vole_JuvenileMale::Dispersal(), Vole_Male::Dispersal(), Vole_JuvenileFemale::Dispersal(), OrchardCrop::Do(), DK_GrassTussocky_Perm::Do(), DK_OGrassLowYield_Perm::Do(), DK_GrassLowYield_Perm::Do(), CloverGrassGrazed2::Do(), FodderGrass::Do(), CloverGrassGrazed1::Do(), SpringBarleyCloverGrass::Do(), DK_WinterFodderGrass::Do(), DK_SpringFodderGrass::Do(), DK_WinterCloverGrassGrazedSown::Do(), DK_OGrassGrazed_Perm::Do(), SpringBarleySilage::Do(), DK_GrassGrazed_Perm::Do(), SpringBarleyPTreatment::Do(), SpringBarleyStriglingCulm::Do(), SpringBarleyStriglingSingle::Do(), SpringBarley::Do(), SpringRape::Do(), DK_CloverGrassGrazed1::Do(), WinterWheatStriglingCulm::Do(), WinterWheatStriglingSingle::Do(), WinterRape::Do(), DK_OSpringFodderGrass::Do(), DK_OCloverGrassGrazed3::Do(), DK_OCloverGrassGrazed1::Do(), DK_OCloverGrassGrazed2::Do(), DK_OWinterFodderGrass::Do(), DK_CloverGrassGrazed3::Do(), DK_OWinterCloverGrassGrazedSown::Do(), DK_CloverGrassGrazed2::Do(), WinterWheat::Do(), PesticideToxicity::doContact(), PesticideStore::doDecay(), FlowerStrip::DoDevelopment(), Orchard::DoDevelopment(), OrchardBand::DoDevelopment(), MownGrassStrip::DoDevelopment(), Vole_Population_Manager::DoFirst(), Skylark_Population_Manager::DoFirst(), THare_Population_Manager::DoFirst(), THare_Population_Manager::DoLast(), PesticideToxicity::doToxicity(), Configurator::DumpSymbols(), PesticideToxicity::eatingFromStorePest(), Beetle_Egg_List::ExtremeTempMortality(), Vole_Population_Manager::FindOutsideRadiusMale(), Vole_Population_Manager::FindWithinRadiusMale(), THare::Forage(), Osmia_Female::Forage(), THare::ForageP(), g_init_random_seed_fnc(), LE::GetGooseNos(), LE::GetQuarryNos(), FarmManager::GetSpilledGrain(), Landscape::GISASCII_Output(), Hare_Female::GiveBirth(), VegElement::GrazeVegetationHeight(), Farm::HandleEvents(), Landscape::hb_GenerateHBPolys(), Landscape::hb_StripingDist(), THare_Population_Manager::HuntingDifferentiatedBeetleBankArea(), THare_Population_Manager::HuntingGrid(), Erigone_Population_Manager::Init(), Oedothorax_Population_Manager::Init(), Vole_Population_Manager::Init(), Vole_Base::Init(), Osmia_Population_Manager::Init(), Skylark_Population_Manager::Init(), THare_Population_Manager::Init(), Farm::InitiateManagement(), Ladybird_Adult::Ladybird_Adult(), Ladybird_Population_Manager::Ladybird_Population_Manager(), Landscape::Landscape(), Osmia_Female::LayEgg(), Skylark_Population_Manager::LoadParameters(), Hare_Female::Mating(), THare_Population_Manager::MRROutputs(), Landscape::NewElement(), Erigone_Egg::OnFarmEvent(), Oedothorax_Egg::OnFarmEvent(), Erigone_Juvenile::OnFarmEvent(), Oedothorax_Juvenile::OnFarmEvent(), Erigone_Female::OnFarmEvent(), Oedothorax_Female::OnFarmEvent(), THare::OnFarmEvent(), Skylark_Clutch::OnFarmEvent(), Skylark_Nestling::OnFarmEvent(), Skylark_PreFledgeling::OnFarmEvent(), Skylark_Female::OnFarmEvent(), Skylark_Male::OnFarmEvent(), Hare_Infant::OnFarmEvent(), Hare_Young::OnFarmEvent(), Osmia_Population_Manager::Osmia_Population_Manager(), OsmiaForageMask::OsmiaForageMask(), Pesticide::Pesticide(), PesticideStore::PesticideStore(), PoecilusCupreus_Population_Manager::PoecilusCupreus_Population_Manager(), Population_Manager::Population_Manager(), TPredator_Population_Manager::PredAutumnSample(), TPredator_Population_Manager::PredSampleFile(), TPredator_Population_Manager::PredSpringAutumnSample(), TPredator_Population_Manager::PredSpringSample(), SkTerritories::PrePolyNQual(), Population_Manager_Base::ProbeFileInput(), Farm::ProductApplication_DateLimited(), Landscape::ReadPolys2(), Weather::readWeatherFile(), Weather::readWeatherFileHourly(), Pesticide::RecordPesticideLoad(), Pesticide::RecordPesticideMap(), Ladybird_Adult::ReInit(), Vole_Female::ReInit(), Skylark_Nestling::ReInit(), PesticideStore::reset(), PesticideToxicity::reset(), TPredator_Population_Manager::Run(), Population_Manager::Run(), THare::Running(), VegElement::SetCropType(), Osmia_Base::SetParameterValues(), Ladybird_Adult::ShouldStartAggregating(), Skylark_Nestling::Skylark_Nestling(), Skylark_Population_Manager::Skylark_Population_Manager(), Ladybird_Adult::St_Aggregate(), Skylark_Female::st_BuildingUpResources(), Hare_Infant::st_Developing(), Hare_Young::st_Developing(), Hare_Juvenile::st_Developing(), Hare_Male::st_Developing(), Hare_Female::st_Developing(), Ladybird_Adult::St_Dispersal(), Hare_Juvenile::st_Dispersal(), Vole_JuvenileMale::st_Eval_n_Explore(), Vole_JuvenileFemale::st_Evaluate_n_Explore(), Vole_Female::st_Evaluate_n_Explore(), Ladybird_Adult::St_Forage(), Beetle_Egg_List::St_Hatch(), Bembidion_Adult::St_Hibernate(), Ladybird_Adult::St_Hibernate(), Hare_Female::st_ReproBehaviour(), Osmia_Female::st_ReproductiveBehaviour(), Vole_Female::st_Special_Explore(), TAnimal::TAnimal(), THare::THareInit(), Pesticide::Tick(), Landscape::Tick(), TPredator_Population_Manager::TPredator_Population_Manager(), Ladybird_Adult::TryToReproduce(), UnsprayedFieldMargin::UnsprayedFieldMargin(), Hare_Female::UpdateOestrous(), Vole_Female::Vole_Female(), Spider_Juvenile::WalkTo(), THare::WasPredated(), and Weasel::Weasel().

Member Data Documentation

◆ m_int

int CfgInt::m_int
protected

Referenced by CfgInt(), set(), and value().

◆ m_max

int CfgInt::m_max {}
protected

Referenced by CfgInt(), getmax(), and set().

◆ m_min

int CfgInt::m_min {}
protected

Referenced by CfgInt(), getmin(), and set().


The documentation for this class was generated from the following files:
WARN_FILE
Definition: MapErrorMsg.h:37
CFG_INT
Definition: Configurator.h:60
g_cfg
std::shared_ptr< Configurator > g_cfg
Definition: Configurator.cpp:56
CfgBase::CfgBase
CfgBase(const std::string &a_key, CfgSecureLevel a_level)
Definition: Configurator.cpp:84
CfgInt::m_max
int m_max
Definition: Configurator.h:108
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
CfgInt::m_min
int m_min
Definition: Configurator.h:109
CfgBase::m_key
std::string m_key
Definition: Configurator.h:81
CfgBase::m_rangetest
bool m_rangetest
Definition: Configurator.h:83
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
CfgBase
Base class for a configurator entry.
Definition: Configurator.h:79
CfgInt::m_int
int m_int
Definition: Configurator.h:107