FMT 1.2.0
Forest management tools for forest planning
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Friends | List of all members
Core::FMTOutputSource Class Reference

Source of an output holding a mask, a target and values, used to compute an output. More...

#include <FMTOutputSource.h>

Inheritance diagram for Core::FMTOutputSource:
[legend]
Collaboration diagram for Core::FMTOutputSource:
[legend]

Public Member Functions

 FMTOutputSource ()
 Default constructor for FMTOutputSource.
 
 ~FMTOutputSource ()=default
 Default destructor for FMTOutputSource.
 
 FMTOutputSource (const FMTotar ltarget, double lvalue=0, std::string lyield="", std::string laction="", int origin=-1, int ttarget=-1)
 Construct an output source from a target and optional value, yield, action, origin and theme target.
 
 FMTOutputSource (const FMTotar ltarget, std::vector< double >lvalues, int origin=-1, int ttarget=-1, std::string llevelname="")
 Construct an output source from a target and a vector of values.
 
 FMTOutputSource (const FMTSpec &spec, const FMTMask &lmask, const FMTotar ltarget, std::string lyield="", std::string laction="", int origin=-1, int ttarget=-1)
 Construct an output source from a specification, a mask and a target.
 
 FMTOutputSource (const FMTOutputSource &rhs)
 Copy constructor for FMTOutputSource.
 
FMTOutputSourceoperator= (const FMTOutputSource &rhs)
 Copy assignment operator for FMTOutputSource.
 
 operator std::string () const override
 Return the string representation of the output source.
 
bool operator== (const FMTOutputSource &rhs) const
 Equality comparison operator of FMTOutputSource.
 
bool operator!= (const FMTOutputSource &rhs) const
 Inequality comparison operator of FMTOutputSource.
 
bool operator< (const FMTOutputSource &rhs) const
 Less than comparison operator of FMTOutputSource.
 
int getOutputOrigin () const
 Return the output origin.
 
int getThemeTarget () const
 Return the theme target.
 
bool isInAggregate (const FMTOutputSource &rhs, const std::vector< Core::FMTAction > &actions) const
 Return true if this output source is in the same aggregate as another.
 
bool isSubsetOf (const FMTOutputSource &rhs, const std::vector< Core::FMTAction > &actions) const
 Return true if this output source is a subset of another considering the actions.
 
bool isSubsetOf (const FMTOutputSource &rhs) const
 Return true if this output source is a subset of another.
 
bool isSameButDifferentAction (const FMTOutputSource &rhs) const
 Return true if this output source is the same as another but with a different action.
 
const FMTMaskgetMask () const
 Return a const reference to the mask of the output source.
 
void setMask (const FMTMask &newmask)
 Set the mask of the output source.
 
void setAction (const std::string &actionname)
 Set the action of the output source.
 
void setTarget (const FMTotar &newtype)
 Set the target of the output source.
 
void setThemeTarget (const int &newttarget)
 Set the theme target of the output source.
 
void setOutputOrigin (const int &neworigin)
 Set the output origin of the output source.
 
void resetValues (const FMTOperator &op, const FMTOutputSource &other)
 Reset the values of the output source using an operator and another output source.
 
const std::string & getAction () const
 Return a const reference to the action of the output source.
 
const std::string & getYield () const
 Return a const reference to the yield of the output source.
 
const FMTotargetTarget () const
 Return a const reference to the target of the output source.
 
double getValue (int period=0) const
 Return the value of the output source for a given period.
 
bool isVariable () const
 Return true if the output source is a variable.
 
bool isLevel () const
 Return true if the output source is a level.
 
bool isConstant () const
 Return true if the output source is a constant.
 
bool isVariableLevel () const
 Return true if the output source is a variable level.
 
const std::string & getLevel () const
 Return a const reference to the level of the output source.
 
const std::vector< double > & getValues () const
 Return a const reference to the values of the output source.
 
bool isNull (const FMTYields &ylds) const
 Return true if the output source is null.
 
bool isTimeYield () const
 Return true if the output source is a time yield.
 
std::vector< const FMTAction * > targets (const std::vector< FMTAction > &actions) const
 Return the actions targeted by the output source.
 
