Teuchos - Trilinos Tools Package
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
core
src
Teuchos_CWrapperSupport_Cpp.hpp
1
// @HEADER
2
// *****************************************************************************
3
// Teuchos: Common Tools Package
4
//
5
// Copyright 2004 NTESS and the Teuchos contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
10
#ifndef TEUCHOS_C_WRAPPER_SUPPORT_CPP_HPP
11
#define TEUCHOS_C_WRAPPER_SUPPORT_CPP_HPP
12
13
14
#include "Teuchos_StandardCatchMacros.hpp"
15
#include "Teuchos_FancyOStream.hpp"
16
17
19
20
21
namespace
Teuchos
{
22
23
27
class
TEUCHOSCORE_LIB_DLL_EXPORT
CWrapperErrorHandling
{
28
public
:
29
34
static
void
setPrintErrorOStream
(
const
RCP<FancyOStream>
&errorOStream);
35
40
static
RCP<FancyOStream>
getPrintErrorOStream
();
41
47
static
void
setShowStackTraceOnException
(
const
bool
showStrackTraceOnException);
48
51
static
bool
getShowStackTraceOnException
();
52
53
54
};
// class CWrapperErrorHandling
55
56
57
}
// Teuchos
58
59
60
65
#define TEUCHOS_CWRAPPER_TRY(IERR) \
66
TEUCHOS_TEST_FOR_EXCEPT((IERR) == 0); \
67
(*(IERR)) = 0; \
68
bool cwrapper_try_success = true; \
69
try
70
// Above: We must set *ierr = 0 in case a return statement will return the
71
// value.
72
73
78
#define TEUCHOS_CWRAPPER_CATCH_ERROR_CODE(IERR) \
79
TEUCHOS_STANDARD_CATCH_STATEMENTS_IMPL( \
80
true, *Teuchos::CWrapperErrorHandling::getPrintErrorOStream(), \
81
Teuchos::CWrapperErrorHandling::getShowStackTraceOnException(), \
82
cwrapper_try_success ); \
83
if (!cwrapper_try_success) { (*(IERR)) = -1; }
84
// Above: We make sure and set the error code in case there is a failure.
85
86
87
95
#define TEUCHOS_CWRAPPER_SET_ERROR_CODE(IERR, IERR_VALUE) \
96
if ((IERR)) { \
97
(*(IERR)) = (IERR_VALUE); \
98
}
99
100
101
#endif
// TEUCHOS_C_WRAPPER_SUPPORT_CPP_HPP
Teuchos::CWrapperErrorHandling
Static C Wrapper Error Handling Policy Class.
Definition
Teuchos_CWrapperSupport_Cpp.hpp:27
Teuchos::CWrapperErrorHandling::setShowStackTraceOnException
static void setShowStackTraceOnException(const bool showStrackTraceOnException)
Set if the stacktrace should be shown on every caught exception.
Definition
Teuchos_CWrapperSupport.cpp:59
Teuchos::CWrapperErrorHandling::getShowStackTraceOnException
static bool getShowStackTraceOnException()
Get if the stacktrace should be shown on every caught exception.
Definition
Teuchos_CWrapperSupport.cpp:66
Teuchos::RCP
Smart reference counting pointer class for automatic garbage collection.
Definition
Teuchos_RCPDecl.hpp:397
Teuchos::CWrapperErrorHandling::getPrintErrorOStream
static RCP< FancyOStream > getPrintErrorOStream()
Get the ostream that will be printed when errors occur.
Definition
Teuchos_CWrapperSupport.cpp:53
Teuchos::CWrapperErrorHandling::setPrintErrorOStream
static void setPrintErrorOStream(const RCP< FancyOStream > &errorOStream)
Set the ostream that will be printed to when errors occur.
Definition
Teuchos_CWrapperSupport.cpp:45
Teuchos
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
Generated by
1.17.0