Go to the source code of this file.
◆ vlStreamOpenMemory()
| VL_API vl_stream * vlStreamOpenMemory |
( |
const void * |
memory, |
|
|
vl_memsize_t |
size |
|
) |
| |
Creates a read-only stream from a raw memory block.
Contract
- Ownership: The caller owns the returned
vl_stream pointer. The memory block is NOT owned by the stream.
- Lifetime: The stream is valid until its reference count reaches zero. The underlying memory block must remain valid and unchanged for the entire lifetime of the stream.
- Thread Safety: Thread-safe (internal mutex).
- Nullability: Returns
NULL if memory is NULL.
- Error Conditions: Returns
NULL on allocation failure.
- Undefined Behavior: Modifying the underlying memory while the stream is active.
- Memory Allocation Expectations: Allocates memory for the
vl_stream struct, an internal context struct, and synchronization primitives.
- Return-value Semantics: Returns a pointer to the new read-only stream, or
NULL.
- Parameters
-
| memory | Pointer to the data. |
| size | Size of the data in bytes. |
- Returns
- A new stream object.
◆ vlStreamOpenMemoryMutable()
| VL_API vl_stream * vlStreamOpenMemoryMutable |
( |
void * |
memory, |
|
|
vl_memsize_t |
size |
|
) |
| |
Creates a writable stream from a fixed-size memory block. Writing past the end will fail.
Contract
- Ownership: The caller owns the returned
vl_stream pointer and the underlying memory block.
- Lifetime: The stream is valid until its reference count reaches zero. The underlying memory block must remain valid for the entire lifetime of the stream.
- Thread Safety: Thread-safe (internal mutex).
- Nullability: Returns
NULL if memory is NULL.
- Error Conditions: Returns
NULL on allocation failure. Write operations will fail if they exceed the specified size.
- Undefined Behavior: None.
- Memory Allocation Expectations: Allocates memory for the
vl_stream struct, an internal context struct, and synchronization primitives.
- Return-value Semantics: Returns a pointer to the new writable stream, or
NULL.
- Parameters
-
| memory | Pointer to the writable data. |
| size | Size of the data in bytes. |
- Returns
- A new stream object.