std::unordered_set< int > targetsSet (const std::vector< FMTAction > &actions) const
 Return the ids of the actions targeted by the output source.
 
bool isInventory () const
 Return true if the output source targets the inventory.
 
bool useInEdges () const
 Return true if the output source uses the in edges.
 
bool isNextPeriod () const
 Return true if the output source targets the next period.
 
bool useOutEdges () const
 Return true if the output source uses the out edges.
 
double getCoef (const FMTDevelopment &development, const FMTYields &yields, const Graph::FMTGraphVertexToYield *graphinfo=nullptr, std::vector< FMTDevelopmentPath > const *paths=nullptr, FMTAction const *p_action=nullptr) const
 Return the coefficient of the output source for a development based on the yields.
 
bool use (const FMTDevelopment &development, const FMTYields &ylds, const Graph::FMTGraphVertexToYield *graphinfo=nullptr) const
 Return true if the output source is used by a development based on the yields.
 
FMTOutputSource preSolve (const FMTMaskFilter &filter, const std::vector< FMTTheme > &newthemes) const
 Return a presolved copy of the output source.
 
void setAverage ()
 Set the output source as an average.
 
bool isAverage () const
 Return true if the output source is an average.
 
void setSum ()
 Set the output source as a sum.
 
bool isSum () const
 Return true if the output source is a sum.
 
bool canBeDeducedToConstant () const
 Return true if the output source can be deduced to a constant.
 
double getConstantValue (const std::vector< Core::FMTActualDevelopment > &area, const std::vector< Core::FMTAction > &actions, const FMTYields &yields) const
 Return the constant value of the output source.
 
size_t hash (int period=-1, bool withyield=false) const
 Return the hash of the output source.
 
void fillHashMask (Core::FMTMask &baseMask) const
 Fill a base mask with the hash mask of the output source.
 
void fillHashSpec (Core::FMTMask &baseMask) const
 Fill a base mask with the hash specification of the output source.
 
bool isEqualByValue (const FMTOutputSource &rhs) const
 Return true if this output source is equal by value to another.
 
bool isAction () const
 Return true if the output source is an action.
 
void setYield (const std::string &p_Yield)
 set Yield to the output source.
 

Static Public Member Functions

static std::string trimDouble (const std::string &string_number)
 Trim the trailing zeros of a number in string format, for example 1400.0000 to 1400 or 14.0300 to 14.03.
 

Friends

class boost::serialization::access
 
class Parser::FMTOutputParser
 

Detailed Description

Source of an output holding a mask, a target and values, used to compute an output.

Constructor & Destructor Documentation

◆ FMTOutputSource() [1/5]

Core::FMTOutputSource::FMTOutputSource ( )

Default constructor for FMTOutputSource.

◆ ~FMTOutputSource()

Core::FMTOutputSource::~FMTOutputSource ( )
default

Default destructor for FMTOutputSource.

◆ FMTOutputSource() [2/5]

Core::FMTOutputSource::FMTOutputSource ( const FMTotar  ltarget,
double  lvalue = 0,
std::string  lyield = "",
std::string  laction = "",
int  origin = -1,
int  ttarget = -1 
)

Construct an output source from a target and optional value, yield, action, origin and theme target.

Parameters
[in]ltargetthe output target.
[in]lvaluethe value.
[in]lyieldthe yield.
[in]lactionthe action.
[in]originthe output origin.
[in]ttargetthe theme target.

◆ FMTOutputSource() [3/5]

Core::FMTOutputSource::FMTOutputSource ( const FMTotar  ltarget,
std::vector< double >  lvalues,
int  origin = -1,
int  ttarget = -1,
std::string  llevelname = "" 
)

Construct an output source from a target and a vector of values.

Parameters
[in]ltargetthe output target.
[in]lvaluesthe values.
[in]originthe output origin.
[in]ttargetthe theme target.
[in]llevelnamethe level name.

◆ FMTOutputSource() [4/5]

