Skip to navigation

holoscan::config::ObjectDecoder

Beta
View as MarkdownOpen in Claude

Traverse an object while recording consumed members for strict finish validation.

#include <holoscan/config/codec.hpp>

Constructors

ObjectDecoder

holoscan::config::ObjectDecoder::ObjectDecoder(
ConfigView view,
const DecodeOptions &options,
DecodeContext &context
)

Begin consuming one object value through the package-owned decode context.

Call finish exactly once before returning a successful codec result.

Parameters

view
ConfigView

Object value to traverse. A non-object is reported by the first operation.

options
const DecodeOptions &

Immutable policy controlling unknown members and child conversion.

context
DecodeContext &

Borrowed context that must outlive this decoder.

Destructor

~ObjectDecoder

holoscan::config::ObjectDecoder::~ObjectDecoder() = default

Destroy local consumption state without implicitly closing the context scope.

A codec that returns success without calling finish is rejected by try_decode_config.


Assignment operators

operator=

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

Disable copy assignment because the decoder owns consumption state.


Methods

required

template <ConfigCodable T>
ConfigResult<T> holoscan::config::ObjectDecoder::required(
std::string_view key
)

Decode and mark one required object member as consumed.

Returns: The decoded value, CONFIG_PATH_NOT_FOUND, or a structured child failure.

Template parameters

T
ConfigCodable

Owning member type satisfying ConfigCodable.

Parameters

key
std::string_view

Exact unescaped UTF-8 object key.

optional

template <ConfigCodable T>
ConfigResult<std::optional<T>> holoscan::config::ObjectDecoder::optional(
std::string_view key
)

Decode and mark one optional object member as consumed when present.

Returns: Empty optional when absent, the decoded value when present, or a structured failure.

Template parameters

T
ConfigCodable

Owning member type satisfying ConfigCodable.

Parameters

key
std::string_view

Exact unescaped UTF-8 object key.

finish

ConfigResult<void> holoscan::config::ObjectDecoder::finish()

Validate complete object consumption and close this decoder scope.

Calling finish again after success is idempotent.

Returns: Success, the construction failure, or CONFIG_CODEC_FAILURE for an unconsumed member under UnknownFieldPolicy::kReject.


Member variables

NameTypeDescription
view_ConfigView
options_DecodeOptions
context_DecodeContext &
consumed_std::vector< bool >
initialization_error_std::optional< ConfigError >
finished_bool