All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
util.h
Go to the documentation of this file.
1// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
2
3#ifndef AWKWARD_UTIL_H_
4#define AWKWARD_UTIL_H_
5
6#include <string>
7#include <vector>
8#include <map>
9#include <memory>
10
11#include "awkward/common.h"
12
13#ifndef _MSC_VER
14 #include "dlfcn.h"
15#endif
16
17namespace awkward {
18 namespace util {
22 enum class dtype {
24 boolean,
25 int8,
26 int16,
27 int32,
28 int64,
29 uint8,
30 uint16,
31 uint32,
32 uint64,
33 float16,
34 float32,
35 float64,
42 size
43 };
44
46 const std::string
48
50 const std::string
51 dtype_to_format(dtype dt, const std::string& format = "");
52
63 std::string
64 quote(const std::string& x);
65
67 enum class ForthError {
68 // execution can continue
69 none,
70
71 // execution cannot continue
73 is_done,
87
88 size
89 };
90
102 template <typename T>
104 public:
107 void
108 operator()(T const* ptr) {
109 uint8_t const* in = reinterpret_cast<uint8_t const*>(ptr);
110 delete [] in;
111 }
112 };
113
114 }
115}
116
117#endif // AWKWARD_UTIL_H_
Used as a std::shared_ptr deleter (second argument) to overload delete ptr with delete[] ptr.
Definition util.h:103
void operator()(T const *ptr)
Called by std::shared_ptr when its reference count reaches zero.
Definition util.h:108
#define LIBAWKWARD_EXPORT_SYMBOL
Definition common.h:44
std::string quote(const std::string &x)
Puts quotation marks around a string and escapes the appropriate characters.
ForthError
Exhaustive list of runtime errors possible in the ForthMachine.
Definition util.h:67
const std::string dtype_to_name(dtype dt)
Returns the name associated with a given dtype.
dtype
NumPy dtypes that can be interpreted within Awkward C++ (only the primitive, fixed-width types)....
Definition util.h:22
const std::string dtype_to_format(dtype dt, const std::string &format="")
Convert a dtype enum into a NumPy format string.
Definition ArrayBuilder.h:14