MayaFlux 0.1.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 154 of file Promise.hpp.

155 {
156 auto it = state.find(key);
157 if (it != state.end()) {
158 try {
159 return std::any_cast<T>(&it->second);
160 } catch (const std::bad_any_cast&) {
161 return nullptr;
162 }
163 }
164 return nullptr;
165 }
std::unordered_map< std::string, std::any > state
Dictionary for storing arbitrary state data.
Definition Promise.hpp:112