Loom C API
Public Loom compiler C API
Loading...
Searching...
No Matches
byte_sequence.h
Go to the documentation of this file.
1// Copyright 2026 The IREE Authors
2//
3// Licensed under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
7#ifndef LOOMC_BYTE_SEQUENCE_H_
8#define LOOMC_BYTE_SEQUENCE_H_
9
10#include "loomc/base.h"
11
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
29
35 void* user_data, loomc_byte_span_t segment);
36
45
56 loomc_byte_span_t contents, loomc_allocator_t allocator,
57 loomc_byte_sequence_t** out_sequence);
58
63 loomc_byte_sequence_t* sequence);
64
69 loomc_byte_sequence_t* sequence);
70
75LOOMC_API_EXPORT uint64_t
77
87 const loomc_byte_sequence_t* sequence, loomc_byte_span_t* out_span);
88
98
109 const loomc_byte_sequence_t* sequence, loomc_allocator_t allocator,
110 loomc_byte_span_t* out_span);
111
112#ifdef __cplusplus
113} // extern "C"
114#endif
115
116#endif // LOOMC_BYTE_SEQUENCE_H_
Base types, descriptors, spans, and host allocation helpers.
#define LOOMC_API_EXPORT
Exports a public Loom C API symbol from a shared library build.
Definition base.h:34
#define LOOMC_API_PTR
Marks a public callback function pointer type.
Definition base.h:38
struct iree_status_handle_t * loomc_status_t
Opaque status handle.
Definition base.h:55
uint64_t loomc_byte_sequence_length(const loomc_byte_sequence_t *sequence)
Returns the logical byte length of sequence.
loomc_status_t loomc_byte_sequence_enumerate(const loomc_byte_sequence_t *sequence, loomc_byte_sequence_callback_t callback)
Enumerates all non-empty segments in logical byte order.
void loomc_byte_sequence_retain(loomc_byte_sequence_t *sequence)
Retains sequence for another owner.
loomc_status_t loomc_byte_sequence_clone(const loomc_byte_sequence_t *sequence, loomc_allocator_t allocator, loomc_byte_span_t *out_span)
Clones sequence into one contiguous allocator-owned span.
bool loomc_byte_sequence_try_get_contiguous_span(const loomc_byte_sequence_t *sequence, loomc_byte_span_t *out_span)
Attempts to borrow the complete sequence as one contiguous span.
void loomc_byte_sequence_release(loomc_byte_sequence_t *sequence)
Releases sequence from one owner.
loomc_status_t(* loomc_byte_sequence_callback_fn_t)(void *user_data, loomc_byte_span_t segment)
Callback invoked for each ordered non-empty sequence segment.
Definition byte_sequence.h:34
struct loomc_byte_sequence_t loomc_byte_sequence_t
Immutable logical sequence of bytes stored in one or more segments.
Definition byte_sequence.h:28
loomc_status_t loomc_byte_sequence_create_copy(loomc_byte_span_t contents, loomc_allocator_t allocator, loomc_byte_sequence_t **out_sequence)
Creates a sequence containing a copy of contents.
Host allocator used for persistent Loom object storage.
Definition base.h:390
Callback and caller-owned state used to enumerate a sequence.
Definition byte_sequence.h:38
void * user_data
Opaque value passed to fn.
Definition byte_sequence.h:43
loomc_byte_sequence_callback_fn_t fn
Function invoked for each segment.
Definition byte_sequence.h:40
Non-owning view over immutable bytes.
Definition base.h:128