FMT 1.2.0
Forest management tools for forest planning
Loading...
Searching...
No Matches
RexportExceptions.h
Go to the documentation of this file.
1/*
2Copyright (c) 2019 Gouvernement du Québec
3
4SPDX-License-Identifier: LiLiQ-R-1.1
5License-Filename: LICENSES/EN/LiLiQ-R11unicode.txt
6*/
7
8#ifndef REXPORTEXCEPTIONS_H_INCLUDED
9#define REXPORTEXCEPTIONS_H_INCLUDED
10
14#include "FMTExceptionHandler.h"
15#include <Rcpp.h>
16#include "Rdefinitions.h"
17#include "FMTError.h"
18#include "FMTWarning.h"
19#include "FMTException.h"
20
21/*
22RCPP_EXPOSED_WRAP(Exception::FMTExceptionHandler);
23RCPP_EXPOSED_AS(Exception::FMTExceptionHandler);*/
40
41namespace R
42{
43
45 {
46
47 /*Rcpp::class_<Exception::FMTExceptionHandler>("FMTexceptionhandler", "@DocString(FMTExceptionHandler)")
48 .constructor("@DocString(FMTExceptionHandler())");*/
49
50
51 Rcpp::class_<Exception::FMTDefaultExceptionHandler>("FMTdefaultexceptionhandler", "@DocString(FMTDefaultExceptionHandler)")
52 //.derives<Exception::FMTExceptionHandler>("FMTexceptionhandler")
53 .constructor("@DocString(FMTDefaultExceptionHandler())")
55 "@DocString(FMTDefaultExceptionHandler::raise)");
56
57
58 Rcpp::class_<Exception::FMTQuietExceptionHandler>("FMTquietexceptionhandler", "@DocString(FMTQuietExceptionHandler)")
59 //.derives<Exception::FMTExceptionHandler>("FMTexceptionhandler")
60 .constructor("@DocString(FMTQuietExceptionHandler())")
62 "@DocString(FMTQuietExceptionHandler::raise)");
63
64
65 Rcpp::class_<Exception::FMTDebugExceptionHandler>("FMTdebugexceptionhandler", "@DocString(FMTDebugExceptionHandler)")
66 //.derives<Exception::FMTExceptionHandler>("FMTexceptionhandler")
67 .constructor("@DocString(FMTDebugExceptionHandler())")
69 "@DocString(FMTDebugExceptionHandler::raise)");
70
71
72 Rcpp::class_<Exception::FMTException>("FMTexception")
73 .constructor("@DocString(FMTDebugExceptionHandler())")
74 .method("gettype", &Exception::FMTException::getType,
75 "@DocString(FMTDebugExceptionHandler::gettype)")
76 .method("getsection", &Exception::FMTException::getSection,
77 "@DocString(FMTDebugExceptionHandler::getsection)")
78 .method("what", &Exception::FMTException::what,
79 "@DocString(FMTDebugExceptionHandler::what)");
80
81 Rcpp::class_<Exception::FMTError>("FMTerror", "@DocString(FMTError)")
82 .derives<Exception::FMTException>("FMTexception")
83 .constructor("@DocString(FMTError())");
84
85 Rcpp::class_<Exception::FMTWarning>("FMTwarning", "@DocString(FMTWarning)")
86 .derives<Exception::FMTException>("FMTexception")
87 .constructor("@DocString(FMTWarning())");
88 }
89
90}
91
92#endif // PYEXPORTEXCEPTIONS_H_INCLUDED
RCPP_DEFINEVECTOR(Exception::FMTexc)
RCPP_EXPOSED_ENUM_NODECL(Exception::FMTexc)
RCPP_EXPOSED_AS(Exception::FMTDefaultExceptionHandler)
RCPP_EXPOSED_WRAP(Exception::FMTDefaultExceptionHandler)
Exception handler derived from FMTExceptionHandler that reports the source line and file where the ex...
Definition: FMTDebugExceptionHandler.h:21
FMTException raise(FMTexc lexception, std::string text, const std::string &method, const int &line, const std::string &file, Core::FMTsection lsection=Core::FMTsection::Empty, bool throwit=true) override
Override the base class raise function with a debug style. See FMTExceptionHandler::raise.
Default exception handler used in FMT, derived from FMTExceptionHandler.
Definition: FMTDefaultExceptionHandler.h:22
FMTException raise(FMTexc lexception, std::string text, const std::string &method, const int &line, const std::string &file, Core::FMTsection lsection=Core::FMTsection::Empty, bool throwit=true) override
Default implementation overriding the base class raise function. See FMTExceptionHandler::raise.
Exception class derived from FMTException for errors thrown in FMT.
Definition: FMTError.h:32
Base exception class for FMT holding the type, section and message of a given exception.
Definition: FMTException.h:140
Core::FMTsection getSection() const
Return the section in which the exception occurred.
FMTexc getType() const
Return the type of exception held by this FMTException.
const char * what() const noexcept override
Override the what function of the base exception class returning the message string.
Silent exception handler derived from FMTExceptionHandler that throws errors but logs nothing and rai...
Definition: FMTQuietExceptionHandler.h:22
FMTException raise(FMTexc lexception, std::string text, const std::string &method, const int &line, const std::string &file, Core::FMTsection lsection=Core::FMTsection::Empty, bool throwit=true) override
Override the base class raise function. See FMTExceptionHandler::raise.
Exception class derived from FMTException for warnings in FMT.
Definition: FMTWarning.h:31
FMTsection
Enumerator describing the sections of a Woodstock model.
Definition: FMTutility.h:32
FMTexc
Enumerator describing the exceptions thrown by FMT.
Definition: FMTException.h:45
FMTlev
Enumerator describing the kind of exception thrown by FMT.
Definition: FMTException.h:32
Definition: RexportCore.h:153
void exportException()
Definition: RexportExceptions.h:44