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

#include <FMTtheme.hpp>

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

Public Member Functions

 FMTtheme ()=default
 
 ~FMTtheme ()=default
 
 FMTtheme (const std::vector< std::string > &lattributes, const std::vector< std::string > &lattributenames, const std::vector< std::string > &laggregates, const std::vector< std::vector< std::string > > &laggregatenames, const std::vector< std::map< std::string, double > > &lindexes, const size_t &lid, const size_t &lstart, const std::string &lname)
 
 FMTtheme (const std::vector< std::string > &lattributes, const std::vector< std::string > &lattributenames, const std::vector< std::string > &laggregates, const std::vector< std::vector< std::string > > &laggregatenames, const size_t &lid, const size_t &lstart, const std::string &lname)
 
 FMTtheme (const std::vector< std::string > &lattributes, const size_t &lid, const size_t &lstart, const std::string &lname)
 
 FMTtheme (const FMTtheme &rhs)
 
FMTthemeoperator= (const FMTtheme &rhs)
 
bool isattribute (const std::string &value) const
 
bool isaggregate (const std::string &value) const
 
bool isindex (const std::string &attribute, const std::string &value) const
 
bool isindex (const std::string &value) const
 
bool useindex () const
 
double getindex (const std::string &attribute, const std::string &value) const
 
bool inaggregate (const std::string &value, const std::string &aggregate)
 
bool isvalid (const std::string &value) const
 
bool operator== (const FMTtheme &rhs) const
 
size_t size () const
 
const size_t & getstart () const
 
const size_t & getid () const
 
std::string getname () const
 
bool empty () const
 
std::vector< std::string > getattributes (const std::string &value, bool aggregate_source=false) const
 
const std::vector< std::string > & getbaseattributes () const
 
const std::vector< std::string > & getattributenames () const
 
FMTtheme presolve (FMTmaskfilter &maskfilter, size_t &newid, size_t &newstart) const
 
std::string updatefrommask (const Core::FMTmask &globalmask)
 
 operator std::string () const
 
std::vector< std::string > getaggregates () const
 
- Public Member Functions inherited from Core::FMTobject
 FMTobject ()
 
virtual ~FMTobject ()
 
 FMTobject (const std::shared_ptr< Exception::FMTexceptionhandler > exhandler)
 
 FMTobject (const FMTobject &rhs)
 
FMTobjectoperator= (const FMTobject &rhs)
 
virtual void passinlogger (const std::shared_ptr< Logging::FMTlogger > &logger)
 
void passinexceptionhandler (const std::shared_ptr< Exception::FMTexceptionhandler > &exhandler)
 
void redirectlogtofile (const std::string &location)
 
virtual void setdefaultlogger ()
 
virtual void setquietlogger ()
 
virtual void settasklogger ()
 
virtual void setdebuglogger ()
 
void setdefaultexceptionhandler ()
 
void setquietexceptionhandler ()
 
void setdebugexceptionhandler ()
 
void setfreeexceptionhandler ()
 
void disablenestedexceptions ()
 
void enablenestedexceptions ()
 
void seterrorstowarnings (const std::vector< Exception::FMTexc > &errors)
 
void setmaxwarningsbeforesilenced (const size_t &maxwarningcount)
 

Static Public Member Functions

static bool validate (const std::vector< Core::FMTtheme > &themes, std::string &mask, std::string otherinformation=std::string())
 
static bool checkmask (const std::vector< Core::FMTtheme > &themes, const std::vector< std::string > &values, std::string &mask, const std::string &otherinformation)
 
- Static Public Member Functions inherited from Core::FMTobject
static std::string getruntimelocation ()
 
static unsigned long long getavailablememory ()
 

Protected Attributes

size_t id
 Id is the id of the theme first theme in the landscape section is number 1.
 
size_t start
 Start is the bit location in the FMTmask at which the attributes of the theme starts.
 

Friends

class FMTmask
 
class Parser::FMTlandscapeparser
 
class boost::serialization::access
 

Additional Inherited Members

- Protected Member Functions inherited from Core::FMTobject
template<class Archive >
void forcesave (Archive &ar, const unsigned int version) const
 
template<class Archive >
void forceload (Archive &ar, const unsigned int version)
 
void checksignals () const
 
void setCPLhandler ()
 
- Static Protected Member Functions inherited from Core::FMTobject
static std::chrono::time_point< std::chrono::high_resolution_clock > getclock ()
 
template<class chrono >
static double getduration (const std::chrono::time_point< std::chrono::high_resolution_clock > &startclock)
 
static std::string getdurationinseconds (const std::chrono::time_point< std::chrono::high_resolution_clock > &startclock)
 
- Static Protected Attributes inherited from Core::FMTobject
static std::shared_ptr< Exception::FMTexceptionhandler_exhandler
 A shared pointer to the exception handler.
 
static std::shared_ptr< Logging::FMTlogger_logger
 A shared pointer to the logger.
 

Detailed Description

FMTtheme hold multiple attributes for only one theme. FMTtheme gives the description of a part of a FMTmask from the start bit to the start + theme.size() bit. It also hold the information about attribute aggregates. FMTtheme is realy close to FMTmask class.

Constructor & Destructor Documentation

◆ FMTtheme() [1/5]

Core::FMTtheme::FMTtheme ( )
default

Default constructor for FMTtheme.

◆ ~FMTtheme()

Core::FMTtheme::~FMTtheme ( )
default

Default destructor for FMTtheme.

◆ FMTtheme() [2/5]

Core::FMTtheme::FMTtheme ( const std::vector< std::string > &  lattributes,
const std::vector< std::string > &  lattributenames,
const std::vector< std::string > &  laggregates,
const std::vector< std::vector< std::string > > &  laggregatenames,
const std::vector< std::map< std::string, double > > &  lindexes,
const size_t &  lid,
const size_t &  lstart,
const std::string &  lname 
)

