LV2  1.0.13
Data Structures | Macros | Typedefs | Functions
forge.h File Reference

Data Structures

struct  LV2_Atom_Forge_Frame
 
struct  LV2_Atom_Forge
 

Typedefs

typedef void * LV2_Atom_Forge_Sink_Handle
 
typedef intptr_t LV2_Atom_Forge_Ref
 
typedef LV2_Atom_Forge_Ref(* LV2_Atom_Forge_Sink) (LV2_Atom_Forge_Sink_Handle handle, const void *buf, uint32_t size)
 
typedef LV2_Atom *(* LV2_Atom_Forge_Deref_Func) (LV2_Atom_Forge_Sink_Handle handle, LV2_Atom_Forge_Ref ref)
 

Functions

static void lv2_atom_forge_init (LV2_Atom_Forge *forge, LV2_URID_Map *map)
 
static LV2_Atomlv2_atom_forge_deref (LV2_Atom_Forge *forge, LV2_Atom_Forge_Ref ref)
 
Output Configuration
static void lv2_atom_forge_set_buffer (LV2_Atom_Forge *forge, uint8_t *buf, size_t size)
 
static void lv2_atom_forge_set_sink (LV2_Atom_Forge *forge, LV2_Atom_Forge_Sink sink, LV2_Atom_Forge_Deref_Func deref, LV2_Atom_Forge_Sink_Handle handle)
 
Object Stack
static LV2_Atom_Forge_Ref lv2_atom_forge_push (LV2_Atom_Forge *forge, LV2_Atom_Forge_Frame *frame, LV2_Atom_Forge_Ref ref)
 
static void lv2_atom_forge_pop (LV2_Atom_Forge *forge, LV2_Atom_Forge_Frame *frame)
 
static bool lv2_atom_forge_top_is (LV2_Atom_Forge *forge, uint32_t type)
 
static bool lv2_atom_forge_is_object_type (const LV2_Atom_Forge *forge, uint32_t type)
 
static bool lv2_atom_forge_is_blank (const LV2_Atom_Forge *forge, uint32_t type, const LV2_Atom_Object_Body *body)
 
Low Level Output
static LV2_Atom_Forge_Ref lv2_atom_forge_raw (LV2_Atom_Forge *forge, const void *data, uint32_t size)
 
static void lv2_atom_forge_pad (LV2_Atom_Forge *forge, uint32_t written)
 
static LV2_Atom_Forge_Ref lv2_atom_forge_write (LV2_Atom_Forge *forge, const void *data, uint32_t size)
 
static LV2_Atom_Forge_Ref lv2_atom_forge_string_body (LV2_Atom_Forge *forge, const char *str, uint32_t len)
 
Atom Output
static LV2_Atom_Forge_Ref lv2_atom_forge_atom (LV2_Atom_Forge *forge, uint32_t size, uint32_t type)
 
static LV2_Atom_Forge_Ref lv2_atom_forge_primitive (LV2_Atom_Forge *forge, const LV2_Atom *a)
 
static LV2_Atom_Forge_Ref lv2_atom_forge_int (LV2_Atom_Forge *forge, int32_t val)
 
static LV2_Atom_Forge_Ref lv2_atom_forge_long (LV2_Atom_Forge *forge, int64_t val)
 
static LV2_Atom_Forge_Ref lv2_atom_forge_float (LV2_Atom_Forge *forge, float val)
 
static LV2_Atom_Forge_Ref lv2_atom_forge_double (LV2_Atom_Forge *forge, double val)
 
static LV2_Atom_Forge_Ref lv2_atom_forge_bool (LV2_Atom_Forge *forge, bool val)
 
static LV2_Atom_Forge_Ref lv2_atom_forge_urid (LV2_Atom_Forge *forge, LV2_URID id)
 
static LV2_Atom_Forge_Ref lv2_atom_forge_typed_string (LV2_Atom_Forge *forge, uint32_t type, const char *str, uint32_t len)
 
static LV2_Atom_Forge_Ref lv2_atom_forge_string (LV2_Atom_Forge *forge, const char *str, uint32_t len)
 
static LV2_Atom_Forge_Ref lv2_atom_forge_uri (LV2_Atom_Forge *forge, const char *uri, uint32_t len)
 
static LV2_Atom_Forge_Ref lv2_atom_forge_path (LV2_Atom_Forge *forge, const char *path, uint32_t len)
 
static LV2_Atom_Forge_Ref lv2_atom_forge_literal (LV2_Atom_Forge *forge, const char *str, uint32_t len, uint32_t datatype, uint32_t lang)
 
static LV2_Atom_Forge_Ref lv2_atom_forge_vector_head (LV2_Atom_Forge *forge, LV2_Atom_Forge_Frame *frame, uint32_t child_size, uint32_t child_type)
 
static LV2_Atom_Forge_Ref lv2_atom_forge_vector (LV2_Atom_Forge *forge, uint32_t child_size, uint32_t child_type, uint32_t n_elems, const void *elems)
 
static LV2_Atom_Forge_Ref lv2_atom_forge_tuple (LV2_Atom_Forge *forge, LV2_Atom_Forge_Frame *frame)
 
static LV2_Atom_Forge_Ref lv2_atom_forge_object (LV2_Atom_Forge *forge, LV2_Atom_Forge_Frame *frame, LV2_URID id, LV2_URID otype)
 
static LV2_ATOM_FORGE_DEPRECATED LV2_Atom_Forge_Ref lv2_atom_forge_resource (LV2_Atom_Forge *forge, LV2_Atom_Forge_Frame *frame, LV2_URID id, LV2_URID otype)
 
static LV2_ATOM_FORGE_DEPRECATED LV2_Atom_Forge_Ref lv2_atom_forge_blank (LV2_Atom_Forge *forge, LV2_Atom_Forge_Frame *frame, uint32_t id, LV2_URID otype)
 
static LV2_Atom_Forge_Ref lv2_atom_forge_key (LV2_Atom_Forge *forge, LV2_URID key)
 
static LV2_Atom_Forge_Ref lv2_atom_forge_property_head (LV2_Atom_Forge *forge, LV2_URID key, LV2_URID context)
 
static LV2_Atom_Forge_Ref lv2_atom_forge_sequence_head (LV2_Atom_Forge *forge, LV2_Atom_Forge_Frame *frame, uint32_t unit)
 
static LV2_Atom_Forge_Ref lv2_atom_forge_frame_time (LV2_Atom_Forge *forge, int64_t frames)
 
static LV2_Atom_Forge_Ref lv2_atom_forge_beat_time (LV2_Atom_Forge *forge, double beats)
 

Detailed Description

An API for constructing LV2 atoms.

This file provides an API for constructing Atoms which makes it relatively simple to build nested atoms of arbitrary complexity without requiring dynamic memory allocation.

The API is based on successively appending the appropriate pieces to build a complete Atom. The size of containers is automatically updated. Functions that begin a container return (via their frame argument) a stack frame which must be popped when the container is finished.

All output is written to a user-provided buffer or sink function. This makes it popssible to create create atoms on the stack, on the heap, in LV2 port buffers, in a ringbuffer, or elsewhere, all using the same API.

This entire API is realtime safe if used with a buffer or a realtime safe sink, except lv2_atom_forge_init() which is only realtime safe if the URI map function is.

Note these functions are all static inline, do not take their address.

This header is non-normative, it is provided for convenience.