| 234 | |
| 235 | template <typename T> |
| 236 | inline T Blackboard::get(const std::string& key) const |
| 237 | { |
| 238 | if(auto any_ref = getAnyLocked(key)) |
| 239 | { |
| 240 | const auto& any = any_ref.get(); |
| 241 | if(any->empty()) |
| 242 | { |
| 243 | throw RuntimeError("Blackboard::get() error. Entry [", key, |
| 244 | "] hasn't been initialized, yet"); |
| 245 | } |
| 246 | auto result = tryCastWithPolymorphicFallback<T>(any); |
| 247 | if(!result) |
| 248 | { |
| 249 | throw std::runtime_error(result.error()); |
| 250 | } |
| 251 | return result.value(); |
| 252 | } |
| 253 | throw RuntimeError("Blackboard::get() error. Missing key [", key, "]"); |
| 254 | } |
| 255 | |
| 256 | inline void Blackboard::unset(const std::string& key) |
| 257 | { |