MayaFlux 0.1.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 437 of file RegionUtils.hpp.

438{
439 auto it = region.attributes.find(key);
440 if (it != region.attributes.end()) {
441 try {
442 return safe_any_cast<T>(it->second);
443 } catch (const std::bad_any_cast&) {
444 return std::nullopt;
445 }
446 }
447 return std::nullopt;
448}
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.