Skip to navigation

holoscan::config::ConfigValue

Beta
View as Markdown

Own one value from the closed configuration semantic algebra.

Values are immutable after construction. Copies share immutable storage and may be read concurrently. Except for null(), factories can allocate. Short forms throw on failure; try_* forms return a structured error, including allocation exhaustion. Use try_* when allocation exhaustion must remain reportable because constructing an exception can allocate.

#include <holoscan/config/document.hpp>

Constructors

ConfigValue

holoscan::config::ConfigValue::ConfigValue() noexcept

Create the null value without allocating.


Methods

kind

ConfigValueKind holoscan::config::ConfigValue::kind() const noexcept

Return the stored semantic alternative.

view

ConfigView holoscan::config::ConfigValue::view() const noexcept

Return a shareable immutable view of this value.

Returns: A view that remains valid independently of this object’s lifetime.


Static methods

null

static ConfigValue holoscan::config::ConfigValue::null() noexcept

Create the null value without allocating.

Returns: An owning null value.

boolean

static ConfigValue holoscan::config::ConfigValue::boolean(
bool value
)

Create a Boolean value.

Returns: The owning value.

Throws: ConfigException when an allocation failure can be reported.

Parameters

value
bool

Boolean to copy.

try_boolean

static ConfigResult<ConfigValue> holoscan::config::ConfigValue::try_boolean(
bool value
) noexcept

Try to create a Boolean value.

Returns: The owning value or CONFIG_LIMIT_EXCEEDED.

Parameters

value
bool

Boolean to copy.

signed_integer

static ConfigValue holoscan::config::ConfigValue::signed_integer(
std::int64_t value
)

Create a signed 64-bit integer value.

Returns: The owning value.

Throws: ConfigException when an allocation failure can be reported.

Parameters

value
std::int64_t

Integer to copy.

try_signed_integer

static ConfigResult<ConfigValue> holoscan::config::ConfigValue::try_signed_integer(
std::int64_t value
) noexcept

Try to create a signed 64-bit integer value.

Returns: The owning value or CONFIG_LIMIT_EXCEEDED.

Parameters

value
std::int64_t

Integer to copy.

unsigned_integer

static ConfigValue holoscan::config::ConfigValue::unsigned_integer(
std::uint64_t value
)

Create an unsigned 64-bit integer value.

Returns: The owning value.

Throws: ConfigException when an allocation failure can be reported.

Parameters

value
std::uint64_t

Integer to copy.

try_unsigned_integer

static ConfigResult<ConfigValue> holoscan::config::ConfigValue::try_unsigned_integer(
std::uint64_t value
) noexcept

Try to create an unsigned 64-bit integer value.

Returns: The owning value or CONFIG_LIMIT_EXCEEDED.

Parameters

value
std::uint64_t

Integer to copy.

floating

static ConfigValue holoscan::config::ConfigValue::floating(
double value
)

Create a finite binary64 value.

Returns: The owning value.

Throws: ConfigException on an unsupported value or a reportable allocation failure.

Parameters

value
double

Number to copy. Negative zero is normalized to positive zero.

try_floating

static ConfigResult<ConfigValue> holoscan::config::ConfigValue::try_floating(
double value
) noexcept

Try to create a finite binary64 value.

Returns: The owning value, CONFIG_UNSUPPORTED_VALUE, or CONFIG_LIMIT_EXCEEDED.

Parameters

value
double

Number to copy. Negative zero is normalized to positive zero.

string

static ConfigValue holoscan::config::ConfigValue::string(
std::string_view value,
ConfigValueLimits limits = {}
)

Create an owning UTF-8 string value.

Returns: The owning value.

Throws: ConfigException on validation or a reportable allocation failure.

Parameters

value
std::string_view

UTF-8 bytes to copy.

limits
ConfigValueLimitsDefaults to {}

Construction limits applied before publication.

try_string

static ConfigResult<ConfigValue> holoscan::config::ConfigValue::try_string(
std::string_view value,
ConfigValueLimits limits = {}
)

Try to create an owning UTF-8 string value.

Returns: The owning value or a structured validation/allocation failure.

Parameters

value
std::string_view

UTF-8 bytes to copy.

limits
ConfigValueLimitsDefaults to {}

Construction limits applied before publication.

array

static ConfigValue holoscan::config::ConfigValue::array(
std::span<const ConfigValue> values,
ConfigValueLimits limits = {}
)

Create an immutable array by sharing each child value.

Returns: The owning aggregate.

Throws: ConfigException on a limit violation or reportable allocation failure.

Parameters

values
std::span<const ConfigValue>

Child values in preserved array order.

limits
ConfigValueLimitsDefaults to {}

Bounds applied to the complete reachable tree.

try_array

static ConfigResult<ConfigValue> holoscan::config::ConfigValue::try_array(
std::span<const ConfigValue> values,
ConfigValueLimits limits = {}
)

Try to create an immutable array by sharing each child value.

Returns: The owning aggregate or a structured limit/allocation failure.

Parameters

values
std::span<const ConfigValue>

Child values in preserved array order.

limits
ConfigValueLimitsDefaults to {}

Bounds applied to the complete reachable tree.

object

static ConfigValue holoscan::config::ConfigValue::object(
std::span<const ConfigObjectEntry> entries,
ConfigValueLimits limits = {}
)

Create an immutable unique-key object.

Returns: The owning aggregate.

Throws: ConfigException on UTF-8, duplicate-key, limit, or reportable allocation failure.

Parameters

entries
std::span<const ConfigObjectEntry>

UTF-8 keys and child values in insertion order. Keys are copied.

limits
ConfigValueLimitsDefaults to {}

Bounds applied to the complete reachable tree.

try_object

static ConfigResult<ConfigValue> holoscan::config::ConfigValue::try_object(
std::span<const ConfigObjectEntry> entries,
ConfigValueLimits limits = {}
)

Try to create an immutable unique-key object.

Returns: The owning aggregate or a structured UTF-8, duplicate, limit, or allocation failure.

Parameters

entries
std::span<const ConfigObjectEntry>

UTF-8 keys and child values in insertion order. Keys are copied.

limits
ConfigValueLimitsDefaults to {}

Bounds applied to the complete reachable tree.


Member variables

NameTypeDescription
node_std::shared_ptr< const detail::ConfigNode >