Core::FMTOutputSource::FMTOutputSource ( const FMTSpec &  spec,
const FMTMask lmask,
const FMTotar  ltarget,
std::string  lyield = "",
std::string  laction = "",
int  origin = -1,
int  ttarget = -1 
)

Construct an output source from a specification, a mask and a target.

Parameters
[in]specthe specification.
[in]lmaskthe mask.
[in]ltargetthe output target.
[in]lyieldthe yield.
[in]lactionthe action.
[in]originthe output origin.
[in]ttargetthe theme target.

◆ FMTOutputSource() [5/5]

Core::FMTOutputSource::FMTOutputSource ( const FMTOutputSource rhs)

Copy constructor for FMTOutputSource.

Parameters
[in]rhsthe output source to copy.

Member Function Documentation

◆ canBeDeducedToConstant()

bool Core::FMTOutputSource::canBeDeducedToConstant ( ) const

Return true if the output source can be deduced to a constant.

Returns
true if the output source can be deduced to a constant else false.

◆ fillHashMask()

void Core::FMTOutputSource::fillHashMask ( Core::FMTMask baseMask) const

Fill a base mask with the hash mask of the output source.

Parameters
[in,out]baseMaskthe base mask to fill.

◆ fillHashSpec()

void Core::FMTOutputSource::fillHashSpec ( Core::FMTMask baseMask) const

Fill a base mask with the hash specification of the output source.

Parameters
[in,out]baseMaskthe base mask to fill.

◆ getAction()

const std::string & Core::FMTOutputSource::getAction ( ) const
inline

Return a const reference to the action of the output source.

Returns
a const reference to the action.

◆ getCoef()

double Core::FMTOutputSource::getCoef ( const FMTDevelopment development,
const FMTYields yields,
const Graph::FMTGraphVertexToYield graphinfo = nullptr,
std::vector< FMTDevelopmentPath > const *  paths = nullptr,
FMTAction const *  p_action = nullptr 
) const

Return the coefficient of the output source for a development based on the yields.

Parameters
[in]developmentthe development.
[in]yieldsthe yields.
[in]graphinfoan optional graph vertex to yield.
[in]pathsoptional development paths.
[in]p_actionan optional action.
Returns
the coefficient.

◆ getConstantValue()

double Core::FMTOutputSource::getConstantValue ( const std::vector< Core::FMTActualDevelopment > &  area,
const std::vector< Core::FMTAction > &  actions,
const FMTYields yields 
) const

Return the constant value of the output source.

Parameters
[in]areathe actual developments.
[in]actionsthe actions.
[in]yieldsthe yields.
Returns
the constant value.

◆ getLevel()

const std::string & Core::FMTOutputSource::getLevel ( ) const
inline

Return a const reference to the level of the output source.

Returns
a const reference to the level.

◆ getMask()

const FMTMask & Core::FMTOutputSource::getMask ( ) const
inline

Return a const reference to the mask of the output source.

Returns
a const reference to the mask.

◆ getOutputOrigin()

int Core::FMTOutputSource::getOutputOrigin ( ) const
inline

Return the output origin.

Returns
the output origin.

◆ getTarget()

const FMTotar & Core::FMTOutputSource::getTarget ( ) const
inline

Return a const reference to the target of the output source.

Returns
a const reference to the target.

◆ getThemeTarget()

int Core::FMTOutputSource::getThemeTarget ( ) const
inline

Return the theme target.

Returns
the theme target.

◆ getValue()

double Core::FMTOutputSource::getValue ( int  period = 0) const

Return the value of the output source for a given period.

Parameters
[in]periodthe period.
Returns
the value.

◆ getValues()

const std::vector< double > & Core::FMTOutputSource::getValues ( ) const
inline

Return a const reference to the values of the output source.

Returns
a const reference to the values.

◆ getYield()

const std::string & Core::FMTOutputSource::getYield ( ) const
inline

Return a const reference to the yield of the output source.

Returns
a const reference to the yield.

◆ hash()

size_t Core::FMTOutputSource::hash ( int  period = -1,
bool  withyield = false 
) const

Return the hash of the output source.

Parameters
[in]periodthe period.
[in]withyieldif true includes the yield in the hash.
Returns
the hash value.

