![]() |
FMT 1.2.0
Forest management tools for forest planning
|
Class holding the attributes and aggregates of a single theme, describing a part of a FMTMask. More...
#include <FMTTheme.h>
Public Member Functions | |
| FMTTheme () | |
| Default constructor for FMTTheme. | |
| ~FMTTheme ()=default | |
| Default destructor for FMTTheme. | |
| FMTTheme (const std::vector< std::string > &p_attributes, const std::vector< std::string > &p_attributenames, const std::vector< std::string > &p_aggregates, const std::vector< std::vector< std::string > > &p_aggregatenames, const std::vector< std::map< std::string, double > > &p_indexes, const size_t &p_id, const size_t &p_start, const std::string &p_name) | |
| Constructor used for theme indexing with indexes. | |
| FMTTheme (const std::vector< std::string > &p_attributes, const std::vector< std::string > &p_attributenames, const std::vector< std::string > &p_aggregates, const std::vector< std::vector< std::string > > &p_aggregatenames, const size_t &p_id, const size_t &p_start, const std::string &p_name) | |
| Constructor used for theme indexing. | |
| FMTTheme (const std::vector< std::string > &p_attributes, const size_t &p_id, const size_t &p_start, const std::string &p_name) | |
| Simpler constructor for a theme without aggregates or indexing. | |
| FMTTheme (const FMTTheme &rhs) | |
| Copy constructor for FMTTheme. | |
| FMTTheme & | operator= (const FMTTheme &rhs) |
| Copy assignment operator for FMTTheme. | |
| bool | isAttribute (const std::string &p_value) const |
| Return true if the value is an attribute of the theme. | |
| bool | isAggregate (const std::string &p_value) const |
| Return true if the value is an aggregate of the theme. | |
| bool | isIndex (const std::string &p_attribute, const std::string &p_value) const |
| Return true if the value is an index of the theme for a given attribute (yields section only). | |
| bool | isIndex (const std::string &p_value) const |
| Return true if the value is an index of the theme (yields section only). | |
| bool | useIndex () const |
| Return true if the theme uses indexes. | |
| double | getIndex (const std::string &p_attribute, const std::string &p_value) const |
| Get the index value for a given attribute and index. | |
| bool | inAggregate (const std::string &p_value, const std::string &p_aggregate) |
| Check if a value is part of an aggregate. | |
| bool | isValid (const std::string &p_value) const |
| Check if a value is a valid attribute, aggregate or question mark for the theme. | |
| bool | operator== (const FMTTheme &p_rhs) const |
| Equality comparison operator of FMTTheme. | |
| size_t | size () const |
| Return the size of the theme, 0 if it has no attribute. | |
| const size_t & | getStart () const |
| Return the bit location of the mask at which the theme starts. | |
| const size_t & | getId () const |
| Return the id of the theme. | |
| std::string | getName () const |
| Return the name of the theme. | |
| bool | empty () const |
| Return true if the theme has no attribute. | |
| std::vector< std::string > | getAttributes (const std::string &p_value, bool p_aggregate_source=false) const |
| Get the attributes of an aggregate for the theme. | |
| const std::vector< std::string > & | getBaseAttributes () const |
| Return a reference to the base attributes of the theme. | |
| const std::vector< std::string > & | getAttributeNames () const |
| Return the names of the attributes. | |
| FMTTheme | preSolve (FMTMaskFilter &p_maskfilter, size_t &p_newid, size_t &p_newstart) const |
| Presolve the theme, removing unused attributes based on the filter and assigning a new id and start. | |
| std::string | updateFromMask (const Core::FMTMask &p_globalmask) |
| Update the theme with the aggregates in a global mask or with newly created aggregates and return the new attribute value. | |
| operator std::string () const | |
| Return a string representation of the theme as seen in a landscape file. | |
| std::vector< std::string > | getAggregates () const |
| Return the aggregates of the theme. | |
Public Member Functions inherited from Core::FMTObject | |
| FMTObject () | |
| Default constructor for FMTObject. | |
| virtual | ~FMTObject () |
| Default virtual destructor for FMTObject. | |
| FMTObject (const std::unique_ptr< Exception::FMTExceptionHandler > exhandler) | |
| Construct a FMTObject passing in the exception handler of another FMTObject. | |
| FMTObject (const FMTObject &rhs) | |
| Copy constructor for FMTObject. | |
| FMTObject & | operator= (const FMTObject &rhs) |
| Copy assignment operator for FMTObject. | |
| virtual void | passInLogger (const std::unique_ptr< Logging::FMTLogger > &logger) |
| Pass in the logger of another FMTObject. | |
| void | passInExceptionHandler (const std::unique_ptr< Exception::FMTExceptionHandler > &exhandler) |
| Pass in the exception handler of another FMTObject. | |
| void | redirectLogToFile (const std::string &location) |
| Redirect the log to a specific file, appending to it. | |
| virtual void | setDefaultLogger () |
| Create and set a default logger to the FMTObject. | |
| virtual void | setQuietLogger () |
| Create and set a quiet logger to the FMTObject. | |
| virtual void | setTaskLogger () |
| Create and set a task logger to the FMTObject. | |
| virtual void | setDebugLogger () |
| Create and set a debug logger to the FMTObject. | |
| void | setDefaultExceptionHandler () |
| Create and set a default exception handler to the FMTObject. | |
| void | setQuietExceptionHandler () |
| Create and set a quiet exception handler to the FMTObject. | |
| void | setDebugExceptionHandler () |
| Create and set a debug exception handler to the FMTObject. | |
| void | setFreeExceptionHandler () |
| Create and set a free exception handler to the FMTObject. | |
| void | disableNestedExceptions () |
| Disable the nested exception throw of the exception handler. | |
| void | enableNestedExceptions () |
| Enable the nested exception throw of the exception handler. | |
| void | setErrorsToWarnings (const std::vector< Exception::FMTexc > &errors) |
| Set a list of errors to be cast to warnings on the exception handler. | |
| void | setMaxWarningsBeforeSilenced (const size_t &maxwarningcount) |
| Set the number of warnings raised before being silenced. | |
| template<class Archive > | |
| void | serialize (Archive &ar, const unsigned int version) |
Static Public Member Functions | |
| static bool | validate (const std::vector< Core::FMTTheme > &p_themes, std::string &p_mask, std::string p_otherinformation=std::string()) |
| Validate the construction of a valid mask string based on the themes, trimming the mask if there are fewer themes than in the string. | |
| static bool | checkMask (const std::vector< Core::FMTTheme > &p_themes, const std::vector< std::string > &p_values, std::string &p_mask, const std::string &p_otherinformation) |
| Validate the mask string for a vector of themes and throw an exception if something is wrong, called by validate. | |
Static Public Member Functions inherited from Core::FMTObject | |
| static Logging::FMTLogger * | getLogger () |
| get a pointer to the actual logger. | |
| static Exception::FMTExceptionHandler * | getExceptionHandler () |
| get a pointer to the actual exception handler. | |
| static std::string | getRuntimeLocation () |
| Return the location of the FMT shared library. | |
| static unsigned long long | getAvailableMemory () |
| Return the available memory in bytes. | |
| static void | setTerminateStack () |
| will write the stack in the log when terminate called and raise a function failed. | |
| static void | setAbortStack () |
| will write the stack in the log when abort called with SIGABRT and raise a function failed. | |
Protected Attributes | |
| size_t | m_id |
| Id is the id of the theme first theme in the landscape section is number 1. | |
| size_t | m_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 |
| Serialize the FMTTheme through its base FMTObject for multiprocessing across multiple cpus (pickle in Python). | |
Additional Inherited Members | |
Protected Member Functions inherited from Core::FMTObject | |
| template<class Archive > | |
| void | forceSave (Archive &ar, const unsigned int version) const |
| Force the serialization to save useful information, which the default FMTObject serialization does not. | |
| template<class Archive > | |
| void | forceLoad (Archive &ar, const unsigned int version) |
| Force the serialization to load useful information, which the default FMTObject serialization does not. | |
| void | checkSignals () const |
| Check if the user has sent a ctrl-c signal using boost::python to FMT. | |
| void | setCplHandler () |
| Pass the FMT exception handler to the GDAL exception handler (GDAL only). | |
Static Protected Member Functions inherited from Core::FMTObject | |
| static std::chrono::time_point< std::chrono::high_resolution_clock > | getClock () |
| Return a clock of the current time. | |
| template<class chrono > | |
| static double | getDuration (const std::chrono::time_point< std::chrono::high_resolution_clock > &startclock) |
| Return the time elapsed since a start clock as a double. | |
| static std::string | getDurationInSeconds (const std::chrono::time_point< std::chrono::high_resolution_clock > &startclock) |
| Return the time elapsed since a start clock in seconds as a string. | |
| static void | _logStack () |
| Log the stack trace... | |
| static void | _terminate () |
| Raise an error with the boost stacktrace. | |
| static void | _abort (int p_signal) |
| Raise an error with the boost stacktrace on abort. | |
Static Protected Attributes inherited from Core::FMTObject | |
| static std::unique_ptr< Exception::FMTExceptionHandler > | _exhandler |
| A shared pointer to the exception handler. | |
| static std::unique_ptr< Logging::FMTLogger > | _logger |
| A shared pointer to the logger. | |
Class holding the attributes and aggregates of a single theme, describing a part of a FMTMask.
A FMTTheme describes a part of a FMTMask from its start bit to start + size, and holds the attribute aggregates. It is closely related to FMTMask.
| Core::FMTTheme::FMTTheme | ( | ) |
Default constructor for FMTTheme.
|
default |
Default destructor for FMTTheme.
| Core::FMTTheme::FMTTheme | ( | const std::vector< std::string > & | p_attributes, |
| const std::vector< std::string > & | p_attributenames, | ||
| const std::vector< std::string > & | p_aggregates, | ||
| const std::vector< std::vector< std::string > > & | p_aggregatenames, | ||
| const std::vector< std::map< std::string, double > > & | p_indexes, | ||
| const size_t & | p_id, | ||
| const size_t & | p_start, | ||
| const std::string & | p_name | ||
| ) |
Constructor used for theme indexing with indexes.
| [in] | p_attributes | the attributes. |
| [in] | p_attributenames | the attribute names. |
| [in] | p_aggregates | the aggregates. |
| [in] | p_aggregatenames | the aggregate names. |
| [in] | p_indexes | the indexes of each attribute. |
| [in] | p_id | the id of the theme. |
| [in] | p_start | the start bit location. |
| [in] | p_name | the name of the theme. |
| Core::FMTTheme::FMTTheme | ( | const std::vector< std::string > & | p_attributes, |
| const std::vector< std::string > & | p_attributenames, | ||
| const std::vector< std::string > & | p_aggregates, | ||
| const std::vector< std::vector< std::string > > & | p_aggregatenames, | ||
| const size_t & | p_id, | ||
| const size_t & | p_start, | ||
| const std::string & | p_name | ||
| ) |
Constructor used for theme indexing.
| [in] | p_attributes | the attributes. |
| [in] | p_attributenames | the attribute names. |
| [in] | p_aggregates | the aggregates. |
| [in] | p_aggregatenames | the aggregate names. |
| [in] | p_id | the id of the theme. |
| [in] | p_start | the start bit location. |
| [in] | p_name | the name of the theme. |
| Core::FMTTheme::FMTTheme | ( | const std::vector< std::string > & | p_attributes, |
| const size_t & | p_id, | ||
| const size_t & | p_start, | ||
| const std::string & | p_name | ||
| ) |
Simpler constructor for a theme without aggregates or indexing.
| [in] | p_attributes | the attributes. |
| [in] | p_id | the id of the theme. |
| [in] | p_start | the start bit location. |
| [in] | p_name | the name of the theme. |
| Core::FMTTheme::FMTTheme | ( | const FMTTheme & | rhs | ) |
|
static |
Validate the mask string for a vector of themes and throw an exception if something is wrong, called by validate.
| [in] | p_themes | the themes. |
| [in] | p_values | the attribute values. |
| [in,out] | p_mask | the mask string. |
| [in] | p_otherinformation | additional information. |
|
inline |
Return true if the theme has no attribute.
| std::vector< std::string > Core::FMTTheme::getAggregates | ( | ) | const |
Return the aggregates of the theme.
|
inline |
Return the names of the attributes.
| std::vector< std::string > Core::FMTTheme::getAttributes | ( | const std::string & | p_value, |
| bool | p_aggregate_source = false |
||
| ) | const |
Get the attributes of an aggregate for the theme.
| [in] | p_value | the aggregate. |
| [in] | p_aggregate_source | if true uses the aggregate source map. |
|
inline |
Return a reference to the base attributes of the theme.
|
inline |
Return the id of the theme.
| double Core::FMTTheme::getIndex | ( | const std::string & | p_attribute, |
| const std::string & | p_value | ||
| ) | const |
Get the index value for a given attribute and index.
| [in] | p_attribute | the attribute. |
| [in] | p_value | the index. |
|
inline |
Return the name of the theme.
|
inline |
Return the bit location of the mask at which the theme starts.
| bool Core::FMTTheme::inAggregate | ( | const std::string & | p_value, |
| const std::string & | p_aggregate | ||
| ) |
Check if a value is part of an aggregate.
| [in] | p_value | the value to check. |
| [in] | p_aggregate | the aggregate. |
|
inline |
Return true if the value is an aggregate of the theme.
| [in] | p_value | the value to check. |
|
inline |
Return true if the value is an attribute of the theme.
| [in] | p_value | the value to check. |
| bool Core::FMTTheme::isIndex | ( | const std::string & | p_attribute, |
| const std::string & | p_value | ||
| ) | const |
Return true if the value is an index of the theme for a given attribute (yields section only).
| [in] | p_attribute | the attribute. |
| [in] | p_value | the value to check. |
| bool Core::FMTTheme::isIndex | ( | const std::string & | p_value | ) | const |
Return true if the value is an index of the theme (yields section only).
| [in] | p_value | the value to check. |
| bool Core::FMTTheme::isValid | ( | const std::string & | p_value | ) | const |
Check if a value is a valid attribute, aggregate or question mark for the theme.
| [in] | p_value | the value to check. |
| Core::FMTTheme::operator std::string | ( | ) | const |
Return a string representation of the theme as seen in a landscape file.
| bool Core::FMTTheme::operator== | ( | const FMTTheme & | p_rhs | ) | const |
Equality comparison operator of FMTTheme.
| [in] | p_rhs | the theme to compare with. |
| FMTTheme Core::FMTTheme::preSolve | ( | FMTMaskFilter & | p_maskfilter, |
| size_t & | p_newid, | ||
| size_t & | p_newstart | ||
| ) | const |
Presolve the theme, removing unused attributes based on the filter and assigning a new id and start.
| [in,out] | p_maskfilter | the mask filter. |
| [in,out] | p_newid | the new id, incremented if the presolved theme is not empty and has size greater than 1. |
| [in,out] | p_newstart | the new start, incremented accordingly. |
|
inline |
Return the size of the theme, 0 if it has no attribute.
| std::string Core::FMTTheme::updateFromMask | ( | const Core::FMTMask & | p_globalmask | ) |
Update the theme with the aggregates in a global mask or with newly created aggregates and return the new attribute value.
| [in] | p_globalmask | the global mask. |
| bool Core::FMTTheme::useIndex | ( | ) | const |
Return true if the theme uses indexes.
|
static |
Validate the construction of a valid mask string based on the themes, trimming the mask if there are fewer themes than in the string.
| [in] | p_themes | the themes. |
| [in,out] | p_mask | the mask string. |
| [in] | p_otherinformation | optional additional information. |
|
friend |
|
friend |
|
friend |
|
protected |
Id is the id of the theme first theme in the landscape section is number 1.
|
protected |
Start is the bit location in the FMTMask at which the attributes of the theme starts.