Loading...
Searching...
No Matches
common.h
Go to the documentation of this file.
1
// BSD 3-Clause License; see https://github.com/scikit-hep/awkward/blob/main/LICENSE
2
3
#ifndef AWKWARD_COMMON_H_
4
#define AWKWARD_COMMON_H_
5
6
#include <cstddef>
7
#include <cstdint>
8
9
#ifdef _MSC_VER
10
#define EXPORT_SYMBOL __declspec(dllexport)
11
#define ERROR Error
12
using
ssize_t = std::ptrdiff_t;
13
#else
14
#define EXPORT_SYMBOL __attribute__((visibility("default")))
15
#define ERROR struct Error
16
#endif
17
18
#define QUOTE(x) #x
19
20
#define FILENAME_FOR_EXCEPTIONS_C(filename, line) "\n\n(https://github.com/scikit-hep/awkward/blob/awkward-cpp-" VERSION_INFO "/awkward-cpp/" filename "#L" #line ")"
21
#define FILENAME_FOR_EXCEPTIONS(filename, line) std::string(FILENAME_FOR_EXCEPTIONS_C(filename, line))
22
23
#ifdef __GNUC__
24
// Silence a gcc warning: type attributes ignored after type is already defined
25
#define EXPORT_TEMPLATE_INST
26
#else
27
#define EXPORT_TEMPLATE_INST EXPORT_SYMBOL
28
#endif
29
30
#include <iostream>
31
#include <algorithm>
32
#include <map>
33
#include <vector>
34
#include <mutex>
35
#include <memory>
36
#include <cstring>
37
38
extern
"C"
{
39
struct
EXPORT_SYMBOL
Error
{
40
const
char
*
str
;
41
const
char
*
filename
;
42
int64_t
identity
;
43
int64_t
attempt
;
44
};
45
46
const
int8_t
kMaxInt8
= 127;
// 2**7 - 1
47
const
uint8_t
kMaxUInt8
= 255;
// 2**8 - 1
48
const
int32_t
kMaxInt32
= 2147483647;
// 2**31 - 1
49
const
uint32_t
kMaxUInt32
= 4294967295;
// 2**32 - 1
50
const
int64_t
kMaxInt64
= 9223372036854775806;
// 2**63 - 2: see below
51
const
int64_t
kSliceNone
=
kMaxInt64
+ 1;
// for Slice::none()
52
const
int64_t
kMaxLevels
= 48;
53
54
inline
struct
Error
55
success
() {
56
struct
Error
out;
57
out.
str
=
nullptr
;
58
out.
filename
=
nullptr
;
59
out.
identity
=
kSliceNone
;
60
out.
attempt
=
kSliceNone
;
61
return
out;
62
};
63
64
inline
struct
Error
65
failure
(
66
const char*
str
,
67
int64_t
identity
,
68
int64_t
attempt
,
69
const
char
*
filename
) {
70
struct
Error
out;
71
out.
str
=
str
;
72
out.
filename
=
filename
;
73
out.
identity
=
identity
;
74
out.
attempt
=
attempt
;
75
return
out;
76
};
77
}
78
79
#endif
// AWKWARD_COMMON_H_
kMaxUInt32
const uint32_t kMaxUInt32
Definition
common.h:49
kMaxLevels
const int64_t kMaxLevels
Definition
common.h:52
kSliceNone
const int64_t kSliceNone
Definition
common.h:51
kMaxInt64
const int64_t kMaxInt64
Definition
common.h:50
kMaxUInt8
const uint8_t kMaxUInt8
Definition
common.h:47
kMaxInt32
const int32_t kMaxInt32
Definition
common.h:48
success
struct Error success()
Definition
common.h:55
EXPORT_SYMBOL
#define EXPORT_SYMBOL
Definition
common.h:14
failure
struct Error failure(const char *str, int64_t identity, int64_t attempt, const char *filename)
Definition
common.h:65
kMaxInt8
const int8_t kMaxInt8
Definition
common.h:46
Error
Definition
common.h:39
Error::attempt
int64_t attempt
Definition
common.h:43
Error::identity
int64_t identity
Definition
common.h:42
Error::filename
const char * filename
Definition
common.h:41
Error::str
const char * str
Definition
common.h:40
include
awkward
common.h
Generated by
1.11.0