8#ifndef FMTobject_Hm_included
9#define FMTobject_Hm_included
15#include <boost/serialization/unique_ptr.hpp>
16#include <boost/serialization/nvp.hpp>
17#include <boost/serialization/export.hpp>
23#if defined _MSC_VER || __MINGW64__ || __CYGWIN__
26 #include <boost/dll/runtime_symbol_info.h>
31 class FMTExceptionHandler;
90 FMTObject(
const std::unique_ptr<Exception::FMTExceptionHandler> exhandler);
109 virtual void passInLogger(
const std::unique_ptr<Logging::FMTLogger>& logger);
201 friend class boost::serialization::access;
202 template<
class Archive>
212 static std::unique_ptr<Exception::FMTExceptionHandler>
_exhandler;
215 static std::unique_ptr<Logging::FMTLogger>
_logger;
223 template<
class Archive>
224 void forceSave(Archive& ar,
const unsigned int version)
const
237 template<
class Archive>
243 setDefaultExceptionHandler();
261 static std::chrono::time_point<std::chrono::high_resolution_clock>
getClock();
269 template<
class chrono>
270 static double getDuration(
const std::chrono::time_point<std::chrono::high_resolution_clock>& startclock);
277 static std::string
getDurationInSeconds(
const std::chrono::time_point<std::chrono::high_resolution_clock>& startclock);
299BOOST_CLASS_TRACKING(
Core::FMTObject, boost::serialization::track_always)
#define FMTEXPORT
Definition: FMTutility.h:125
Base class of multiple FMT classes holding a shared exception handler pointer and logger.
Definition: FMTObject.h:49
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.
void setQuietExceptionHandler()
Create and set a quiet exception handler to the FMTObject.
static Logging::FMTLogger * getLogger()
get a pointer to the actual logger.
void forceSave(Archive &ar, const unsigned int version) const
Force the serialization to save useful information, which the default FMTObject serialization does no...
Definition: FMTObject.h:224
static Exception::FMTExceptionHandler * getExceptionHandler()
get a pointer to the actual exception handler.
virtual void setDebugLogger()
Create and set a debug logger to the FMTObject.
void forceLoad(Archive &ar, const unsigned int version)
Force the serialization to load useful information, which the default FMTObject serialization does no...
Definition: FMTObject.h:238
static std::unique_ptr< Logging::FMTLogger > _logger
A shared pointer to the logger.
Definition: FMTObject.h:215
void passInExceptionHandler(const std::unique_ptr< Exception::FMTExceptionHandler > &exhandler)
Pass in the exception handler of another FMTObject.
void setCplHandler()
Pass the FMT exception handler to the GDAL exception handler (GDAL only).
static std::unique_ptr< Exception::FMTExceptionHandler > _exhandler
A shared pointer to the exception handler.
Definition: FMTObject.h:212
void setFreeExceptionHandler()
Create and set a free exception handler to the FMTObject.
void enableNestedExceptions()
Enable the nested exception throw of the exception handler.
FMTObject()
Default constructor for FMTObject.
virtual void setDefaultLogger()
Create and set a default logger to the FMTObject.
void redirectLogToFile(const std::string &location)
Redirect the log to a specific file, appending to it.
static std::chrono::time_point< std::chrono::high_resolution_clock > getClock()
Return a clock of the current time.
virtual void setTaskLogger()
Create and set a task logger to the FMTObject.
FMTObject(const FMTObject &rhs)
Copy constructor for FMTObject.
void checkSignals() const
Check if the user has sent a ctrl-c signal using boost::python to FMT.
static std::string getRuntimeLocation()
Return the location of the FMT shared library.
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 unsigned long long getAvailableMemory()
Return the available memory in bytes.
FMTObject(const std::unique_ptr< Exception::FMTExceptionHandler > exhandler)
Construct a FMTObject passing in the exception handler of another FMTObject.
void setDefaultExceptionHandler()
Create and set a default exception handler to the FMTObject.
static void _terminate()
Raise an error with the boost stacktrace.
virtual ~FMTObject()
Default virtual destructor for FMTObject.
void serialize(Archive &ar, const unsigned int version)
Definition: FMTObject.h:203
static void _logStack()
Log the stack trace...
static void setAbortStack()
will write the stack in the log when abort called with SIGABRT and raise a function failed.
void setErrorsToWarnings(const std::vector< Exception::FMTexc > &errors)
Set a list of errors to be cast to warnings on the exception handler.
static void _abort(int p_signal)
Raise an error with the boost stacktrace on abort.
virtual void setQuietLogger()
Create and set a quiet logger to the FMTObject.
void disableNestedExceptions()
Disable the nested exception throw of the exception handler.
virtual void passInLogger(const std::unique_ptr< Logging::FMTLogger > &logger)
Pass in the logger of another FMTObject.
static void setTerminateStack()
will write the stack in the log when terminate called and raise a function failed.
void setMaxWarningsBeforeSilenced(const size_t &maxwarningcount)
Set the number of warnings raised before being silenced.
void setDebugExceptionHandler()
Create and set a debug exception handler to the FMTObject.
Base class used to handle errors thrown in FMT.
Definition: FMTExceptionHandler.h:34
Base class handling the level of information printed by FMT.
Definition: FMTLogger.h:37
The Core namespace provides classes for simulating stands/strata growth/harvest through time.
Definition: FMTAction.h:34
Namespace for exceptions and exceptions handling (warnings and errors) thrown by FMT and all exceptio...
Definition: FMTAggregateRedefinition.h:11
Namespace for the log management, provides different log handlers.
Definition: FMTDebugLogger.h:14