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
#define __restrict__ __restrict
13
using
ssize_t = std::ptrdiff_t;
14
#else
15
#define EXPORT_SYMBOL __attribute__((visibility("default")))
16
#define ERROR struct Error
17
#endif
18
19
#define QUOTE(x) #x
20
21
#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 ")"
22
#define FILENAME_FOR_EXCEPTIONS(filename, line) std::string(FILENAME_FOR_EXCEPTIONS_C(filename, line))
23
24
#ifdef __GNUC__
25
// Silence a gcc warning: type attributes ignored after type is already defined
26
#define EXPORT_TEMPLATE_INST
27
#else
28
#define EXPORT_TEMPLATE_INST EXPORT_SYMBOL
29
#endif
30
31
#include <iostream>
32
#include <algorithm>
33
#include <map>
34
#include <vector>
35
#include <mutex>
36
#include <memory>
37
#include <cstring>
38
39
extern
"C"
{
40
struct
EXPORT_SYMBOL
Error
{
41
const
char
*
str
;
42
const
char
*
filename
;
43
int64_t
identity
;
44
int64_t
attempt
;
45
};
46
47
const
int8_t
kMaxInt8
= 127;
// 2**7 - 1
48
const
uint8_t
kMaxUInt8
= 255;
// 2**8 - 1
49
const
int32_t
kMaxInt32
= 2147483647;
// 2**31 - 1
50
const
uint32_t
kMaxUInt32
= 4294967295;
// 2**32 - 1
51
const
int64_t
kMaxInt64
= 9223372036854775806;
// 2**63 - 2: see below
52
const
int64_t
kSliceNone
=
kMaxInt64
+ 1;
// for Slice::none()
53
const
int64_t
kMaxLevels
= 48;
54
55
inline
struct
Error
56
success
() {
57
struct
Error
out;
58
out.
str
=
nullptr
;
59
out.
filename
=
nullptr
;
60
out.
identity
=
kSliceNone
;
61
out.
attempt
=
kSliceNone
;
62
return
out;
63
};
64
65
inline
struct
Error
66
failure
(
67
const char*
str
,
68
int64_t
identity
,
69
int64_t
attempt
,
70
const
char
*
filename
) {
71
struct
Error
out;
72
out.
str
=
str
;
73
out.
filename
=
filename
;
74
out.
identity
=
identity
;
75
out.
attempt
=
attempt
;
76
return
out;
77
};
78
}
79
80
#endif
// AWKWARD_COMMON_H_
kMaxUInt32
const uint32_t kMaxUInt32
Definition
common.h:50
kMaxLevels
const int64_t kMaxLevels
Definition
common.h:53
kSliceNone
const int64_t kSliceNone
Definition
common.h:52
kMaxInt64
const int64_t kMaxInt64
Definition
common.h:51
kMaxUInt8
const uint8_t kMaxUInt8
Definition
common.h:48
kMaxInt32
const int32_t kMaxInt32
Definition
common.h:49
success
struct Error success()
Definition
common.h:56
EXPORT_SYMBOL
#define EXPORT_SYMBOL
Definition
common.h:15
failure
struct Error failure(const char *str, int64_t identity, int64_t attempt, const char *filename)
Definition
common.h:66
kMaxInt8
const int8_t kMaxInt8
Definition
common.h:47
Error
Definition
common.h:40
Error::attempt
int64_t attempt
Definition
common.h:44
Error::identity
int64_t identity
Definition
common.h:43
Error::filename
const char * filename
Definition
common.h:42
Error::str
const char * str
Definition
common.h:41
include
awkward
common.h
Generated by
1.13.2