Skip to navigation

holoscan::config::DecodeContext

Beta
View as Markdown

Carry package-owned monotonic state for one decode call tree.

Applications receive this non-copyable object only inside ConfigCodec callbacks. A context and its children borrow top-level call state and must not escape the callback. It is not thread-safe; one top-level decode owns one independent context tree.

#include <holoscan/config/codec.hpp>

Constructors

DecodeContext

holoscan::config::DecodeContext::DecodeContext(
std::string path,
detail::CodecCallState &state,
std::uint32_t depth
)

Assignment operators

operator=

DecodeContext & holoscan::config::DecodeContext::operator=(
const DecodeContext &
) = delete

Disable copy assignment because the context borrows one call’s budget state.


Methods

path

std::string_view holoscan::config::DecodeContext::path() const noexcept

Return the owned RFC 6901 path for the value currently being decoded.

decode_child

template <class T>
ConfigResult<T> holoscan::config::DecodeContext::decode_child(
std::string_view token,
ConfigView value,
const DecodeOptions &options
)

Decode one nested value while preserving path and monotonic call budgets.

Returns: The owning decoded child or its structured failure.

Template parameters

T
class

Nested owning type with a visible complete codec specialization.

Parameters

token
std::string_view

Unescaped object key or decimal array index for the child.

value
ConfigView

Borrowed child semantic value.

options
const DecodeOptions &

Immutable policy shared by the top-level invocation.

charge_allocation

ConfigResult<void> holoscan::config::DecodeContext::charge_allocation(
std::size_t bytes
) noexcept

Charge an owning result allocation against this call tree before allocating it.

Returns: Success or CONFIG_LIMIT_EXCEEDED without changing the budget on failure.

Parameters

bytes
std::size_t

Number of bytes the codec is about to allocate.

charge_string

ConfigResult<void> holoscan::config::DecodeContext::charge_string(
std::size_t bytes
) noexcept

Validate one string and charge its owning result bytes before allocating it.

Returns: Success or CONFIG_LIMIT_EXCEEDED.

Parameters

bytes
std::size_t

Decoded UTF-8 bytes the codec is about to own.

charge_container

ConfigResult<void> holoscan::config::DecodeContext::charge_container(
std::size_t entries,
std::size_t element_bytes
) noexcept

Validate one container and charge its element storage before allocating it.

Returns: Success or CONFIG_LIMIT_EXCEEDED, including multiplication overflow.

Parameters

entries
std::size_t

Number of immediate elements.

element_bytes
std::size_t

Owning storage bytes charged per element.

child

DecodeContext holoscan::config::DecodeContext::child(
std::string_view token
) const

charge

ConfigResult<void> holoscan::config::DecodeContext::charge(
const ConfigView &value
) noexcept

begin_decoder

void holoscan::config::DecodeContext::begin_decoder() noexcept

finish_decoder

void holoscan::config::DecodeContext::finish_decoder() noexcept

Member variables

NameTypeDescription
path_std::string
state_detail::CodecCallState &
depth_std::uint32_t