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

Class holding the constants defined in the constants section of a model, used by the parsers. More...

#include <FMTConstants.h>

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

Public Member Functions

 FMTConstants ()
 Default constructor for FMTConstants.
 
 ~FMTConstants ()=default
 Default destructor for FMTConstants.
 
 FMTConstants (const FMTConstants &rhs)
 Copy constructor for FMTConstants.
 
void set (const std::string &key, std::vector< double >values)
 Set the values of a given constant.
 
template<typename T >
get (std::string key, int period=0) const
 Get the value of a given constant for a given period.
 
template<typename T >
std::vector< T > getAll (std::string key) const
 Get all the values of a given constant.
 
bool isConstant (std::string value) const
 Return true if the given value is considered a constant.
 
size_t length (std::string value) const
 Return the number of double values kept by a given constant.
 
FMTConstantsoperator= (const FMTConstants &rhs)
 Copy assignment operator for FMTConstants.
 
 operator std::string () const
 Return the constants as a constant section (.con) string.
 
- 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.
 
FMTObjectoperator= (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)
 

Friends

class boost::serialization::access
 Serialize the FMTConstants for multiprocessing across multiple cpus (pickle in Python).
 

Additional Inherited Members

- Static Public Member Functions inherited from Core::FMTObject
static Logging::FMTLoggergetLogger ()
 get a pointer to the actual logger.
 
static Exception::FMTExceptionHandlergetExceptionHandler ()
 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 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.
 

Detailed Description

Class holding the constants defined in the constants section of a model, used by the parsers.

A constant is represented by a string and holds double values.

Constructor & Destructor Documentation

◆ FMTConstants() [1/2]

Core::FMTConstants::FMTConstants ( )

Default constructor for FMTConstants.

◆ ~FMTConstants()

Core::FMTConstants::~FMTConstants ( )
default

Default destructor for FMTConstants.

◆ FMTConstants() [2/2]

Core::FMTConstants::FMTConstants ( const FMTConstants rhs)

Copy constructor for FMTConstants.

Parameters
[in]rhsthe FMTConstants to copy.

Member Function Documentation

◆ get()

template<typename T >
T Core::FMTConstants::get ( std::string  key,
int  period = 0 
) const

Get the value of a given constant for a given period.

Template Parameters
Tthe value type.
Parameters
[in]keythe constant definition string.
[in]periodthe period.
Returns
the value of the constant for the period.

◆ getAll()

template<typename T >
std::vector< T > Core::FMTConstants::getAll ( std::string  key) const

Get all the values of a given constant.

Template Parameters
Tthe value type.
Parameters
[in]keythe constant definition string.
Returns
all the values of the constant.

◆ isConstant()

bool Core::FMTConstants::isConstant ( std::string  value) const

Return true if the given value is considered a constant.

Parameters
[in]valuethe value to check.
Returns
true if the value is a constant else false.

◆ length()

size_t Core::FMTConstants::length ( std::string  value) const

Return the number of double values kept by a given constant.

Parameters
[in]valuethe constant definition string.
Returns
the number of values of the constant.

◆ operator std::string()

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

Return the constants as a constant section (.con) string.

Returns
the string representation of the constants.

◆ operator=()

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

Copy assignment operator for FMTConstants.

Parameters
[in]rhsthe FMTConstants to copy.
Returns
a reference to this FMTConstants.

◆ set()

void Core::FMTConstants::set ( const std::string &  key,
std::vector< double >  values 
)

Set the values of a given constant.

Parameters
[in]keythe constant definition string.
[in]valuesthe values of the constant.

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Serialize the FMTConstants for multiprocessing across multiple cpus (pickle in Python).

Template Parameters
Archivethe archive type.
Parameters
[in,out]arthe archive to serialize to or from.
[in]versionthe serialization version.

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