94 const std::string &classname = std::string(
""));
123 const std::string&
key,
137 const std::string&
key,
142 const std::vector<std::string>
160 const std::string&
key,
161 const std::string&
value);
195 using TypeStrs = std::map<std::string, std::string>;
239 template <
typename T>
246 uint8_t
const* in =
reinterpret_cast<uint8_t const*
>(ptr);
Used as a std::shared_ptr deleter (second argument) to overload delete ptr with delete[] ptr.
Definition: util.h:240
void operator()(T const *ptr)
Called by std::shared_ptr when its reference count reaches zero.
Definition: util.h:245
#define LIBAWKWARD_EXPORT_SYMBOL
Definition: common.h:45
const std::string parameter_asstring(const Parameters ¶meters, const std::string &key)
Returns the parameter associated with key as a string if parameter_isstring; raises an error otherwis...
bool is_signed(dtype dt)
True if the dtype is a signed integer.
dtype format_to_dtype(const std::string &format, int64_t itemsize)
Convert a NumPy format string and itemsize into a dtype enum.
bool parameters_equal(const Parameters &self, const Parameters &other, bool check_all)
Returns true if all key-value pairs in self is equal to all key-value pairs in other.
std::map< std::string, std::string > Parameters
Definition: util.h:145
bool parameter_equals(const Parameters ¶meters, const std::string &key, const std::string &value)
Returns true if the value associated with a key in parameters is equal to the specified value.
const std::string key(const RecordLookupPtr &recordlookup, int64_t fieldindex, int64_t numfields)
Returns the key associated with a field index, given a RecordLookup and a number of fields.
bool parameter_isname(const Parameters ¶meters, const std::string &key)
Returns true if the parameter associated with key is a string that matches [A-Za-z_][A-Za-z_0-9]*; fa...
bool parameter_isstring(const Parameters ¶meters, const std::string &key)
Returns true if the parameter associated with key is a string; false otherwise.
bool json_equals(const std::string &myvalue, const std::string &value)
Returns true if myvalue is equal to value when interpreted as JSON.
bool is_complex(dtype dt)
True if the dtype is a complex number.
bool is_unsigned(dtype dt)
True if the dtype is an unsigned integer.
std::string quote(const std::string &x)
Puts quotation marks around a string and escapes the appropriate characters.
int64_t fieldindex(const RecordLookupPtr &recordlookup, const std::string &key, int64_t numfields)
Returns the field index associated with a key, given a RecordLookup and a number of fields.
dtype name_to_dtype(const std::string &name)
Returns the name associated with a given dtype.
std::shared_ptr< RecordLookup > RecordLookupPtr
Definition: util.h:110
Mapping::value_type::value_type value(Mapping a, const std::string &name)
Definition: datetime_util.h:49
std::vector< std::string > RecordLookup
Definition: util.h:109
void merge_parameters(Parameters &output, const Parameters &input)
Merges a set of input parameters with output, keeping only those that are common to all sets.
ForthError
Exhaustive list of runtime errors possible in the ForthMachine.
Definition: util.h:204
@ recursion_depth_exceeded
bool is_integer(dtype dt)
True if the dtype is a non-boolean integer (signed or unsigned).
std::map< std::string, std::string > TypeStrs
Definition: util.h:195
const std::string dtype_to_name(dtype dt)
Returns the name associated with a given dtype.
std::string gettypestr(const Parameters ¶meters, const TypeStrs &typestrs)
Extracts a custom type string from typestrs if required by one of the parameters or an empty string i...
RecordLookupPtr init_recordlookup(int64_t numfields)
Initializes a RecordLookup by assigning each element with a string representation of its field index ...
void handle_error(const struct Error &err, const std::string &classname=std::string(""))
If the Error struct contains an error message (from a cpu-kernel through the C interface),...
dtype
NumPy dtypes that can be interpreted within Awkward C++ (only the primitive, fixed-width types)....
Definition: util.h:22
bool haskey(const RecordLookupPtr &recordlookup, const std::string &key, int64_t numfields)
Returns true if a RecordLookup has a given key; false otherwise.
const std::vector< std::string > keys(const RecordLookupPtr &recordlookup, int64_t numfields)
Returns a given RecordLookup as keys or generate anonymous ones form a number of fields.
const std::string dtype_to_format(dtype dt, const std::string &format="")
Convert a dtype enum into a NumPy format string.
int64_t dtype_to_itemsize(dtype dt)
Convert a dtype enum into an itemsize.
std::string name(Mapping a, V value)
Definition: datetime_util.h:39
bool is_real(dtype dt)
True if the dtype is a non-complex floating point number.
Definition: ArrayBuilder.h:14