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
299# define ARCCORE_DEPRECATED __attribute__ ((deprecated))
304# define ARCCORE_DEPRECATED __declspec(deprecated)
308#define ARCCORE_DEPRECATED_2017 ARCCORE_DEPRECATED
309#define ARCCORE_DEPRECATED_2018 ARCCORE_DEPRECATED
310#define ARCCORE_DEPRECATED_2019(reason) [[deprecated(reason)]]
311#define ARCCORE_DEPRECATED_2020(reason) [[deprecated(reason)]]
312#define ARCCORE_DEPRECATED_REASON(reason) [[deprecated(reason)]]
316#define ARCCORE_NO_DEPRECATED
318#ifndef ARCCORE_DEPRECATED
319# define ARCCORE_DEPRECATED
334#define ARCCORE_NORETURN [[noreturn]]
337#define ARCCORE_CONSTEXPR constexpr
340#define ARCCORE_NOEXCEPT noexcept
343#define ARCCORE_NOEXCEPT_FALSE noexcept(false)
346#ifdef __cpp_multidimensional_subscript
347#define ARCCORE_HAS_MULTI_SUBSCRIPT
363# define ARCCORE_ALIGNAS(value) __declspec(align(value))
365# define ARCCORE_ALIGNAS_PACKED(value) __declspec(align(value))
368# define ARCCORE_ALIGNAS_PACKED(value) __attribute__ ((aligned (value),packed))
370# define ARCCORE_ALIGNAS(value) __attribute__ ((aligned (value)))
376#if defined(ARCCORE_CHECK) || defined(ARCCORE_DEBUG)
377# ifndef ARCCORE_DEBUG_ASSERT
378# define ARCCORE_DEBUG_ASSERT
390extern "C++" ARCCORE_BASE_EXPORT
400extern "C++" ARCCORE_BASE_EXPORT
406extern "C++" ARCCORE_BASE_EXPORT
413extern "C++" ARCCORE_BASE_EXPORT
void
428extern "C++" ARCCORE_BASE_EXPORT
void
438extern "C++" ARCCORE_BASE_EXPORT
void
450#define ARCCORE_THROW(exception_class,...) \
451 throw exception_class (A_FUNCINFO,Arccore::String::format(__VA_ARGS__))
461#define ARCCORE_FATAL(...)\
462 throw Arccore::FatalErrorException(A_FUNCINFO,Arccore::String::format(__VA_ARGS__))
473extern "C++" ARCCORE_BASE_EXPORT
void
490extern "C++" ARCCORE_BASE_EXPORT
void
492 Int64 max_value_exclusive);
505extern "C++" ARCCORE_BASE_EXPORT
void
516inline ARCCORE_HOST_DEVICE
void
519 if (i>=min_value_inclusive && i<max_value_exclusive)
521#ifndef ARCCORE_DEVICE_CODE
522 arccoreRangeError(i,min_value_inclusive,max_value_exclusive);
523#elif defined(ARCCORE_DEVICE_TARGET_CUDA)
538inline ARCCORE_HOST_DEVICE
void
544#if defined(ARCCORE_CHECK) || defined(ARCCORE_DEBUG)
545#define ARCCORE_CHECK_AT(a,b) ::Arccore::arccoreCheckAt((a),(b))
546#define ARCCORE_CHECK_RANGE(a,b,c) ::Arccore::arccoreCheckRange((a),(b),(c))
548#define ARCCORE_CHECK_AT(a,b)
549#define ARCCORE_CHECK_RANGE(a,b,c)
552#define ARCCORE_CHECK_AT2(a0,a1,b0,b1) \
553 ARCCORE_CHECK_AT(a0,b0); ARCCORE_CHECK_AT(a1,b1)
554#define ARCCORE_CHECK_AT3(a0,a1,a2,b0,b1,b2) \
555 ARCCORE_CHECK_AT(a0,b0); ARCCORE_CHECK_AT(a1,b1); ARCCORE_CHECK_AT(a2,b2)
556#define ARCCORE_CHECK_AT4(a0,a1,a2,a3,b0,b1,b2,b3) \
557 ARCCORE_CHECK_AT(a0,b0); ARCCORE_CHECK_AT(a1,b1); ARCCORE_CHECK_AT(a2,b2); ARCCORE_CHECK_AT(a3,b3)
562#define ARCCORE_CAST_SMALL_SIZE(a) ((Integer)(a))
570#ifdef ARCCORE_DEBUG_ASSERT
571extern "C++" ARCCORE_BASE_EXPORT
void _doAssert(
const char*,
const char*,
const char*,
int);
572template<
typename T>
inline T*
573_checkPointer(T* t,
const char* file,
const char* func,
int line)
576 _doAssert(
"ARCCORE_ASSERT",file,func,line);
582# define ARCCORE_D_WHERE(a) Arccore::_doAssert(a,__FILE__,__PRETTY_FUNCTION__,__LINE__)
583# define ARCCORE_DCHECK_POINTER(a) Arccore::_checkPointer((a),__FILE__,__PRETTY_FUNCTION__,__LINE__);
585# define ARCCORE_D_WHERE(a) Arccore::_doAssert(a,__FILE__,"(NoInfo)",__LINE__)
586# define ARCCORE_DCHECK_POINTER(a) Arccore::_checkPointer((a),__FILE__,"(NoInfo"),__LINE__);
588# define ARCCORE_CHECK_PTR(a) \
589 {if (!(a)){Arccore::arccorePrintf("Null value");ARCCORE_D_WHERE("ARCCORE_ASSERT");}}
591# define ARCCORE_ASSERT(a,b) \
592 {if (!(a)){ Arccore::arccorePrintf("Assertion '%s' fails:",#a); Arccore::arccorePrintf b; ARCCORE_D_WHERE("ARCCORE_ASSERT");}}
593# define ARCCORE_WARNING(a) \
594 { Arccore::arccorePrintf a; ARCCORE_D_WHERE("ARCCORE_WARNING"); }
596# define ARCCORE_CHECK_PTR(a)
597# define ARCCORE_ASSERT(a,b)
598# define ARCCORE_WARNING(a)
599# define ARCCORE_DCHECK_POINTER(a) (a);
615extern "C++" ARCCORE_BASE_EXPORT
void
642#define ARCCORE_CHECK_POINTER(ptr) \
643 arccoreThrowIfNull(ptr,#ptr,nullptr)
651#define ARCCORE_CHECK_POINTER2(ptr,text)\
652 arccoreThrowIfNull(ptr,#ptr,text)
660class StringFormatterArg;
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Emulation de réel en précision arbitraire.
Type flottant demi-précision.
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.