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

#include <FMTmask.hpp>

Public Member Functions

void swap (FMTmask &rhs)
 
 FMTmask ()
 
 FMTmask (const FMTmask &rhs)
 
virtual ~FMTmask ()=default
 
 FMTmask (const boost::dynamic_bitset<> &bits)
 
 operator bool () const
 
 FMTmask (const std::string &mask, const boost::dynamic_bitset<> &bits)
 
 FMTmask (const std::string &mask, const std::vector< FMTtheme > &themes)
 
 FMTmask (const std::vector< std::string > &values, const std::vector< FMTtheme > &themes)
 
 FMTmask (const std::vector< FMTtheme > &themes)
 
void clear ()
 
size_t size () const
 
size_t count () const
 
std::string get (const std::vector< FMTtheme > &themes) const
 
std::string get (const FMTtheme &theme) const
 
size_t getsubsetcount (const FMTtheme &theme) const
 
void set (const std::vector< FMTtheme > &themes, const std::string &value)
 
void set (const FMTtheme &theme, const std::string &value)
 
std::vector< FMTthemegetstaticthemes (const std::vector< FMTtheme > &themes) const
 
std::vector< FMTthemegetselectedthemes (const std::vector< FMTtheme > &themes) const
 
bool isnotthemessubset (const FMTmask &rhs, const std::vector< FMTtheme > &themes) const
 
FMTmask removeaggregates (const std::vector< FMTtheme > &themes, bool questionmarkonly=false) const
 
bool empty () const
 
void update (const std::vector< FMTtheme > &themes)
 
std::vector< FMTmaskdecompose (const FMTtheme &theme) const
 
void append (const boost::dynamic_bitset<> &bits)
 
template<class typetobinarize >
void binarizedappend (const typetobinarize &element)
 
FMTmask getunion (const FMTmask &rhs) const
 
FMTmask getintersect (const FMTmask &rhs) const
 
boost::dynamic_bitset getbitsetintersect (const FMTmask &rhs) const
 
FMTmaskoperator= (const FMTmask &rhs)
 
bool operator!= (const FMTmask &rhs) const
 
bool operator== (const FMTmask &rhs) const
 
bool operator< (const FMTmask &rhs) const
 
FMTmask resume (const boost::dynamic_bitset<> &rhs) const
 
FMTmask resume (const std::vector< size_t > &indexes) const
 
size_t hash () const
 
std::string getbitsstring () const
 
 operator std::string () const
 
bool issubsetof (const boost::dynamic_bitset<> &rhs) const
 
bool issubsetof (const FMTmask &rhs) const
 
const boost::dynamic_bitset & getbitsetreference () const
 
const std::string & getstringreference () const
 
FMTmask refine (const FMTmask &mask, const std::vector< FMTtheme > &themes) const
 
FMTmask getpostsolvemask (const FMTmask &mask, const std::vector< FMTtheme > &themes) const
 
FMTmask presolve (const FMTmaskfilter &filter, const std::vector< FMTtheme > &presolvedthemes) const
 
FMTmask postsolve (const FMTmaskfilter &filter, const std::vector< FMTtheme > &basethemes) const
 
template<>
void binarizedappend (const double &element)
 

Friends

class FMTtheme
 
class boost::serialization::access
 

Detailed Description

FMTmask class is one of the most important class in FMT. Alot of classes are bases on FMTmask. data is boost:dynamic_bitset where if a bit is set that means that the attribute of a given theme is part of the FMTmask. the data member size == the sum of the FMTthemes size. The name data member hold the attribute value as a string. Sometime when the FMTmask is used for union the name might not be set. Also if multiple bits are set for a given FMTtheme it means that the mask contains a aggregate or a ?.

Constructor & Destructor Documentation

◆ FMTmask() [1/7]

Core::FMTmask::FMTmask ( )

Default constructor for FMTmask.

◆ FMTmask() [2/7]

Core::FMTmask::FMTmask ( const FMTmask rhs)

FMTmask copy constructor.

◆ ~FMTmask()

virtual Core::FMTmask::~FMTmask ( )
virtualdefault

Default destructor for FMTmask.

◆ FMTmask() [3/7]

