File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
include/behaviortree_cpp/blackboard Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ class BlackboardImpl
25
25
26
26
virtual const SafeAny::Any* get (const std::string& key) const = 0;
27
27
virtual void set (const std::string& key, const SafeAny::Any& value) = 0;
28
+ virtual bool contains (const std::string& key) const = 0;
28
29
};
29
30
30
31
// This is the "frontend" to be used by the developer.
@@ -107,6 +108,11 @@ class Blackboard
107
108
}
108
109
}
109
110
111
+ bool contains (const std::string& key) const
112
+ {
113
+ return (impl_ && impl_->contains (key));
114
+ }
115
+
110
116
private:
111
117
std::unique_ptr<BlackboardImpl> impl_;
112
118
};
Original file line number Diff line number Diff line change @@ -27,6 +27,11 @@ class BlackboardLocal : public BlackboardImpl
27
27
storage_[key] = value;
28
28
}
29
29
30
+ virtual bool contains (const std::string& key) const override
31
+ {
32
+ return storage_.find (key) != storage_.end ();
33
+ }
34
+
30
35
private:
31
36
std::unordered_map<std::string, SafeAny::Any> storage_;
32
37
};
You can’t perform that action at this time.
0 commit comments