MayaFlux 0.3.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 446 of file RegionUtils.hpp.

447{
448 auto it = region.attributes.find(key);
449 if (it != region.attributes.end()) {
450 try {
451 return safe_any_cast<T>(it->second);
452 } catch (const std::bad_any_cast&) {
453 return std::nullopt;
454 }
455 }
456 return std::nullopt;
457}
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.