8#include <unordered_map>
30 using iterator = std::unordered_map<std::string, std::any>::iterator;
31 using const_iterator = std::unordered_map<std::string, std::any>::const_iterator;
50 [[nodiscard]] std::optional<std::any>
get(const std::
string &key) const;
66 [[nodiscard]] std::optional<T>
get_unwrapped(const std::
string &key)
const
68 auto value =
get(key);
73 return std::optional{std::any_cast<T>(value.value())};
75 catch (
const std::bad_any_cast &) {
76 panic(
"invalid type requested for key: " + key);
85 [[nodiscard]] std::size_t
size()
const;
97 void put(
const std::string &key,
const std::any &value);
105 [[nodiscard]]
bool contains(
const std::string &key)
const;
117 [[nodiscard]] std::optional<std::type_index>
type_index_of(
const std::string &key)
const;
133 std::unordered_map<std::string, std::any> config_;
A type-erased container for orchestration operands with runtime type checking.
void put(const std::string &key, const std::any &value)
Stores an operand value with the given key.
std::unordered_map< std::string, std::any >::iterator iterator
const_iterator cbegin() const noexcept
std::unordered_map< std::string, std::any >::const_iterator const_iterator
const_iterator cend() const noexcept
bool contains(const std::string &key) const
Checks if an operand with the given key exists.
std::size_t size() const
Returns the number of operands stored in the bundle.
std::optional< T > get_unwrapped(const std::string &key) const
Retrieves and casts an operand value to the specified type.
std::optional< std::type_index > type_index_of(const std::string &key) const
Retrieves the runtime type information for an operand.
std::optional< std::any > get(const std::string &key) const
Retrieves an operand value as std::any.
bool satisfies_declarations(const std::vector< OperandDeclaration > &declarations) const
Validates that the bundle satisfies a set of operand declarations.
iterator begin() noexcept
void panic(const StringViewSourceLoc &s)
Unconditionally terminates the program with a panic message.