| 408 | |
| 409 | template <typename T> |
| 410 | inline Expected<Timestamp> Blackboard::getStamped(const std::string& key, T& value) const |
| 411 | { |
| 412 | if(auto entry = getEntry(key)) |
| 413 | { |
| 414 | std::unique_lock lk(entry->entry_mutex); |
| 415 | if(entry->value.empty()) |
| 416 | { |
| 417 | return nonstd::make_unexpected(StrCat("Blackboard::getStamped() error. Entry [", |
| 418 | key, "] hasn't been initialized, yet")); |
| 419 | } |
| 420 | auto result = tryCastWithPolymorphicFallback<T>(&entry->value); |
| 421 | if(result) |
| 422 | { |
| 423 | value = result.value(); |
| 424 | return Timestamp{ entry->sequence_id, entry->stamp }; |
| 425 | } |
| 426 | return nonstd::make_unexpected(result.error()); |
| 427 | } |
| 428 | return nonstd::make_unexpected( |
| 429 | StrCat("Blackboard::getStamped() error. Missing key [", key, "]")); |
| 430 | } |
| 431 | |
| 432 | template <typename T> |
| 433 | inline Expected<StampedValue<T>> Blackboard::getStamped(const std::string& key) const |