Halide 22.0.0 Halide compiler and libraries

Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Halide::Runtime::Internal::BlockStorage Class Reference

`#include <block_storage.h>`

## Classes
struct | Config

## Public Member Functions
| BlockStorage (void *user_context, const Config &cfg, const SystemMemoryAllocatorFns &sma=default_allocator())
| BlockStorage (const BlockStorage &other)
| ~BlockStorage ()
void | initialize (void *user_context, const Config &cfg, const SystemMemoryAllocatorFns &sma=default_allocator())
BlockStorage & | operator= (const BlockStorage &other)
bool | operator== (const BlockStorage &other) const
bool | operator!= (const BlockStorage &other) const
void | reserve (void *user_context, size_t capacity, bool free_existing=false)
void | resize (void *user_context, size_t entry_count, bool realloc=true)
void | assign (void *user_context, size_t index, const void *entry_ptr)
void | insert (void *user_context, size_t index, const void *entry_ptr)
void | prepend (void *user_context, const void *entry_ptr)
void | append (void *user_context, const void *entry_ptr)
void | remove (void *user_context, size_t index)
void | fill (void *user_context, const void *array, size_t array_size)
void | insert (void *user_context, size_t index, const void *array, size_t array_size)
void | replace (void *user_context, size_t index, const void *array, size_t array_size)
void | prepend (void *user_context, const void *array, size_t array_size)
void | append (void *user_context, const void *array, size_t array_size)
void | remove (void *user_context, size_t index, size_t entry_count)
void | pop_front (void *user_context)
void | pop_back (void *user_context)
void | shrink_to_fit (void *user_context)
void | clear (void *user_context)
void | destroy (void *user_context)
bool | empty () const
bool | full () const
bool | is_valid (size_t index) const
size_t | stride () const
size_t | size () const
void * | operator[] (size_t index)
| logical entry index (returns ptr = data() + (index * stride()) More...
const void * | operator[] (size_t index) const
void * | data ()
void * | front ()
void * | back ()
const void * | data () const
const void * | front () const
const void * | back () const
const Config & | current_config () const
const SystemMemoryAllocatorFns & | current_allocator () const

## Static Public Member Functions
static const Config & | default_config ()
static const SystemMemoryAllocatorFns & | default_allocator ()

## Static Public Attributes
static constexpr size_t | default_capacity = 32

## Detailed Description

Definition at line 18 of file block_storage.h.

## Constructor & Destructor Documentation

## ◆ BlockStorage() [1/2]

Halide::Runtime::Internal::BlockStorage::BlockStorage | ( | void * | user_context,
|  | const Config & | cfg,
|  | const SystemMemoryAllocatorFns & | sma = `default_allocator()`
| ) |  |

Definition at line 94 of file block_storage.h.

References Halide::Runtime::Internal::SystemMemoryAllocatorFns::allocate, Halide::Runtime::Internal::SystemMemoryAllocatorFns::deallocate, Halide::Runtime::Internal::BlockStorage::Config::entry_size, halide_abort_if_false, Halide::Runtime::Internal::BlockStorage::Config::minimum_capacity, reserve(), and user_context.

## ◆ BlockStorage() [2/2]

Halide::Runtime::Internal::BlockStorage::BlockStorage | ( | const BlockStorage & | other | ) |

Definition at line 104 of file block_storage.h.

References Halide::Runtime::Internal::BlockStorage::Config::entry_size, memcpy(), and resize().

## ◆ ~BlockStorage()

Halide::Runtime::Internal::BlockStorage::~BlockStorage | ( |  | ) |

Definition at line 112 of file block_storage.h.

References destroy().

## Member Function Documentation

## ◆ initialize()

void Halide::Runtime::Internal::BlockStorage::initialize | ( | void * | user_context,
|  | const Config & | cfg,
|  | const SystemMemoryAllocatorFns & | sma = `default_allocator()`
| ) |  |

Definition at line 125 of file block_storage.h.

References Halide::Runtime::Internal::BlockStorage::Config::minimum_capacity, reserve(), and user_context.

Referenced by Halide::Runtime::Internal::MemoryArena::initialize(), and Halide::Runtime::Internal::StringStorage::initialize().

## ◆ operator=()

BlockStorage & Halide::Runtime::Internal::BlockStorage::operator= | ( | const BlockStorage & | other | ) |

Definition at line 135 of file block_storage.h.

References Halide::Runtime::Internal::BlockStorage::Config::entry_size, memcpy(), and resize().

## ◆ operator==()

bool Halide::Runtime::Internal::BlockStorage::operator== | ( | const BlockStorage & | other | ) | const

Definition at line 146 of file block_storage.h.

References Halide::Runtime::Internal::BlockStorage::Config::entry_size, and memcmp().

## ◆ operator!=()

bool Halide::Runtime::Internal::BlockStorage::operator!= | ( | const BlockStorage & | other | ) | const

Definition at line 156 of file block_storage.h.

## ◆ reserve()

void Halide::Runtime::Internal::BlockStorage::reserve | ( | void * | user_context,
|  | size_t | capacity,
|  | bool | free_existing = `false`
| ) |  |

Definition at line 194 of file block_storage.h.

References Halide::max(), and user_context.

Referenced by BlockStorage(), initialize(), and Halide::Runtime::Internal::StringStorage::reserve().

## ◆ resize()

void Halide::Runtime::Internal::BlockStorage::resize | ( | void * | user_context,
|  | size_t | entry_count,
|  | bool | realloc = `true`
| ) |  |

Definition at line 204 of file block_storage.h.

References debug, Halide::Runtime::Internal::BlockStorage::Config::entry_size, Halide::max(), Halide::Runtime::Internal::BlockStorage::Config::minimum_capacity, and user_context.

Referenced by BlockStorage(), clear(), fill(), insert(), operator=(), pop_back(), remove(), and Halide::Runtime::Internal::StringStorage::reserve().

## ◆ assign()

void Halide::Runtime::Internal::BlockStorage::assign | ( | void * | user_context,
|  | size_t | index,
|  | const void * | entry_ptr
| ) |  |

Definition at line 168 of file block_storage.h.

References replace(), and user_context.

## ◆ insert() [1/2]

void Halide::Runtime::Internal::BlockStorage::insert | ( | void * | user_context,
|  | size_t | index,
|  | const void * | entry_ptr
| ) |  |

Definition at line 245 of file block_storage.h.

References insert(), and user_context.

Referenced by Halide::Runtime::Internal::StringStorage::append(), append(), insert(), Halide::Runtime::Internal::StringStorage::prepend(), and prepend().

## ◆ prepend() [1/2]

void Halide::Runtime::Internal::BlockStorage::prepend | ( | void * | user_context,
|  | const void * | entry_ptr
| ) |  |

Definition at line 172 of file block_storage.h.

References insert(), and user_context.

Referenced by Halide::Runtime::Internal::StringStorage::prepend().

## ◆ append() [1/2]

void Halide::Runtime::Internal::BlockStorage::append | ( | void * | user_context,
|  | const void * | entry_ptr
| ) |  |

Definition at line 176 of file block_storage.h.

References append(), and user_context.

Referenced by append().

## ◆ remove() [1/2]

void Halide::Runtime::Internal::BlockStorage::remove | ( | void * | user_context,
|  | size_t | index
| ) |  |

Definition at line 249 of file block_storage.h.

References remove(), and user_context.

Referenced by Halide::Runtime::Internal::MemoryArena::collect(), pop_front(), and remove().

## ◆ fill()

void Halide::Runtime::Internal::BlockStorage::fill | ( | void * | user_context,
|  | const void * | array,
|  | size_t | array_size
| ) |  |

Definition at line 160 of file block_storage.h.

References Halide::Runtime::Internal::BlockStorage::Config::entry_size, memcpy(), resize(), and user_context.

## ◆ insert() [2/2]

void Halide::Runtime::Internal::BlockStorage::insert | ( | void * | user_context,
|  | size_t | index,
|  | const void * | array,
|  | size_t | array_size
| ) |  |

Definition at line 300 of file block_storage.h.

References Halide::Runtime::Internal::BlockStorage::Config::entry_size, halide_abort_if_false, memmove(), Halide::Runtime::Internal::offset_address(), replace(), resize(), size(), and user_context.

## ◆ replace()

void Halide::Runtime::Internal::BlockStorage::replace | ( | void * | user_context,
|  | size_t | index,
|  | const void * | array,
|  | size_t | array_size
| ) |  |

Definition at line 278 of file block_storage.h.

References debug, Halide::Runtime::Internal::BlockStorage::Config::entry_size, halide_abort_if_false, Halide::max(), memcpy(), Halide::min(), Halide::Runtime::Internal::offset_address(), and user_context.

Referenced by Halide::Runtime::Internal::StringStorage::assign(), assign(), and insert().

## ◆ prepend() [2/2]

void Halide::Runtime::Internal::BlockStorage::prepend | ( | void * | user_context,
|  | const void * | array,
|  | size_t | array_size
| ) |  |

Definition at line 315 of file block_storage.h.

References insert(), and user_context.

## ◆ append() [2/2]

void Halide::Runtime::Internal::BlockStorage::append | ( | void * | user_context,
|  | const void * | array,
|  | size_t | array_size
| ) |  |

Definition at line 319 of file block_storage.h.

References insert(), size(), and user_context.

## ◆ remove() [2/2]

void Halide::Runtime::Internal::BlockStorage::remove | ( | void * | user_context,
|  | size_t | index,
|  | size_t | entry_count
| ) |  |

Definition at line 253 of file block_storage.h.

References debug, Halide::Runtime::Internal::BlockStorage::Config::entry_size, halide_abort_if_false, memmove(), Halide::Runtime::Internal::offset_address(), resize(), size(), and user_context.

## ◆ pop_front()

void Halide::Runtime::Internal::BlockStorage::pop_front | ( | void * | user_context | ) |

Definition at line 180 of file block_storage.h.

References halide_abort_if_false, remove(), and user_context.

## ◆ pop_back()

void Halide::Runtime::Internal::BlockStorage::pop_back | ( | void * | user_context | ) |

Definition at line 185 of file block_storage.h.

References halide_abort_if_false, resize(), size(), and user_context.

## ◆ shrink_to_fit()

void Halide::Runtime::Internal::BlockStorage::shrink_to_fit | ( | void * | user_context | ) |

Definition at line 231 of file block_storage.h.

References Halide::Runtime::Internal::SystemMemoryAllocatorFns::allocate, Halide::Runtime::Internal::SystemMemoryAllocatorFns::deallocate, Halide::Runtime::Internal::BlockStorage::Config::entry_size, memcpy(), and user_context.

## ◆ clear()

void Halide::Runtime::Internal::BlockStorage::clear | ( | void * | user_context | ) |

Definition at line 190 of file block_storage.h.

References resize(), and user_context.

Referenced by Halide::Runtime::Internal::StringStorage::clear().

## ◆ destroy()

void Halide::Runtime::Internal::BlockStorage::destroy | ( | void * | user_context | ) |

Definition at line 116 of file block_storage.h.

References Halide::Runtime::Internal::SystemMemoryAllocatorFns::deallocate, halide_abort_if_false, and user_context.

Referenced by Halide::Runtime::Internal::MemoryArena::destroy(), Halide::Runtime::Internal::StringStorage::destroy(), and ~BlockStorage().

## ◆ empty()

bool Halide::Runtime::Internal::BlockStorage::empty | ( |  | ) | const

Definition at line 324 of file block_storage.h.

Referenced by Halide::Runtime::Internal::StringStorage::contains(), and Halide::Runtime::Internal::MemoryArena::destroy().

## ◆ full()

bool Halide::Runtime::Internal::BlockStorage::full | ( |  | ) | const

Definition at line 328 of file block_storage.h.

## ◆ is_valid()

bool Halide::Runtime::Internal::BlockStorage::is_valid | ( | size_t | index | ) | const

Definition at line 332 of file block_storage.h.

Referenced by Halide::Runtime::Internal::StringStorage::terminate().

## ◆ stride()

size_t Halide::Runtime::Internal::BlockStorage::stride | ( |  | ) | const

Definition at line 340 of file block_storage.h.

References Halide::Runtime::Internal::BlockStorage::Config::entry_size.

## ◆ size()

size_t Halide::Runtime::Internal::BlockStorage::size | ( |  | ) | const

Definition at line 336 of file block_storage.h.

Referenced by Halide::Runtime::Internal::StringStorage::append(), append(), Halide::Runtime::Internal::MemoryArena::collect(), Halide::Runtime::Internal::StringStorage::contains(), Halide::Runtime::Internal::MemoryArena::destroy(), insert(), Halide::Runtime::Internal::StringStorage::length(), Halide::Runtime::Internal::StringStorage::operator==(), pop_back(), Halide::Runtime::Internal::StringStorage::prepend(), Halide::Runtime::Internal::MemoryArena::reclaim(), remove(), and Halide::Runtime::Internal::MemoryArena::reserve().

## ◆ operator[]() [1/2]

void * Halide::Runtime::Internal::BlockStorage::operator[] | ( | size_t | index | ) |

logical entry index (returns ptr = data() + (index * stride())

Definition at line 344 of file block_storage.h.

References Halide::Runtime::Internal::BlockStorage::Config::entry_size, halide_abort_if_false, and Halide::Runtime::Internal::offset_address().

## ◆ operator[]() [2/2]

const void * Halide::Runtime::Internal::BlockStorage::operator[] | ( | size_t | index | ) | const

Definition at line 349 of file block_storage.h.

References Halide::Runtime::Internal::BlockStorage::Config::entry_size, halide_abort_if_false, and Halide::Runtime::Internal::offset_address().

## ◆ data() [1/2]

void * Halide::Runtime::Internal::BlockStorage::data | ( |  | ) |

Definition at line 354 of file block_storage.h.

Referenced by Halide::Runtime::Internal::StringStorage::contains(), Halide::Runtime::Internal::StringStorage::data(), and Halide::Runtime::Internal::StringStorage::operator==().

## ◆ front() [1/2]

void * Halide::Runtime::Internal::BlockStorage::front | ( |  | ) |

Definition at line 358 of file block_storage.h.

References halide_abort_if_false.

## ◆ back() [1/2]

void * Halide::Runtime::Internal::BlockStorage::back | ( |  | ) |

Definition at line 363 of file block_storage.h.

References Halide::Runtime::Internal::BlockStorage::Config::entry_size, halide_abort_if_false, and Halide::Runtime::Internal::offset_address().

## ◆ data() [2/2]

const void * Halide::Runtime::Internal::BlockStorage::data | ( |  | ) | const

Definition at line 369 of file block_storage.h.

## ◆ front() [2/2]

const void * Halide::Runtime::Internal::BlockStorage::front | ( |  | ) | const

Definition at line 373 of file block_storage.h.

References halide_abort_if_false.

## ◆ back() [2/2]

const void * Halide::Runtime::Internal::BlockStorage::back | ( |  | ) | const

Definition at line 378 of file block_storage.h.

References Halide::Runtime::Internal::BlockStorage::Config::entry_size, halide_abort_if_false, and Halide::Runtime::Internal::offset_address().

## ◆ current_config()

const BlockStorage::Config & Halide::Runtime::Internal::BlockStorage::current_config | ( |  | ) | const

Definition at line 424 of file block_storage.h.

## ◆ default_config()

const BlockStorage::Config & Halide::Runtime::Internal::BlockStorage::default_config | ( |  | ) |
| static

Definition at line 418 of file block_storage.h.

## ◆ current_allocator()

const SystemMemoryAllocatorFns & Halide::Runtime::Internal::BlockStorage::current_allocator | ( |  | ) | const

Definition at line 413 of file block_storage.h.

Referenced by Halide::Runtime::Internal::MemoryArena::current_allocator(), Halide::Runtime::Internal::StringStorage::current_allocator(), and Halide::Runtime::Internal::MemoryArena::destroy().

## ◆ default_allocator()

const SystemMemoryAllocatorFns & Halide::Runtime::Internal::BlockStorage::default_allocator | ( |  | ) |
| static

Definition at line 429 of file block_storage.h.

References Halide::Runtime::Internal::native_system_free(), and Halide::Runtime::Internal::native_system_malloc().

Referenced by Halide::Runtime::Internal::MemoryArena::default_allocator(), and Halide::Runtime::Internal::StringStorage::default_allocator().

## Member Data Documentation

## ◆ default_capacity

constexpr size_t Halide::Runtime::Internal::BlockStorage::default_capacity = 32
| staticconstexpr

Definition at line 20 of file block_storage.h.

The documentation for this class was generated from the following file:

- src/runtime/internal/block_storage.h