FDL Core Library
ASC Framing Decision List — C/C++ Reference Implementation
Loading...
Searching...
No Matches
Typedefs | Functions
fdl_collections_api.cpp File Reference

C ABI for collection traversal (count, at, find_by_id/label) and handle allocation. More...

#include "fdl/fdl_core.h"
#include "fdl_collection_helpers.h"
#include "fdl_compat.h"
#include "fdl_constants.h"
#include "fdl_doc.h"
#include <cinttypes>
#include <cstring>
#include <string_view>
#include <tuple>

Typedefs

using ojson = jsoncons::ojson
 

Functions

uint32_t fdl_doc_framing_intents_count (fdl_doc_t *doc)
 Get the number of framing intents in the document.
 
fdl_framing_intent_tfdl_doc_framing_intent_at (fdl_doc_t *doc, uint32_t index)
 Get a framing intent by index.
 
fdl_framing_intent_tfdl_doc_framing_intent_find_by_id (fdl_doc_t *doc, const char *id)
 Find a framing intent by its ID string.
 
uint32_t fdl_doc_contexts_count (fdl_doc_t *doc)
 Get the number of contexts in the document.
 
fdl_context_tfdl_doc_context_at (fdl_doc_t *doc, uint32_t index)
 Get a context by index.
 
fdl_context_tfdl_doc_context_find_by_label (fdl_doc_t *doc, const char *label)
 Find a context by its label string.
 
uint32_t fdl_doc_canvas_templates_count (fdl_doc_t *doc)
 Get the number of canvas templates in the document.
 
fdl_canvas_template_tfdl_doc_canvas_template_at (fdl_doc_t *doc, uint32_t index)
 Get a canvas template by index.
 
fdl_canvas_template_tfdl_doc_canvas_template_find_by_id (fdl_doc_t *doc, const char *id)
 Find a canvas template by its ID string.
 
uint32_t fdl_context_canvases_count (const fdl_context_t *ctx)
 Get the number of canvases in a context.
 
fdl_canvas_tfdl_context_canvas_at (fdl_context_t *ctx, uint32_t index)
 Get a canvas by index within a context.
 
fdl_canvas_tfdl_context_find_canvas_by_id (fdl_context_t *ctx, const char *id)
 Find a canvas by its ID within a context.
 
uint32_t fdl_canvas_framing_decisions_count (const fdl_canvas_t *canvas)
 Get the number of framing decisions in a canvas.
 
fdl_framing_decision_tfdl_canvas_framing_decision_at (fdl_canvas_t *canvas, uint32_t index)
 Get a framing decision by index within a canvas.
 
fdl_framing_decision_tfdl_canvas_find_framing_decision_by_id (fdl_canvas_t *canvas, const char *id)
 Find a framing decision by its ID within a canvas.
 
fdl_resolve_canvas_result_t fdl_context_resolve_canvas_for_dimensions (fdl_context_t *ctx, fdl_dimensions_f64_t input_dims, fdl_canvas_t *canvas, fdl_framing_decision_t *framing)
 Resolve canvas for given input dimensions.
 

Detailed Description

C ABI for collection traversal (count, at, find_by_id/label) and handle allocation.

Uses template helpers from fdl_collection_helpers.h to eliminate duplication across the 5 collection types. Each C ABI function is a thin wrapper that acquires the document lock and delegates to the appropriate template.

Function Documentation

◆ fdl_doc_framing_intents_count()

uint32_t fdl_doc_framing_intents_count ( fdl_doc_t doc)

Get the number of framing intents in the document.

Parameters
docDocument handle.
Returns
Number of framing intents.

◆ fdl_doc_framing_intent_at()

fdl_framing_intent_t * fdl_doc_framing_intent_at ( fdl_doc_t doc,
uint32_t  index 
)

Get a framing intent by index.

Parameters
docDocument handle.
indexZero-based index.
Returns
Framing intent handle (owned by doc), or NULL if index out of range.

◆ fdl_doc_framing_intent_find_by_id()

fdl_framing_intent_t * fdl_doc_framing_intent_find_by_id ( fdl_doc_t doc,
const char *  id 
)

Find a framing intent by its ID string.

Parameters
docDocument handle.
idFraming intent ID to search for.
Returns
Framing intent handle (owned by doc), or NULL if not found.

◆ fdl_doc_contexts_count()

uint32_t fdl_doc_contexts_count ( fdl_doc_t doc)

Get the number of contexts in the document.

