7#include <unordered_map>
14 std::unordered_map<std::string, std::any> mStore;
25 void SetState(
const std::string& key, T value) {
38 auto it = mStore.find(key);
39 if(it == mStore.end())
throw std::runtime_error(
"store key not found: " + key);
42 return std::any_cast<T>(it->second);
43 }
catch(
const std::bad_any_cast& e) {
44 throw std::runtime_error(
"bad type cast for store key: " + key);
55 bool HasKey(
const std::string& key)
const;
Definition statestore.hpp:12
bool HasKey(const std::string &key) const
Vérifie si le store contient une clé
Definition statestore.cpp:4
void SetState(const std::string &key, T value)
Setter typé
Definition statestore.hpp:25
T GetState(const std::string &key) const
Getter avec cast sur le type.
Definition statestore.hpp:37