![]() |
FMT 1.2.0
Forest management tools for forest planning
|
Core class holding, as a boost dynamic bitset, which theme attributes are part of a mask. More...
#include <FMTMask.h>
Public Member Functions | |
| FMTMask (FMTMask &&rhs) noexcept | |
| Move copy constructor. | |
| FMTMask & | operator= (FMTMask &&rhs) noexcept |
| Move assignment operator for FMTMask. | |
| void | swap (FMTMask &rhs) |
| Swap this mask with another. | |
| FMTMask () | |
| Default constructor for FMTMask. | |
| FMTMask (const FMTMask &rhs) | |
| Copy constructor for FMTMask. | |
| virtual | ~FMTMask ()=default |
| Default virtual destructor for FMTMask. | |
| FMTMask (const boost::dynamic_bitset< uint8_t > &bits) | |
| Construct a mask setting only the bitset data member. | |
| operator bool () const | |
| Return true if the mask is not empty by looking at the data bitset. | |
| FMTMask (const std::string &mask, const boost::dynamic_bitset< uint8_t > &bits) | |
| Construct a mask from an already set bitset and a string mask used as name. | |
| FMTMask (const std::string &mask, const std::vector< FMTTheme > &themes) | |
| Construct a complete mask from a string and sorted themes. | |
| FMTMask (const std::vector< std::string > &values, const std::vector< FMTTheme > &themes) | |
| Construct a mask from a vector of attribute strings and sorted themes. | |
| FMTMask (const std::vector< FMTTheme > &themes) | |
| Construct an empty mask sized for the given themes. | |
| void | clear () |
| Clear the data and name members. | |
| size_t | size () const |
| Return the size of the bitset data member. | |
| size_t | count () const |
| Return the number of bits set. | |
| std::string | get (const std::vector< FMTTheme > &themes) const |
| Get the string mask name based on the bitset data and sorted themes. | |
| std::string | get (const FMTTheme &theme) const |
| Get the attribute of the mask for a given theme. | |
| const std::string & | getAttribute (const FMTTheme &p_theme) const |
| When you deal with FMTDevelopment you can directly call this to get a reference to the attribute string. | |
| size_t | getSubsetCount (const FMTTheme &theme) const |
| Return the number of bits set for the given theme subset. | |
| void | set (const std::vector< FMTTheme > &themes, const std::string &value) |
| Set the bitset data for some themes from a mask string. | |
| void | setExclusiveBits (const FMTMask &p_mask, const FMTTheme &p_theme) |
| Flip only the theme subset and clear the mask of the intersection with another mask. | |
| std::vector< size_t > | getNonFullBlocks () const |
| Return the indexes of the blocks that contain a 0. | |
| bool | isSubsetOf (const FMTMask &p_mask, const std::vector< size_t > &p_subset) const |
| Check if this mask is a subset of another mask by looking at a block subset. | |
| void | set (const FMTTheme &theme, const std::string &value) |
| Set the bitset data for a given theme from an attribute. | |
| std::vector< const Core::FMTTheme * > | getStaticThemes (const std::vector< const Core::FMTTheme * > &themes) const |
| Return the themes that only use aggregates or a question mark for the mask. | |
| std::vector< const Core::FMTTheme * > | getSelectedThemes (const std::vector< Core::FMTTheme > &themes) const |
| Return the themes that have any bit set in the mask. | |
| bool | isNotThemesSubset (const FMTMask &rhs, const std::vector< const Core::FMTTheme * > &themes) const |
| Return true if this mask is not part of rhs based on the sorted themes. | |
| bool | isNotThemesSubset (const FMTMask &rhs, const std::vector< Core::FMTTheme > &themes) const |
| Return true if this mask is not part of rhs based on the sorted themes. | |
| FMTMask | removeAggregates (const std::vector< FMTTheme > &themes, bool questionmarkonly=false) const |
| Return a new mask with the bits of aggregates or question marks unset for the given themes. | |
| bool | empty () const |
| Return true if the data member is empty. | |
| void | update (const std::vector< FMTTheme > &themes) |
| Update the name member from the bitset data using a sorted list of themes. | |
| std::vector< FMTMask > | decompose (const FMTTheme &theme) const |
| Disaggregate the attribute of a theme from the mask into a vector of masks, one per possible attribute. | |
| void | append (const boost::dynamic_bitset< uint8_t > &bits) |
| Append a bitset to the bitset data member of the mask. | |
| template<class typetobinarize > | |
| void | binarizedAppend (const typetobinarize &element) |
| Binarize an element and append it to the mask. | |
| void | unionWith (const FMTMask &rhs) |
| Performs an in-place union with another mask. | |
| FMTMask | getUnion (const FMTMask &rhs) const |
| Return the union of this mask and another mask. | |
| FMTMask | getIntersect (const FMTMask &rhs) const |
| Return the intersection of this mask and another mask. | |
| void | setIntersect (const FMTMask &rhs) |
| set the intersect with this mask using rhs mask. | |
| boost::dynamic_bitset< uint8_t > | getBitsetIntersect (const FMTMask &rhs) const |
| Return the bitset of the intersection of this mask and another mask. | |
| FMTMask & | operator= (const FMTMask &rhs) |
| Copy assignment operator for FMTMask. | |
| bool | operator!= (const FMTMask &rhs) const |
| Inequality comparison operator of FMTMask. | |
| bool | operator== (const FMTMask &rhs) const |
| Equality comparison operator of FMTMask. | |
| bool | operator< (const FMTMask &rhs) const |
| Less than comparison operator of FMTMask. | |
| FMTMask | resume (const boost::dynamic_bitset< uint8_t > &rhs) const |
| Return a mask with the selected name and data using a bitset. | |
| FMTMask | resume (const std::vector< size_t > &indexes) const |
| Return a mask with the selected name and data using mask indexes. | |
| size_t | hash () const |
| Return the hash of the mask. | |
| std::string | getBitsString () const |
| Return the binary representation of the bitset as a string. | |
| operator std::string () const | |
| Return the name of the mask. | |
| bool | isSubsetOf (const FMTMask &p_rhs) const |
| Check if this mask is a subset of another mask. | |
| const boost::dynamic_bitset< uint8_t > & | getBitsetReference () const |
| Return a const reference to the bitset data member. | |
| const std::string & | getStringReference () const |
| Return a const reference to the name string member. | |
| void | reserve (size_t p_size) |
| reserve memory for the boost dynamicbitset. | |
| FMTMask | refine (const FMTMask &mask, const std::vector< FMTTheme > &themes) const |
| Return a new mask where the question marks are completed with the attributes of another mask. | |
| FMTMask | getPostSolveMask (const FMTMask &mask, const std::vector< FMTTheme > &themes) const |
| Turn off the bits of themes that are still active on a base postsolve mask. | |
| FMTMask | preSolve (const FMTMaskFilter &filter, const std::vector< FMTTheme > &presolvedthemes) const |
| Return a presolved mask with potentially less data using a filter and a subset of the original themes. | |
| void | preSolveRef (const FMTMaskFilter &p_filter, const std::vector< FMTTheme > &p_presolvedThemes, bool p_allowReallocation=true) |
| Presolve this mask in place with potentially less data using a filter and a subset of the original themes. | |
| bool | canPreSolve (const FMTMaskFilter &p_filter, const std::vector< FMTTheme > &p_presolvedThemes) const |
| Return true if the mask can be presolved with the given filter and themes. | |
| FMTMask | postSolve (const FMTMaskFilter &filter, const std::vector< FMTTheme > &basethemes) const |
| Return a postsolved mask using a filter and the original themes. | |
| template<> | |
| void | binarizedAppend (const double &element) |
Friends | |
| class | FMTTheme |
| class | boost::serialization::access |
| Serialize the FMTMask for multiprocessing across multiple cpus (pickle in Python). | |
Core class holding, as a boost dynamic bitset, which theme attributes are part of a mask.
A set bit means the attribute of a given theme is part of the mask; the data size equals the sum of the theme sizes. The name member holds the attribute values as a string. Multiple bits set for a theme mean the mask contains an aggregate or a question mark.
|
noexcept |
Move copy constructor.
| [in] | rhs | development to swap |
| Core::FMTMask::FMTMask | ( | ) |
Default constructor for FMTMask.
| Core::FMTMask::FMTMask | ( | const FMTMask & | rhs | ) |
|
virtualdefault |
Default virtual destructor for FMTMask.
| Core::FMTMask::FMTMask | ( | const boost::dynamic_bitset< uint8_t > & | bits | ) |
Construct a mask setting only the bitset data member.
| [in] | bits | the bitset data. |
| Core::FMTMask::FMTMask | ( | const std::string & | mask, |
| const boost::dynamic_bitset< uint8_t > & | bits | ||
| ) |
Construct a mask from an already set bitset and a string mask used as name.
| [in] | mask | the string mask used as name. |
| [in] | bits | the bitset data. |
| Core::FMTMask::FMTMask | ( | const std::string & | mask, |
| const std::vector< FMTTheme > & | themes | ||
| ) |
Construct a complete mask from a string and sorted themes.
| [in] | mask | the string mask. |
| [in] | themes | the sorted themes. |
| Core::FMTMask::FMTMask | ( | const std::vector< std::string > & | values, |
| const std::vector< FMTTheme > & | themes | ||
| ) |
Construct a mask from a vector of attribute strings and sorted themes.
| [in] | values | the attribute strings. |
| [in] | themes | the sorted themes. |
| Core::FMTMask::FMTMask | ( | const std::vector< FMTTheme > & | themes | ) |
Construct an empty mask sized for the given themes.
| [in] | themes | the sorted themes. |
| void Core::FMTMask::append | ( | const boost::dynamic_bitset< uint8_t > & | bits | ) |
Append a bitset to the bitset data member of the mask.
| [in] | bits | the bitset to append. |
|
inline |
|
inline |
Binarize an element and append it to the mask.
| typetobinarize | the type of the element. |
| [in] | element | the element to binarize and append. |
| bool Core::FMTMask::canPreSolve | ( | const FMTMaskFilter & | p_filter, |
| const std::vector< FMTTheme > & | p_presolvedThemes | ||
| ) | const |
Return true if the mask can be presolved with the given filter and themes.
| [in] | p_filter | the mask filter. |
| [in] | p_presolvedThemes | the presolved themes. |
| void Core::FMTMask::clear | ( | ) |
Clear the data and name members.
| size_t Core::FMTMask::count | ( | ) | const |
Return the number of bits set.
Disaggregate the attribute of a theme from the mask into a vector of masks, one per possible attribute.
| [in] | theme | the theme to decompose. |
| bool Core::FMTMask::empty | ( | ) | const |
Return true if the data member is empty.
| std::string Core::FMTMask::get | ( | const FMTTheme & | theme | ) | const |
Get the attribute of the mask for a given theme.
| [in] | theme | the theme. |
| std::string Core::FMTMask::get | ( | const std::vector< FMTTheme > & | themes | ) | const |
Get the string mask name based on the bitset data and sorted themes.
| [in] | themes | the sorted themes. |
| const std::string & Core::FMTMask::getAttribute | ( | const FMTTheme & | p_theme | ) | const |
When you deal with FMTDevelopment you can directly call this to get a reference to the attribute string.
| [in] | p_theme | the theme we target |
| boost::dynamic_bitset< uint8_t > Core::FMTMask::getBitsetIntersect | ( | const FMTMask & | rhs | ) | const |
Return the bitset of the intersection of this mask and another mask.
| [in] | rhs | the other mask. |
|
inline |
Return a const reference to the bitset data member.
| std::string Core::FMTMask::getBitsString | ( | ) | const |
Return the binary representation of the bitset as a string.
Return the intersection of this mask and another mask.
| [in] | rhs | the other mask. |
| std::vector< size_t > Core::FMTMask::getNonFullBlocks | ( | ) | const |
Return the indexes of the blocks that contain a 0.
| FMTMask Core::FMTMask::getPostSolveMask | ( | const FMTMask & | mask, |
| const std::vector< FMTTheme > & | themes | ||
| ) | const |
Turn off the bits of themes that are still active on a base postsolve mask.
| [in] | mask | the mask used to turn off bits. |
| [in] | themes | the themes. |
| std::vector< const Core::FMTTheme * > Core::FMTMask::getSelectedThemes | ( | const std::vector< Core::FMTTheme > & | themes | ) | const |
Return the themes that have any bit set in the mask.
| [in] | themes | the themes to filter. |
| std::vector< const Core::FMTTheme * > Core::FMTMask::getStaticThemes | ( | const std::vector< const Core::FMTTheme * > & | themes | ) | const |
Return the themes that only use aggregates or a question mark for the mask.
| [in] | themes | the themes to filter. |
|
inline |
Return a const reference to the name string member.
| size_t Core::FMTMask::getSubsetCount | ( | const FMTTheme & | theme | ) | const |
Return the number of bits set for the given theme subset.
| [in] | theme | the theme. |
Return the union of this mask and another mask.
| [in] | rhs | the other mask. |
|
inline |
Return the hash of the mask.
| bool Core::FMTMask::isNotThemesSubset | ( | const FMTMask & | rhs, |
| const std::vector< const Core::FMTTheme * > & | themes | ||
| ) | const |
Return true if this mask is not part of rhs based on the sorted themes.
| [in] | rhs | the other mask. |
| [in] | themes | the sorted themes. |
| bool Core::FMTMask::isNotThemesSubset | ( | const FMTMask & | rhs, |
| const std::vector< Core::FMTTheme > & | themes | ||
| ) | const |
Return true if this mask is not part of rhs based on the sorted themes.
| [in] | rhs | the other mask. |
| [in] | themes | the sorted themes. |
| bool Core::FMTMask::isSubsetOf | ( | const FMTMask & | p_mask, |
| const std::vector< size_t > & | p_subset | ||
| ) | const |
Check if this mask is a subset of another mask by looking at a block subset.
| [in] | p_mask | the other mask. |
| [in] | p_subset | the block subset. |
| bool Core::FMTMask::isSubsetOf | ( | const FMTMask & | p_rhs | ) | const |
Check if this mask is a subset of another mask.
| [in] | p_rhs | the mask to check against. |
|
explicit |
Return true if the mask is not empty by looking at the data bitset.
|
inline |
Return the name of the mask.
| bool Core::FMTMask::operator!= | ( | const FMTMask & | rhs | ) | const |
Inequality comparison operator of FMTMask.
| [in] | rhs | the mask to compare with. |
| bool Core::FMTMask::operator< | ( | const FMTMask & | rhs | ) | const |
Less than comparison operator of FMTMask.
| [in] | rhs | the mask to compare with. |
| bool Core::FMTMask::operator== | ( | const FMTMask & | rhs | ) | const |
Equality comparison operator of FMTMask.
| [in] | rhs | the mask to compare with. |
| FMTMask Core::FMTMask::postSolve | ( | const FMTMaskFilter & | filter, |
| const std::vector< FMTTheme > & | basethemes | ||
| ) | const |
Return a postsolved mask using a filter and the original themes.
| [in] | filter | the mask filter. |
| [in] | basethemes | the original themes. |
| FMTMask Core::FMTMask::preSolve | ( | const FMTMaskFilter & | filter, |
| const std::vector< FMTTheme > & | presolvedthemes | ||
| ) | const |
Return a presolved mask with potentially less data using a filter and a subset of the original themes.
| [in] | filter | the mask filter. |
| [in] | presolvedthemes | the presolved themes. |
| void Core::FMTMask::preSolveRef | ( | const FMTMaskFilter & | p_filter, |
| const std::vector< FMTTheme > & | p_presolvedThemes, | ||
| bool | p_allowReallocation = true |
||
| ) |
Presolve this mask in place with potentially less data using a filter and a subset of the original themes.
| [in] | p_filter | the mask filter. |
| [in] | p_presolvedThemes | the presolved themes. |
| [in] | p_allowReallocation | if true allows reallocation of the data. |
| FMTMask Core::FMTMask::refine | ( | const FMTMask & | mask, |
| const std::vector< FMTTheme > & | themes | ||
| ) | const |
Return a new mask where the question marks are completed with the attributes of another mask.
| [in] | mask | the mask to refine from. |
| [in] | themes | the themes. |
| FMTMask Core::FMTMask::removeAggregates | ( | const std::vector< FMTTheme > & | themes, |
| bool | questionmarkonly = false |
||
| ) | const |
Return a new mask with the bits of aggregates or question marks unset for the given themes.
| [in] | themes | the themes. |
| [in] | questionmarkonly | if true only removes question marks. |
| void Core::FMTMask::reserve | ( | size_t | p_size | ) |
reserve memory for the boost dynamicbitset.
| [in] | p_size | number of bits to reserve. |
| FMTMask Core::FMTMask::resume | ( | const boost::dynamic_bitset< uint8_t > & | rhs | ) | const |
Return a mask with the selected name and data using a bitset.
| [in] | rhs | the selection bitset. |
| FMTMask Core::FMTMask::resume | ( | const std::vector< size_t > & | indexes | ) | const |
Return a mask with the selected name and data using mask indexes.
| [in] | indexes | the selection indexes. |
| void Core::FMTMask::set | ( | const FMTTheme & | theme, |
| const std::string & | value | ||
| ) |
Set the bitset data for a given theme from an attribute.
| [in] | theme | the theme. |
| [in] | value | the attribute. |
| void Core::FMTMask::set | ( | const std::vector< FMTTheme > & | themes, |
| const std::string & | value | ||
| ) |
Set the bitset data for some themes from a mask string.
| [in] | themes | the themes. |
| [in] | value | the mask string. |
Flip only the theme subset and clear the mask of the intersection with another mask.
| [in] | p_mask | the mask to intersect with. |
| [in] | p_theme | the theme to subset on. |
| void Core::FMTMask::setIntersect | ( | const FMTMask & | rhs | ) |
set the intersect with this mask using rhs mask.
| [in] | rhs | the mask we intersect with. |
| size_t Core::FMTMask::size | ( | ) | const |
Return the size of the bitset data member.
| void Core::FMTMask::swap | ( | FMTMask & | rhs | ) |
Swap this mask with another.
| [in,out] | rhs | the mask to swap with. |
| void Core::FMTMask::unionWith | ( | const FMTMask & | rhs | ) |
Performs an in-place union with another mask.
| rhs | Mask whose bits will be added to the current mask. |
| void Core::FMTMask::update | ( | const std::vector< FMTTheme > & | themes | ) |
Update the name member from the bitset data using a sorted list of themes.
| [in] | themes | the sorted themes. |
|
friend |
|
friend |