12#ifndef ARCCORE_BASE_ARCCOREGLOBAL_H
13#define ARCCORE_BASE_ARCCOREGLOBAL_H
19#include "arccore/arccore_config.h"
21#ifdef ARCCORE_VALID_TARGET
22# undef ARCCORE_VALID_TARGET
27# define ARCCORE_OS_LINUX
28#elif defined(__APPLE__) && defined(__MACH__)
29# define ARCCORE_OS_MACOS
31# define ARCCORE_OS_AIX
32#elif defined(__WIN32__) || defined(__NT__) || defined(WIN32) || defined(_WIN32) || defined(WIN32) || defined(_WINDOWS)
33# define ARCCORE_OS_WIN32
34#elif defined(__CYGWIN__)
35# define ARCCORE_OS_CYGWIN
38#ifdef ARCCORE_OS_WIN32
39# define ARCCORE_VALID_TARGET
40# define ARCCORE_EXPORT __declspec(dllexport)
41# define ARCCORE_IMPORT __declspec(dllimport)
45# pragma warning(disable: 4251)
46# pragma warning(disable: 4275)
47# pragma warning(disable: 4800)
48# pragma warning(disable: 4355)
59#ifndef ARCCORE_OS_WIN32
60# define ARCCORE_EXPORT __attribute__ ((visibility("default")))
61# define ARCCORE_IMPORT __attribute__ ((visibility("default")))
62# define ARCCORE_TEMPLATE_EXPORT ARCCORE_EXPORT
65#ifdef ARCCORE_OS_CYGWIN
66# define ARCCORE_VALID_TARGET
69#ifdef ARCCORE_OS_LINUX
70# define ARCCORE_VALID_TARGET
73#ifdef ARCCORE_OS_MACOS
74# define ARCCORE_VALID_TARGET
77#ifndef ARCCORE_VALID_TARGET
78#error "This target is not supported"
89#ifndef ARCCORE_TEMPLATE_EXPORT
90#define ARCCORE_TEMPLATE_EXPORT
93#ifndef ARCCORE_RESTRICT
94#define ARCCORE_RESTRICT
97#define ARCCORE_STD std
101#define ARCCORE_UNUSED(var) do { (void)(var) ; } while(false)
107typedef ARCCORE_TYPE_INT16
Int16;
108typedef ARCCORE_TYPE_INT32
Int32;
109typedef ARCCORE_TYPE_INT64
Int64;
123#if defined(__SYCL_DEVICE_ONLY__)
124# define ARCCORE_DEVICE_CODE
125# define ARCCORE_DEVICE_TARGET_SYCL
126#elif defined(__CUDA_ARCH__) || defined(__HIP_DEVICE_COMPILE__)
127# define ARCCORE_DEVICE_CODE
128# if defined(__HIP_DEVICE_COMPILE__)
129# define ARCCORE_DEVICE_TARGET_HIP
131# if defined(__CUDA_ARCH__)
132# define ARCCORE_DEVICE_TARGET_CUDA
139#if defined(__CUDACC__) || defined(__HIP__)
140#define ARCCORE_HOST_DEVICE __host__ __device__
141#define ARCCORE_DEVICE __device__
145#ifndef ARCCORE_HOST_DEVICE
146#define ARCCORE_HOST_DEVICE
149#ifndef ARCCORE_DEVICE
150#define ARCCORE_DEVICE
156#if defined(ARCCORE_COMPONENT_arccore_base)
157#define ARCCORE_BASE_EXPORT ARCCORE_EXPORT
158#define ARCCORE_BASE_EXTERN_TPL
160#define ARCCORE_BASE_EXPORT ARCCORE_IMPORT
161#define ARCCORE_BASE_EXTERN_TPL extern
164#ifdef ARCCORE_REAL_USE_APFLOAT
201#ifdef ARCCORE_REAL_USE_APFLOAT
202# define ARCCORE_REAL(val) (Real(#val,1000))
203# define ARCCORE_REAL_NOT_BUILTIN
207# ifdef ARCCORE_REAL_LONG
208# define ARCCORE_REAL(val) val##L
214using long
double Real;
216# define ARCCORE_REAL(val) val
217# define ARCCORE_REAL_IS_DOUBLE
234# define ARCCORE_INTEGER_MAX ARCCORE_INT64_MAX
238# define ARCCORE_INTEGER_MAX ARCCORE_INT32_MAX
305# define ARCCORE_DEPRECATED __attribute__ ((deprecated))
310# define ARCCORE_DEPRECATED __declspec(deprecated)
314#define ARCCORE_DEPRECATED_2017 ARCCORE_DEPRECATED
315#define ARCCORE_DEPRECATED_2018 ARCCORE_DEPRECATED
316#define ARCCORE_DEPRECATED_2019(reason) [[deprecated(reason)]]
317#define ARCCORE_DEPRECATED_2020(reason) [[deprecated(reason)]]
318#define ARCCORE_DEPRECATED_REASON(reason) [[deprecated(reason)]]
322#define ARCCORE_NO_DEPRECATED
324#ifndef ARCCORE_DEPRECATED
325# define ARCCORE_DEPRECATED
340#define ARCCORE_NORETURN [[noreturn]]
343#define ARCCORE_CONSTEXPR constexpr
346#define ARCCORE_NOEXCEPT noexcept
349#define ARCCORE_NOEXCEPT_FALSE noexcept(false)
352#ifdef __cpp_multidimensional_subscript
353#define ARCCORE_HAS_MULTI_SUBSCRIPT
369# define ARCCORE_ALIGNAS(value) __declspec(align(value))
371# define ARCCORE_ALIGNAS_PACKED(value) __declspec(align(value))
374# define ARCCORE_ALIGNAS_PACKED(value) __attribute__ ((aligned (value),packed))
376# define ARCCORE_ALIGNAS(value) __attribute__ ((aligned (value)))
382#if defined(ARCCORE_CHECK) || defined(ARCCORE_DEBUG)
383# ifndef ARCCORE_DEBUG_ASSERT
384# define ARCCORE_DEBUG_ASSERT
396extern "C++" ARCCORE_BASE_EXPORT
406extern "C++" ARCCORE_BASE_EXPORT
412extern "C++" ARCCORE_BASE_EXPORT
419extern "C++" ARCCORE_BASE_EXPORT
void
434extern "C++" ARCCORE_BASE_EXPORT
void
444extern "C++" ARCCORE_BASE_EXPORT
void
456#define ARCCORE_THROW(exception_class,...) \
457 throw exception_class (A_FUNCINFO,Arccore::String::format(__VA_ARGS__))
467#define ARCCORE_FATAL(...)\
468 throw Arccore::FatalErrorException(A_FUNCINFO,Arccore::String::format(__VA_ARGS__))
479extern "C++" ARCCORE_BASE_EXPORT
void
496extern "C++" ARCCORE_BASE_EXPORT
void
498 Int64 max_value_exclusive);
511extern "C++" ARCCORE_BASE_EXPORT
void
522inline ARCCORE_HOST_DEVICE
void
525 if (i>=min_value_inclusive && i<max_value_exclusive)
527#ifndef ARCCORE_DEVICE_CODE
528 arccoreRangeError(i,min_value_inclusive,max_value_exclusive);
529#elif defined(ARCCORE_DEVICE_TARGET_CUDA)
544inline ARCCORE_HOST_DEVICE
void
550#if defined(ARCCORE_CHECK) || defined(ARCCORE_DEBUG)
551#define ARCCORE_CHECK_AT(a,b) ::Arccore::arccoreCheckAt((a),(b))
552#define ARCCORE_CHECK_RANGE(a,b,c) ::Arccore::arccoreCheckRange((a),(b),(c))
554#define ARCCORE_CHECK_AT(a,b)
555#define ARCCORE_CHECK_RANGE(a,b,c)
558#define ARCCORE_CHECK_AT2(a0,a1,b0,b1) \
559 ARCCORE_CHECK_AT(a0,b0); ARCCORE_CHECK_AT(a1,b1)
560#define ARCCORE_CHECK_AT3(a0,a1,a2,b0,b1,b2) \
561 ARCCORE_CHECK_AT(a0,b0); ARCCORE_CHECK_AT(a1,b1); ARCCORE_CHECK_AT(a2,b2)
562#define ARCCORE_CHECK_AT4(a0,a1,a2,a3,b0,b1,b2,b3) \
563 ARCCORE_CHECK_AT(a0,b0); ARCCORE_CHECK_AT(a1,b1); ARCCORE_CHECK_AT(a2,b2); ARCCORE_CHECK_AT(a3,b3)
568#define ARCCORE_CAST_SMALL_SIZE(a) ((Integer)(a))
576#ifdef ARCCORE_DEBUG_ASSERT
577extern "C++" ARCCORE_BASE_EXPORT
void _doAssert(
const char*,
const char*,
const char*,
int);
578template<
typename T>
inline T*
579_checkPointer(T* t,
const char* file,
const char* func,
int line)
582 _doAssert(
"ARCCORE_ASSERT",file,func,line);
588# define ARCCORE_D_WHERE(a) Arccore::_doAssert(a,__FILE__,__PRETTY_FUNCTION__,__LINE__)
589# define ARCCORE_DCHECK_POINTER(a) Arccore::_checkPointer((a),__FILE__,__PRETTY_FUNCTION__,__LINE__);
591# define ARCCORE_D_WHERE(a) Arccore::_doAssert(a,__FILE__,"(NoInfo)",__LINE__)
592# define ARCCORE_DCHECK_POINTER(a) Arccore::_checkPointer((a),__FILE__,"(NoInfo"),__LINE__);
594# define ARCCORE_CHECK_PTR(a) \
595 {if (!(a)){Arccore::arccorePrintf("Null value");ARCCORE_D_WHERE("ARCCORE_ASSERT");}}
597# define ARCCORE_ASSERT(a,b) \
598 {if (!(a)){ Arccore::arccorePrintf("Assertion '%s' fails:",#a); Arccore::arccorePrintf b; ARCCORE_D_WHERE("ARCCORE_ASSERT");}}
599# define ARCCORE_WARNING(a) \
600 { Arccore::arccorePrintf a; ARCCORE_D_WHERE("ARCCORE_WARNING"); }
602# define ARCCORE_CHECK_PTR(a)
603# define ARCCORE_ASSERT(a,b)
604# define ARCCORE_WARNING(a)
605# define ARCCORE_DCHECK_POINTER(a) (a);
621extern "C++" ARCCORE_BASE_EXPORT
void
648#define ARCCORE_CHECK_POINTER(ptr) \
649 arccoreThrowIfNull(ptr,#ptr,nullptr)
657#define ARCCORE_CHECK_POINTER2(ptr,text)\
658 arccoreThrowIfNull(ptr,#ptr,text)
666class StringFormatterArg;
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Emulation de réel en précision arbitraire.
Type flottant sur 128 bits.
Type flottant demi-précision.
Type entier sur 128 bits.
Espace de nom de Arccore.
ARCCORE_BASE_EXPORT void arccoreThrowNullPointerError(const char *ptr_name, const char *text)
Signalee l'utilisation d'un pointeur nul en envoyant une exception.
double Real
Type représentant un réel.
Int32 Integer
Type représentant un entier.
ARCCORE_BASE_EXPORT void _doAssert(const char *text, const char *file, const char *func, int line)
std::uint32_t UInt32
Type entier non signé sur 32 bits.
ARCCORE_HOST_DEVICE void arccoreCheckRange(Int64 i, Int64 min_value_inclusive, Int64 max_value_exclusive)
Vérifie que min_value_inclusive <= i < max_value_exclusive.
ARCCORE_BASE_EXPORT void arccoreSetCheck(bool v)
Active ou désactive le mode vérification.
float Float32
Type flottant IEEE-753 simple précision.
void * Pointer
Type représentant un pointeur.
ARCCORE_HOST_DEVICE void arccoreCheckAt(Int64 i, Int64 max_size)
Vérifie un éventuel débordement de tableau.
ARCCORE_BASE_EXPORT void arccorePrintf(const char *format,...)
Encapsulation de la fonction C printf.
ARCCORE_BASE_EXPORT void arccoreDebugPause(const char *msg)
Passe en mode pause ou lance une erreur fatale.
std::int64_t Int64
Type entier signé sur 64 bits.
ARCCORE_BASE_EXPORT bool arccoreIsCheck()
Vrai si on est en mode vérification.
std::uint64_t UInt64
Type entier non signé sur 64 bits.
ARCCORE_BASE_EXPORT void arccoreNullPointerError ARCCORE_NORETURN()
Signalue l'utilisation d'un pointeur nul.
ARCCORE_BASE_EXPORT void arccoreSetPauseOnError(bool v)
Indique si on l'appel à arccoreDebugPause() effectue une pause.
std::int32_t Int32
Type entier signé sur 32 bits.
std::int8_t Int8
Type entier signé sur 8 bits.
void * arccoreThrowIfNull(void *ptr, const char *ptr_name, const char *text)
Vérifie qu'un pointeur n'est pas nul.
std::int16_t Int16
Type entier signé sur 16 bits.
ARCCORE_BASE_EXPORT bool arccoreIsDebug()
Vrai si la macro ARCCORE_DEBUG est définie.
Structure équivalente à la valeur booléenne vrai.
Structure équivalente à la valeur booléenne vrai.