Core::FMTmask::FMTmask ( const boost::dynamic_bitset<> &  bits)

Simple constructor for FMTmask that only sets the bitsets data member.

◆ FMTmask() [4/7]

Core::FMTmask::FMTmask ( const std::string &  mask,
const boost::dynamic_bitset<> &  bits 
)

FMTmask constructor using a already sets bitset (bits) and a string mask to set as name.

◆ FMTmask() [5/7]

Core::FMTmask::FMTmask ( const std::string &  mask,
const std::vector< FMTtheme > &  themes 
)

FMTmask constructor using a string (mask) and sorted themes to generate a complete FMTmask.

◆ FMTmask() [6/7]

Core::FMTmask::FMTmask ( const std::vector< std::string > &  values,
const std::vector< FMTtheme > &  themes 
)

FMTmask constructor using a vector of string for the attributes and a vector of sorted themes to generate a FMTmask.

◆ FMTmask() [7/7]

Core::FMTmask::FMTmask ( const std::vector< FMTtheme > &  themes)

FMTmask constructor using a vector of string for the attributes and a vector of sorted themes to generate a FMTmask.

Member Function Documentation

◆ append()

void Core::FMTmask::append ( const boost::dynamic_bitset<> &  bits)

Append a bitsets to the bitset data member of the FMTmask.

◆ binarizedappend() [1/2]

template<>
void Core::FMTmask::binarizedappend ( const double &  element)
inline

◆ binarizedappend() [2/2]

template<class typetobinarize >
void Core::FMTmask::binarizedappend ( const typetobinarize &  element)
inline

Binarize any class and append it to the mask.

◆ clear()

void Core::FMTmask::clear ( )

Clear the data and name members.

◆ count()

size_t Core::FMTmask::count ( ) const

Get the number of bits set.

◆ decompose()

std::vector< FMTmask > Core::FMTmask::decompose ( const FMTtheme theme) const

Using a given (theme) this function desaggregate the attribute/aggregate/? of a theme from the FMTmask and returns a vector of each possible attribute as multiple masks.

◆ empty()

bool Core::FMTmask::empty ( ) const

Returns true if the data member is empty.

◆ get() [1/2]

std::string Core::FMTmask::get ( const FMTtheme theme) const

Get the corresponding attribute of the FMTmask for a given FMTtheme.

◆ get() [2/2]

std::string Core::FMTmask::get ( const std::vector< FMTtheme > &  themes) const

Gets the string mask name of the FMTmask based on the bitset data and the sorted themes.

◆ getbitsetintersect()

boost::dynamic_bitset Core::FMTmask::getbitsetintersect ( const FMTmask rhs) const

Do a intersection operation on the dynamic bitset of the FMTmask and the given FMTmask (rhs) but return the bitset.

◆ getbitsetreference()

const boost::dynamic_bitset & Core::FMTmask::getbitsetreference ( ) const
inline

Get a const referencer ot the boost::dynamic_bitset data member.

◆ getbitsstring()

std::string Core::FMTmask::getbitsstring ( ) const

Returns the binary representation of the dynamic bitset in a simple string.

◆ getintersect()

FMTmask Core::FMTmask::getintersect ( const FMTmask rhs) const

Do a intersection operation on the dynamic bitset of the FMTmask and the given FMTmask (rhs).

◆ getpostsolvemask()

FMTmask Core::FMTmask::getpostsolvemask ( const FMTmask mask,
const std::vector< FMTtheme > &  themes 
) const

If this is a base postsolve mask it uses mask to turn off bits for themes that are still active.

◆ getselectedthemes()

std::vector< FMTtheme > Core::FMTmask::getselectedthemes ( const std::vector< FMTtheme > &  themes) const

Takes vector of FMTtheme and return a vector of FMTtheme from which theme have any true bits.

◆ getstaticthemes()

std::vector< FMTtheme > Core::FMTmask::getstaticthemes ( const std::vector< FMTtheme > &  themes) const

Filter FMTtheme from themes that are only using aggregates or ? for the FMTmask.

◆ getstringreference()

const std::string & Core::FMTmask::getstringreference ( ) const
inline

