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

◆ get_state()

template<typename RoutineType >
template<typename T >
T * MayaFlux::Vruta::routine_promise< RoutineType >::get_state ( const std::string &  key)
inline

Retrieves a value from the state dictionary.

Parameters
keyName of the state value to retrieve
Returns
Pointer to the stored value, or nullptr if not found or type mismatch

This method provides a type-safe way to retrieve values from the state dictionary. It returns a pointer to the stored value if it exists and has the requested type, or nullptr otherwise.

Definition at line 198 of file Promise.hpp.

199 {
200 auto it = state.find(key);
201 if (it != state.end()) {
202 try {
203 return std::any_cast<T>(&it->second);
204 } catch (const std::bad_any_cast&) {
205 return nullptr;
206 }
207 }
208 return nullptr;
209 }
std::unordered_map< std::string, std::any > state
Dictionary for storing arbitrary state data.
Definition Promise.hpp:156