◆ isAction()

bool Core::FMTOutputSource::isAction ( ) const
inline

Return true if the output source is an action.

Returns
true if the output source is an action else false.

◆ isAverage()

bool Core::FMTOutputSource::isAverage ( ) const
inline

Return true if the output source is an average.

Returns
true if the output source is an average else false.

◆ isConstant()

bool Core::FMTOutputSource::isConstant ( ) const
inline

Return true if the output source is a constant.

Returns
true if the output source is a constant else false.

◆ isEqualByValue()

bool Core::FMTOutputSource::isEqualByValue ( const FMTOutputSource rhs) const

Return true if this output source is equal by value to another.

Parameters
[in]rhsthe other output source.
Returns
true if equal by value else false.

◆ isInAggregate()

bool Core::FMTOutputSource::isInAggregate ( const FMTOutputSource rhs,
const std::vector< Core::FMTAction > &  actions 
) const

Return true if this output source is in the same aggregate as another.

Parameters
[in]rhsthe other output source.
[in]actionsthe actions.
Returns
true if in the same aggregate else false.

◆ isInventory()

bool Core::FMTOutputSource::isInventory ( ) const
inline

Return true if the output source targets the inventory.

Returns
true if the output source targets the inventory else false.

◆ isLevel()

bool Core::FMTOutputSource::isLevel ( ) const
inline

Return true if the output source is a level.

Returns
true if the output source is a level else false.

◆ isNextPeriod()

bool Core::FMTOutputSource::isNextPeriod ( ) const
inline

Return true if the output source targets the next period.

Returns
true if the output source targets the next period else false.

◆ isNull()

bool Core::FMTOutputSource::isNull ( const FMTYields ylds) const

Return true if the output source is null.

Parameters
[in]yldsthe yields.
Returns
true if the output source is null else false.

◆ isSameButDifferentAction()

bool Core::FMTOutputSource::isSameButDifferentAction ( const FMTOutputSource rhs) const

Return true if this output source is the same as another but with a different action.

Parameters
[in]rhsthe other output source.
Returns
true if same but different action else false.

◆ isSubsetOf() [1/2]

bool Core::FMTOutputSource::isSubsetOf ( const FMTOutputSource rhs) const

Return true if this output source is a subset of another.

Parameters
[in]rhsthe other output source.
Returns
true if this output source is a subset of rhs else false.

◆ isSubsetOf() [2/2]

bool Core::FMTOutputSource::isSubsetOf ( const FMTOutputSource rhs,
const std::vector< Core::FMTAction > &  actions 
) const

Return true if this output source is a subset of another considering the actions.

Parameters
[in]rhsthe other output source.
[in]actionsthe actions.
Returns
true if this output source is a subset of rhs else false.

◆ isSum()

bool Core::FMTOutputSource::isSum ( ) const
inline

Return true if the output source is a sum.

Returns
true if the output source is a sum else false.

◆ isTimeYield()

bool Core::FMTOutputSource::isTimeYield ( ) const
inline

Return true if the output source is a time yield.

Returns
true if the output source is a time yield else false.

◆ isVariable()

bool Core::FMTOutputSource::isVariable ( ) const
inline

Return true if the output source is a variable.

Returns
true if the output source is a variable else false.

◆ isVariableLevel()

bool Core::FMTOutputSource::isVariableLevel ( ) const
inline

Return true if the output source is a variable level.

Returns
true if the output source is a variable level else false.

◆ operator std::string()

Core::FMTOutputSource::operator std::string ( ) const
override

Return the string representation of the output source.

Returns
the string representation of the output source.

◆ operator!=()

bool Core::FMTOutputSource::operator!= ( const FMTOutputSource rhs) const

Inequality comparison operator of FMTOutputSource.

Parameters
[in]rhsthe output source to compare with.
Returns
true if both output sources are different else false.

◆ operator<()

bool Core::FMTOutputSource::operator< ( const FMTOutputSource rhs) const

Less than comparison operator of FMTOutputSource.

Parameters
[in]rhsthe output source to compare with.
Returns
true if this output source is less than rhs else false.

