Awkward Array: include/awkward/util.h File Reference

Loading...
Searching...
No Matches
Namespaces | Typedefs | Enumerations | Functions
util.h File Reference
`#include <string>`
`#include <vector>`
`#include <map>`
`#include <memory>`
`#include "awkward/common.h"`
`#include "dlfcn.h"`

Go to the source code of this file.

## Namespaces
namespace | awkward
namespace | awkward::util

## Typedefs
using | RecordLookup = std::vector< std::string >
using | RecordLookupPtr = std::shared_ptr< RecordLookup >
using | Parameters = std::map< std::string, std::string >
using | TypeStrs = std::map< std::string, std::string >

## Enumerations
enum class | dtype { NOT_PRIMITIVE , boolean , int8 , int16 , int32 , int64 , uint8 , uint16 , uint32 , uint64 , float16 , float32 , float64 , float128 , complex64 , complex128 , complex256 , datetime64 , timedelta64 , size }
| NumPy dtypes that can be interpreted within Awkward C++ (only the primitive, fixed-width types). Non-native-endian types are considered NOT_PRIMITIVE. More...
enum class | ForthError { none , not_ready , is_done , user_halt , recursion_depth_exceeded , stack_underflow , stack_overflow , read_beyond , seek_beyond , skip_beyond , rewind_beyond , division_by_zero , varint_too_big , text_number_missing , quoted_string_missing , enumeration_missing , size }
| Exhaustive list of runtime errors possible in the ForthMachine. More...

## Functions
dtype | name_to_dtype (const std::string &name)
| Returns the name associated with a given dtype.
const std::string | dtype_to_name (dtype dt)
| Returns the name associated with a given dtype.
dtype | format_to_dtype (const std::string &format, int64_t itemsize)
| Convert a NumPy format string and itemsize into a dtype enum.
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.
bool | is_integer (dtype dt)
| True if the dtype is a non-boolean integer (signed or unsigned).
bool | is_signed (dtype dt)
| True if the dtype is a signed integer.
bool | is_unsigned (dtype dt)
| True if the dtype is an unsigned integer.
bool | is_real (dtype dt)
| True if the dtype is a non-complex floating point number.
bool | is_complex (dtype dt)
| True if the dtype is a complex number.
void | handle_error (const struct Error &err, const std::string &classname=std::string(""), const Identities *id=nullptr)
| If the Error struct contains an error message (from a cpu-kernel through the C interface), raise that error as a C++ exception.
std::string | quote (const std::string &x)
| Puts quotation marks around a string and escapes the appropriate characters.
template<typename T >
IndexOf< T > | make_starts (const IndexOf< T > &offsets)
| Converts an `offsets` index (from `ListOffsetArray`, for instance) into a `starts` index by viewing it with the last element dropped.
template<typename T >
IndexOf< T > | make_stops (const IndexOf< T > &offsets)
| Converts an `offsets` index (from `ListOffsetArray`, for instance) into a `stops` index by viewing it with the first element dropped.
RecordLookupPtr | init_recordlookup (int64_t numfields)
| Initializes a RecordLookup by assigning each element with a string representation of its field index position.
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.
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 | 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.
bool | json_equals (const std::string &myvalue, const std::string &value)
| Returns `true` if `myvalue` is equal to `value` when interpreted as JSON.
bool | parameter_equals (const Parameters &parameters, 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`.
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`.
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.
bool | parameter_isstring (const Parameters &parameters, const std::string &key)
| Returns `true` if the parameter associated with `key` is a string; `false` otherwise.
bool | parameter_isname (const Parameters &parameters, 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]*`; `false` otherwise.
const std::string | parameter_asstring (const Parameters &parameters, const std::string &key)
| Returns the parameter associated with `key` as a string if parameter_isstring; raises an error otherwise.
std::string | gettypestr (const Parameters &parameters, const TypeStrs &typestrs)
| Extracts a custom type string from `typestrs` if required by one of the `parameters` or an empty string if there is no match.