Parameters
docDocument handle.
Returns
Number of contexts.

◆ fdl_doc_context_at()

fdl_context_t * fdl_doc_context_at ( fdl_doc_t doc,
uint32_t  index 
)

Get a context by index.

Parameters
docDocument handle.
indexZero-based index.
Returns
Context handle (owned by doc), or NULL if index out of range.

◆ fdl_doc_context_find_by_label()

fdl_context_t * fdl_doc_context_find_by_label ( fdl_doc_t doc,
const char *  label 
)

Find a context by its label string.

Parameters
docDocument handle.
labelContext label to search for.
Returns
Context handle (owned by doc), or NULL if not found.

◆ fdl_doc_canvas_templates_count()

uint32_t fdl_doc_canvas_templates_count ( fdl_doc_t doc)

Get the number of canvas templates in the document.

Parameters
docDocument handle.
Returns
Number of canvas templates.

◆ fdl_doc_canvas_template_at()

fdl_canvas_template_t * fdl_doc_canvas_template_at ( fdl_doc_t doc,
uint32_t  index 
)

Get a canvas template by index.

Parameters
docDocument handle.
indexZero-based index.
Returns
Canvas template handle (owned by doc), or NULL if index out of range.

◆ fdl_doc_canvas_template_find_by_id()

fdl_canvas_template_t * fdl_doc_canvas_template_find_by_id ( fdl_doc_t doc,
const char *  id 
)

Find a canvas template by its ID string.

Parameters
docDocument handle.
idCanvas template ID to search for.
Returns
Canvas template handle (owned by doc), or NULL if not found.

◆ fdl_context_canvases_count()

uint32_t fdl_context_canvases_count ( const fdl_context_t ctx)

Get the number of canvases in a context.

Parameters
ctxContext handle.
Returns
Number of canvases.

◆ fdl_context_canvas_at()

fdl_canvas_t * fdl_context_canvas_at ( fdl_context_t ctx,
uint32_t  index 
)

Get a canvas by index within a context.

Parameters
ctxContext handle.
indexZero-based index.
Returns
Canvas handle (owned by doc), or NULL if index out of range.

◆ fdl_context_find_canvas_by_id()

fdl_canvas_t * fdl_context_find_canvas_by_id ( fdl_context_t ctx,
const char *  id 
)

Find a canvas by its ID within a context.

Parameters
ctxContext handle.
idCanvas ID to search for.
Returns
Canvas handle (owned by doc), or NULL if not found.

◆ fdl_canvas_framing_decisions_count()

uint32_t fdl_canvas_framing_decisions_count ( const fdl_canvas_t canvas)

Get the number of framing decisions in a canvas.

Parameters
canvasCanvas handle.
Returns
Number of framing decisions.

◆ fdl_canvas_framing_decision_at()

fdl_framing_decision_t * fdl_canvas_framing_decision_at ( fdl_canvas_t canvas,
uint32_t  index 
)

Get a framing decision by index within a canvas.

Parameters
canvasCanvas handle.
indexZero-based index.
Returns
Framing decision handle (owned by doc), or NULL if index out of range.

◆ fdl_canvas_find_framing_decision_by_id()

fdl_framing_decision_t * fdl_canvas_find_framing_decision_by_id ( fdl_canvas_t canvas,
const char *  id 
)

Find a framing decision by its ID within a canvas.

Parameters
canvasCanvas handle.
idFraming decision ID to search for.
Returns
Framing decision handle (owned by doc), or NULL if not found.

◆ fdl_context_resolve_canvas_for_dimensions()

fdl_resolve_canvas_result_t fdl_context_resolve_canvas_for_dimensions ( fdl_context_t ctx,
fdl_dimensions_f64_t  input_dims,
fdl_canvas_t canvas,
fdl_framing_decision_t framing 
)

Resolve canvas for given input dimensions.

If input_dims match the canvas dimensions, returns the original canvas/framing with was_resolved=0. If they don't match and the canvas is derived (id != source_canvas_id), searches sibling canvases for one with matching dimensions and a framing decision with the same label.

Parameters
ctxContext containing the canvases to search.
input_dimsInput dimensions to match against.
canvasStarting canvas (may be returned if dimensions match).
framingStarting framing decision (label used for matching).
Returns
Result with resolved canvas/framing on success, error if no match found. Handles in result are non-owning (owned by doc). Error string, if set, must be freed with fdl_free().

< POSIX strdup.

< POSIX strdup.

< POSIX strdup.