14#include "arccore/base/ArccoreGlobal.h"
15#include "arccore/base/TraceInfo.h"
16#include "arccore/base/PlatformUtils.h"
17#include "arccore/base/String.h"
18#include "arccore/base/IndexOutOfRangeException.h"
19#include "arccore/base/FatalErrorException.h"
24#include "arccore/base/Float16.h"
25#include "arccore/base/BFloat16.h"
26#include "arccore/base/Float128.h"
27#include "arccore/base/Int128.h"
28#include "arccore/base/IRangeFunctor.h"
29#include "arccore/base/CheckedConvert.h"
30#include "arccore/base/ForLoopRunInfo.h"
31#include "arccore/base/ParallelLoopOptions.h"
38#ifndef ARCCORE_OS_WIN32
63static bool global_arccore_is_check =
true;
65static bool global_arccore_is_check =
false;
69extern "C++" ARCCORE_BASE_EXPORT
72 return global_arccore_is_check;
75extern "C++" ARCCORE_BASE_EXPORT
78 global_arccore_is_check = v;
86bool global_pause_on_error =
false;
89extern "C++" ARCCORE_BASE_EXPORT
void
92 global_pause_on_error = v;
95extern "C++" ARCCORE_BASE_EXPORT
void
98 if (global_pause_on_error){
99 std::ostringstream ostr;
101 ostr <<
"** FATAL: Debug mode activated. Execution paused\n"
102 <<
"** FATAL: message:" << msg <<
"\n"
103 <<
"** FATAL: To find the location of the error, start\n"
104 <<
"** FATAL: start the debugger using the process number\n"
106 std::cerr << ostr.str();
107#ifndef ARCCORE_OS_WIN32
116extern "C++" ARCCORE_BASE_EXPORT
void
126extern "C++" ARCCORE_BASE_EXPORT
void
130 throw IndexOutOfRangeException(A_FUNCINFO,String(),i,0,max_size);
136extern "C++" ARCCORE_BASE_EXPORT
void
146extern "C++" ARCCORE_BASE_EXPORT
void
149 std::cerr <<
"** FATAL: null pointer.\n";
150 std::cerr <<
"** FATAL: Trying to dereference a null pointer.\n";
158extern "C++" ARCCORE_BASE_EXPORT
void
172void _printFuncName(std::ostream& o,
const char* name)
174 const char* par_pos = std::strchr(name,
'(');
182 ptrdiff_t
len = par_pos - name;
183 ptrdiff_t last_scope = 0;
184 ptrdiff_t last_scope2 = 0;
185 for( ptrdiff_t i=0; i<
len; ++i ){
186 if (name[i]==
':' && name[i+1]==
':'){
187 last_scope2 = last_scope;
193 ptrdiff_t true_pos = last_scope2;
194 ptrdiff_t true_len =
len - true_pos;
195 o.write(&name[true_pos],true_len);
203extern "C++" ARCCORE_BASE_EXPORT std::ostream&
206 if (t.printSignature())
207 o << t.name() <<
":" << t.line();
209 _printFuncName(o,t.name());
223typedef void (*
fDoAssert)(
const char*,
const char*,
const char*,size_t);
235extern "C++" ARCCORE_BASE_EXPORT
void
236_doAssert(
const char* text,
const char* file,
const char* func,
int line)
238 if (g_do_assert_func)
239 (*g_do_assert_func)(text,file,func,line);
241 std::ostringstream ostr;
242 ostr << text <<
':' << file <<
':' << func <<
':' << line <<
": ";
250extern "C++" ARCCORE_BASE_EXPORT
void
257 vsnprintf(buffer,4095,format,ap);
259 std::cerr << buffer <<
"\n";
260 std::cout <<
"*E* " << buffer <<
"\n";
Gestion des références à une classe C++.
Exception lorsqu'une erreur fatale est survenue.
Exception lorsqu'une valeur n'est pas dans un intervalle donné.
Chaîne de caractères unicode.
Integer len(const char *s)
Retourne la longueur de la chaîne s.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
ARCCORE_BASE_EXPORT void arccoreNullPointerError()
Signalue l'utilisation d'un pointeur nul.
std::int64_t Int64
Type entier signé sur 64 bits.
ARCCORE_BASE_EXPORT void arccorePrintf(const char *format,...)
Encapsulation de la fonction C printf.
void(* fDoAssert)(const char *, const char *, const char *, size_t)
Fonction appelée lorsqu'une assertion échoue.
ARCCORE_BASE_EXPORT void arccoreDebugPause(const char *msg)
Passe en mode pause ou lance une erreur fatale.
bool(* fCheckDebug)(unsigned int)
Fonction appelée pour indiquer s'il faut afficher l'information de débug.
ARCCORE_BASE_EXPORT void arccoreRangeError(Int64 i, Int64 min_value_inclusive, Int64 max_value_exclusive)
Signale qu'une valeur n'est pas dans l'intervalle souhaité.
ARCCORE_BASE_EXPORT void arccoreThrowNullPointerError(const char *ptr_name, const char *text)
Signalee l'utilisation d'un pointeur nul en envoyant une exception.
ARCCORE_BASE_EXPORT bool arccoreIsCheck()
Vrai si on est en mode vérification.
void _doAssert(const char *text, const char *file, const char *func, size_t line)
ARCCORE_BASE_EXPORT void arccoreSetPauseOnError(bool v)
Indique si on l'appel à arccoreDebugPause() effectue une pause.
ARCCORE_BASE_EXPORT void arccoreSetCheck(bool v)
Active ou désactive le mode vérification.
std::ostream & operator<<(std::ostream &ostr, eItemKind item_kind)
Opérateur de sortie sur un flot.