Get a const referencer ot the std::string data member.

◆ getsubsetcount()

size_t Core::FMTmask::getsubsetcount ( const FMTtheme theme) const

Get the number of bits set for the given theme subset.

◆ getunion()

FMTmask Core::FMTmask::getunion ( const FMTmask rhs) const

Do a union operation on the dynamic bitset of the FMTmask and the given FMTmask (rhs).

◆ hash()

size_t Core::FMTmask::hash ( ) const
inline

Hash function for the FMTmask class.

◆ isnotthemessubset()

bool Core::FMTmask::isnotthemessubset ( const FMTmask rhs,
const std::vector< FMTtheme > &  themes 
) const

By looking at each FMTtheme in the FMTmask return true if *this is not part of rhs base on sorted FMTtheme (themes).

◆ issubsetof() [1/2]

bool Core::FMTmask::issubsetof ( const boost::dynamic_bitset<> &  rhs) const
inline

Check if the bitset is a subset of the rhs bitset

◆ issubsetof() [2/2]

bool Core::FMTmask::issubsetof ( const FMTmask rhs) const
inline

Check if the FMTmask is a subset of a FMTmask (rhs).

◆ operator bool()

Core::FMTmask::operator bool ( ) const
explicit

Returns true if the FMTmask is not empty by looking at the data bitset.

◆ operator std::string()

Core::FMTmask::operator std::string ( ) const
inline

Returns the name of the FMTmask.

◆ operator!=()

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

FMTmask nonequality operator.

◆ operator<()

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

Less than operator of FMTmask.

◆ operator=()

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

FMTmask copy assignment operator.

◆ operator==()

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

Comparison operator of FMTmask.

◆ postsolve()

FMTmask Core::FMTmask::postsolve ( const FMTmaskfilter filter,
const std::vector< FMTtheme > &  basethemes 
) const

Using aFMTmaskfilter (filter) and the original FMTthemes it returns a postsolved FMTmask.

◆ presolve()

FMTmask Core::FMTmask::presolve ( const FMTmaskfilter filter,
const std::vector< FMTtheme > &  presolvedthemes 
) const

Using a FMTmaskfilter (filter) and a subset of the original FMTthemes used to construct the FMTmask, it returns a presolved FMTmask with potentialy less data.

◆ refine()

FMTmask Core::FMTmask::refine ( const FMTmask mask,
const std::vector< FMTtheme > &  themes 
) const

It will return a new FMTmask where the ? are completed with the attribute for the theme from (mask). If the attribute is not ? for this mask, the attribute will not change.

◆ removeaggregates()

FMTmask Core::FMTmask::removeaggregates ( const std::vector< FMTtheme > &  themes,
bool  questionmarkonly = false 
) const

For each FMTtheme in (themes) if the attribute is an aggregate or ? will unset all bits of the given aggregate or ? and return a new FMTmask.

◆ resume() [1/2]

FMTmask Core::FMTmask::resume ( const boost::dynamic_bitset<> &  rhs) const

Using a mask (rhs) fix the corresponding resulting FMTmask with the selected name and data.

◆ resume() [2/2]

FMTmask Core::FMTmask::resume ( const std::vector< size_t > &  indexes) const

Using a mask indexes (indexes) fix the corresponding resulting FMTmask with the selected name and data.

◆ set() [1/2]

void Core::FMTmask::set ( const FMTtheme theme,
const std::string &  value 
)

Set the bitset data for a given FMTtheme (theme) for a attribute (value).

◆ set() [2/2]

void Core::FMTmask::set ( const std::vector< FMTtheme > &  themes,
const std::string &  value 
)

Set the bitset data for some FMTthemes (themes) for a mask string (value).

◆ size()

size_t Core::FMTmask::size ( ) const

Returns the size of the bitsets data member.

◆ swap()

void Core::FMTmask::swap ( FMTmask rhs)

Swap for FMTmask.

◆ update()

void Core::FMTmask::update ( const std::vector< FMTtheme > &  themes)

Update the name data member bass on the dynamic bitset data member with a sorted list of FMTtheme (themes).

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)

◆ FMTtheme

friend class FMTtheme
friend

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