1#ifndef HALIDE_RUNTIME_STRING_TABLE_H
2#define HALIDE_RUNTIME_STRING_TABLE_H
4#include "../HalideRuntime.h"
26 void resize(
void *user_context,
size_t capacity);
27 void destroy(
void *user_context);
28 void clear(
void *user_context);
31 void fill(
void *user_context,
const char **array,
size_t count);
34 void assign(
void *user_context,
size_t index,
const char *str,
size_t length = 0);
37 void append(
void *user_context,
const char *str,
size_t length = 0);
40 void prepend(
void *user_context,
const char *str,
size_t length = 0);
43 size_t parse(
void *user_context,
const char *str,
const char *
delim);
49 const char **
data()
const;
52 bool contains(
const char *str)
const;
55 return contents.
size();
72 : contents(user_context, capacity,
sma),
73 pointers(user_context, capacity,
sma) {
75 resize(user_context, capacity);
80 : contents(user_context, count,
sma),
81 pointers(user_context, count,
sma) {
82 fill(user_context, array, count);
90 pointers.
resize(user_context, capacity);
91 contents.
resize(user_context, capacity);
92 for (
size_t n = 0;
n < contents.
size(); ++
n) {
99 for (
size_t n = 0;
n < contents.
size(); ++
n) {
102 contents.
assign(user_context,
n,
nullptr);
104 contents.
clear(user_context);
105 pointers.
clear(user_context);
109 for (
size_t n = 0;
n < contents.
size(); ++
n) {
112 contents.
assign(user_context,
n,
nullptr);
114 contents.
destroy(user_context);
115 pointers.
destroy(user_context);
119 if (index < pointers.
size()) {
120 return static_cast<const char *
>(pointers[index]);
126 resize(user_context, count);
127 for (
size_t n = 0;
n < count &&
n < contents.
size(); ++
n) {
138 if (index < contents.
size()) {
167 if (entry_count < 1) {
171 resize(user_context, entry_count);
175 const char *ptr = str;
195 for (
size_t n = 0;
n < contents.
size(); ++
n) {
206 return reinterpret_cast<const char **
>(pointers.
data());
const SystemMemoryAllocatorFns & current_allocator() const
void clear(void *user_context)
void prepend(void *user_context, const void *entry_ptr)
void destroy(void *user_context)
void resize(void *user_context, size_t entry_count, bool realloc=true)
void append(void *user_context, const void *entry_ptr)
void assign(void *user_context, size_t index, const void *entry_ptr)
static const SystemMemoryAllocatorFns & default_allocator()
static StringStorage * create(void *user_context, const SystemMemoryAllocatorFns &ma)
static void destroy(void *user_context, StringStorage *string_storage)
void append(void *user_context, const char *str, size_t length=0)
StringTable(const StringTable &)=delete
const char ** data() const
size_t parse(void *user_context, const char *str, const char *delim)
void assign(void *user_context, size_t index, const char *str, size_t length=0)
void destroy(void *user_context)
const char * operator[](size_t index) const
void resize(void *user_context, size_t capacity)
void clear(void *user_context)
StringTable & operator=(const StringTable &)=delete
void prepend(void *user_context, const char *str, size_t length=0)
void fill(void *user_context, const char **array, size_t count)
bool contains(const char *str) const
size_t strlen(const char *string)
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
@ Internal
Not visible externally, similar to 'static' linkage in C.
Internal::ConstantInterval cast(Type t, const Internal::ConstantInterval &a)
Cast operators for ConstantIntervals.
const char * strstr(const char *, const char *)
bool contains(int32_t x) const
Test if the interval contains a particular value.
static size_t count_tokens(const char *str, const char *delim)
static bool is_empty(const char *str)