Arcane  v3.14.10.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
arcane/src/arcane/utils/Exception.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* Exception.h (C) 2000-2022 */
9/* */
10/* Déclarations et définitions liées aux exceptions. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_UTILS_EXCEPTION_H
13#define ARCANE_UTILS_EXCEPTION_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arccore/base/Exception.h"
18#include "arccore/base/TraceInfo.h"
20#include "arcane/utils/Atomic.h"
21
22#include <functional>
23
24/*---------------------------------------------------------------------------*/
25/*---------------------------------------------------------------------------*/
26
27namespace Arcane
28{
29
30/*---------------------------------------------------------------------------*/
31/*---------------------------------------------------------------------------*/
32
33extern "C++" ARCANE_UTILS_EXPORT Integer
34arcanePrintAnyException(ITraceMng* msg,bool is_no_continue = true);
35
36/*---------------------------------------------------------------------------*/
37/*---------------------------------------------------------------------------*/
38
39extern "C++" ARCANE_UTILS_EXPORT Integer
40arcanePrintStdException(const std::exception& ex,ITraceMng* msg,bool is_no_continue = true);
41
42/*---------------------------------------------------------------------------*/
43/*---------------------------------------------------------------------------*/
44
45extern "C++" ARCANE_UTILS_EXPORT Integer
46arcanePrintArcaneException(const Exception& ex,ITraceMng* msg,bool is_no_continue = true);
47
48/*---------------------------------------------------------------------------*/
49/*---------------------------------------------------------------------------*/
50/*!
51 * \ brief Appelle la fonction \a function en récupérant les éventuelles exceptions.
52 *
53 * Usage:
54 *
55 * \code
56 * arcaneCallAndCatchException([&]() { std::cout << "Hello\n"});
57 * \endcode
58 *
59 * \return 0 si aucune exception n'est récupérée et une valeur positive dans
60 * le cas contraire.
61 */
62extern "C++" ARCANE_UTILS_EXPORT Integer
63arcaneCallFunctionAndCatchException(std::function<void()> function);
64
65/*---------------------------------------------------------------------------*/
66/*---------------------------------------------------------------------------*/
67/*!
68 * \ brief Appelle la fonction \a function et en cas d'exception appelle std::terminate().
69 */
70extern "C++" ARCANE_UTILS_EXPORT void
71arcaneCallFunctionAndTerminateIfThrow(std::function<void()> function);
72
73/*---------------------------------------------------------------------------*/
74/*---------------------------------------------------------------------------*/
75
76} // End namespace Arcane
77
78/*---------------------------------------------------------------------------*/
79/*---------------------------------------------------------------------------*/
80
81#endif
Déclarations des types utilisés dans Arcane.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Integer arcaneCallFunctionAndCatchException(std::function< void()> function)
void arcaneCallFunctionAndTerminateIfThrow(std::function< void()> function)
Int32 Integer
Type représentant un entier.