MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ get_or_throw()

template<typename T >
T MayaFlux::Yantra::ExecutionContext::get_or_throw ( const std::string &  key) const
inline

Retrieve metadata value or throw if unavailable.

Uses safe_any_cast_or_throw.

Template Parameters
TExpected type
Parameters
keyMetadata key
Returns
Retrieved value
Exceptions
std::runtime_errorif key missing or conversion fails

Definition at line 192 of file ExecutionContext.hpp.

193 {
194 auto it = execution_metadata.find(key);
195
196 if (it == execution_metadata.end())
197 throw std::runtime_error("ExecutionContext missing key: " + key);
198
199 return safe_any_cast_or_throw<T>(it->second);
200 }
std::unordered_map< std::string, std::any > execution_metadata
Arbitrary metadata parameters used by operations.