◆ operator=()

FMTOutputSource & Core::FMTOutputSource::operator= ( const FMTOutputSource rhs)

Copy assignment operator for FMTOutputSource.

Parameters
[in]rhsthe output source to copy.
Returns
a reference to this FMTOutputSource.

◆ operator==()

bool Core::FMTOutputSource::operator== ( const FMTOutputSource rhs) const

Equality comparison operator of FMTOutputSource.

Parameters
[in]rhsthe output source to compare with.
Returns
true if both output sources are equal else false.

◆ preSolve()

FMTOutputSource Core::FMTOutputSource::preSolve ( const FMTMaskFilter filter,
const std::vector< FMTTheme > &  newthemes 
) const

Return a presolved copy of the output source.

Parameters
[in]filterthe mask filter.
[in]newthemesthe presolved themes.
Returns
the presolved output source.

◆ resetValues()

void Core::FMTOutputSource::resetValues ( const FMTOperator op,
const FMTOutputSource other 
)

Reset the values of the output source using an operator and another output source.

Parameters
[in]opthe operator.
[in]otherthe other output source.

◆ setAction()

void Core::FMTOutputSource::setAction ( const std::string &  actionname)

Set the action of the output source.

Parameters
[in]actionnamethe action to set.

◆ setAverage()

void Core::FMTOutputSource::setAverage ( )

Set the output source as an average.

◆ setMask()

void Core::FMTOutputSource::setMask ( const FMTMask newmask)

Set the mask of the output source.

Parameters
[in]newmaskthe mask to set.

◆ setOutputOrigin()

void Core::FMTOutputSource::setOutputOrigin ( const int &  neworigin)

Set the output origin of the output source.

Parameters
[in]neworiginthe output origin to set.

◆ setSum()

void Core::FMTOutputSource::setSum ( )

Set the output source as a sum.

◆ setTarget()

void Core::FMTOutputSource::setTarget ( const FMTotar newtype)

Set the target of the output source.

Parameters
[in]newtypethe target to set.

◆ setThemeTarget()

void Core::FMTOutputSource::setThemeTarget ( const int &  newttarget)

Set the theme target of the output source.

Parameters
[in]newttargetthe theme target to set.

◆ setYield()

void Core::FMTOutputSource::setYield ( const std::string &  p_Yield)

set Yield to the output source.

Parameters
[in]p_Yieldthe yield we want to set.

◆ targets()

std::vector< const FMTAction * > Core::FMTOutputSource::targets ( const std::vector< FMTAction > &  actions) const

Return the actions targeted by the output source.

Parameters
[in]actionsthe actions.
Returns
the targeted actions.

◆ targetsSet()

std::unordered_set< int > Core::FMTOutputSource::targetsSet ( const std::vector< FMTAction > &  actions) const

Return the ids of the actions targeted by the output source.

Parameters
[in]actionsthe actions.
Returns
the ids of the targeted actions.

◆ trimDouble()

static std::string Core::FMTOutputSource::trimDouble ( const std::string &  string_number)
static

Trim the trailing zeros of a number in string format, for example 1400.0000 to 1400 or 14.0300 to 14.03.

Parameters
[in]string_numberthe number in string format.
Returns
the trimmed value in string format.

◆ use()

bool Core::FMTOutputSource::use ( const FMTDevelopment development,
const FMTYields ylds,
const Graph::FMTGraphVertexToYield graphinfo = nullptr 
) const

Return true if the output source is used by a development based on the yields.

Parameters
[in]developmentthe development.
[in]yldsthe yields.
[in]graphinfoan optional graph vertex to yield.
Returns
true if the output source is used else false.

◆ useInEdges()

bool Core::FMTOutputSource::useInEdges ( ) const
inline

Return true if the output source uses the in edges.

Returns
true if the output source uses the in edges else false.

◆ useOutEdges()

bool Core::FMTOutputSource::useOutEdges ( ) const
inline

Return true if the output source uses the out edges.

Returns
true if the output source uses the out edges else false.

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

◆ Parser::FMTOutputParser

friend class Parser::FMTOutputParser
friend

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