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

◆ get_region_attribute()

template<typename T >
std::optional< T > MayaFlux::Kakshya::get_region_attribute ( const Region region,
const std::string &  key 
)

Get an attribute value from a Region by key.

Template Parameters
TExpected type.
Parameters
regionRegion to query.
keyAttribute key.
Returns
Optional value if present and convertible.

Definition at line 464 of file RegionUtils.hpp.

465{
466 auto it = region.attributes.find(key);
467 if (it != region.attributes.end()) {
468 try {
469 return safe_any_cast<T>(it->second);
470 } catch (const std::bad_any_cast&) {
471 return std::nullopt;
472 }
473 }
474 return std::nullopt;
475}
std::unordered_map< std::string, std::any > attributes
Flexible key-value store for region-specific attributes.
Definition Region.hpp:75

References MayaFlux::Kakshya::Region::attributes.