| 51 | } |
| 52 | |
| 53 | const std::shared_ptr<Blackboard::Entry> |
| 54 | Blackboard::getEntry(const std::string& key) const |
| 55 | { |
| 56 | // special syntax: "@" will always refer to the root BB |
| 57 | if(StartWith(key, '@')) |
| 58 | { |
| 59 | return rootBlackboard()->getEntry(key.substr(1, key.size() - 1)); |
| 60 | } |
| 61 | |
| 62 | { |
| 63 | const std::shared_lock<std::shared_mutex> storage_lock(storage_mutex_); |
| 64 | auto it = storage_.find(key); |
| 65 | if(it != storage_.end()) |
| 66 | { |
| 67 | return it->second; |
| 68 | } |
| 69 | } |
| 70 | // not found. Try autoremapping |
| 71 | if(auto parent = parent_bb_.lock()) |
| 72 | { |
| 73 | auto remap_it = internal_to_external_.find(key); |
| 74 | if(remap_it != internal_to_external_.cend()) |
| 75 | { |
| 76 | auto const& new_key = remap_it->second; |
| 77 | return parent->getEntry(new_key); |
| 78 | } |
| 79 | if(autoremapping_ && !IsPrivateKey(key)) |
| 80 | { |
| 81 | return parent->getEntry(key); |
| 82 | } |
| 83 | } |
| 84 | return {}; |
| 85 | } |
| 86 | |
| 87 | std::shared_ptr<Blackboard::Entry> Blackboard::getEntry(const std::string& key) |
| 88 | { |