FMTtheme constructor to use for FMTtheme indexing.

◆ FMTtheme() [3/5]

Core::FMTtheme::FMTtheme ( const std::vector< std::string > &  lattributes,
const std::vector< std::string > &  lattributenames,
const std::vector< std::string > &  laggregates,
const std::vector< std::vector< std::string > > &  laggregatenames,
const size_t &  lid,
const size_t &  lstart,
const std::string &  lname 
)

FMTtheme constructor to use for FMTtheme indexing.

◆ FMTtheme() [4/5]

Core::FMTtheme::FMTtheme ( const std::vector< std::string > &  lattributes,
const size_t &  lid,
const size_t &  lstart,
const std::string &  lname 
)

A more simple constructor for FMTtheme without aggregates and indexing.

◆ FMTtheme() [5/5]

Core::FMTtheme::FMTtheme ( const FMTtheme rhs)

Copy constructor for FMTtheme.

Member Function Documentation

◆ checkmask()

static bool Core::FMTtheme::checkmask ( const std::vector< Core::FMTtheme > &  themes,
const std::vector< std::string > &  values,
std::string &  mask,
const std::string &  otherinformation 
)
static

This function validate the mask string for a given vector of themes and throw exception if something is not right. It'S called by the validate function.

◆ empty()

bool Core::FMTtheme::empty ( ) const
inline

Check if the FMTtheme is empty (no attribute).

◆ getaggregates()

std::vector< std::string > Core::FMTtheme::getaggregates ( ) const

Returns the aggregates of the theme.

◆ getattributenames()

const std::vector< std::string > & Core::FMTtheme::getattributenames ( ) const
inline

Get the names of the attributes.

◆ getattributes()

std::vector< std::string > Core::FMTtheme::getattributes ( const std::string &  value,
bool  aggregate_source = false 
) const

Get the attributes of a aggregate (value) for the FMTtheme if aggregate_source == true then the aggregate source map is used.

◆ getbaseattributes()

const std::vector< std::string > & Core::FMTtheme::getbaseattributes ( ) const
inline

Get a reference to the base attributes of the theme.

◆ getid()

const size_t & Core::FMTtheme::getid ( ) const
inline

Getter for the FMTtheme id.

◆ getindex()

double Core::FMTtheme::getindex ( const std::string &  attribute,
const std::string &  value 
) const

Get the index for the given (attribute) of the index (value).

◆ getname()

std::string Core::FMTtheme::getname ( ) const
inline

Getter for the FMTtheme name.

◆ getstart()

const size_t & Core::FMTtheme::getstart ( ) const
inline

Return the bit location of the mask at which the theme starts.

◆ inaggregate()

bool Core::FMTtheme::inaggregate ( const std::string &  value,
const std::string &  aggregate 
)

Check if the (value) is part of the (aggregate).

◆ isaggregate()

bool Core::FMTtheme::isaggregate ( const std::string &  value) const
inline

Return true if the (value) is an aggregate of the FMTtheme.

◆ isattribute()

bool Core::FMTtheme::isattribute ( const std::string &  value) const
inline

Return true if the (value) is an attribute of the FMTtheme.

◆ isindex() [1/2]

bool Core::FMTtheme::isindex ( const std::string &  attribute,
const std::string &  value 
) const

Return true if the (value) is an index of the FMTtheme (only use in yields section).

◆ isindex() [2/2]

bool Core::FMTtheme::isindex ( const std::string &  value) const

Return true if the (value) is an index of the FMTtheme (only use in yields section).

◆ isvalid()

bool Core::FMTtheme::isvalid ( const std::string &  value) const

Check if the (value) is a valid attribute | aggregate | ? for the FMTtheme.

◆ operator std::string()

Core::FMTtheme::operator std::string ( ) const

Return a string representation of the FMTtheme seen in a landscape file

◆ operator=()

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

Copy assignment for FMTtheme.

◆ operator==()

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

Comparison operator of FMTtheme.

◆ presolve()

FMTtheme Core::FMTtheme::presolve ( FMTmaskfilter maskfilter,
size_t &  newid,
size_t &  newstart 
) const

The function presolve the FMTtheme so it removes non used attributes base on the basemask and fill up the selected mask we the selected attribute is the presolved FMTtheme is not empty and size > 1 then it gets an newid and a newstart and increment both.

◆ size()

size_t Core::FMTtheme::size ( ) const
inline

Return the size of FMTtheme can be 0 if the theme has no attribute.

◆ updatefrommask()

std::string Core::FMTtheme::updatefrommask ( const Core::FMTmask globalmask)

Base on a global mask it will update the theme with the aggregate in the mask or with newly created aggregates. It will also return the new attribute value.

◆ useindex()

bool Core::FMTtheme::useindex ( ) const

Return true if the FMTtheme uses index.

◆ validate()

static bool Core::FMTtheme::validate ( const std::vector< Core::FMTtheme > &  themes,
std::string &  mask,
std::string  otherinformation = std::string() 
)
static

The funciton validate a the construction of a valid FMTmask using the mask string based on the themes. If their's less themes that the number present in the string mask then the string mask is going to be trim for the good number of FMTthemes.

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Serialize function is for serialization, used to do multiprocessing across multiple cpus (pickle in Pyhton)

◆ FMTmask

friend class FMTmask
friend

◆ Parser::FMTlandscapeparser

friend class Parser::FMTlandscapeparser
friend

Member Data Documentation

◆ id

size_t Core::FMTtheme::id
protected

Id is the id of the theme first theme in the landscape section is number 1.

◆ start

size_t Core::FMTtheme::start
protected

Start is the bit location in the FMTmask at which the attributes of the theme starts.


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