10 #include <Atoms/Globals.h>
11 #include <AtomsCore/Metadata/Metadata.h>
12 #include <AtomsCore/Metadata/MapMetadata.h>
13 #include <AtomsCore/Metadata/StringMetadata.h>
14 #include <Atoms/BehaviourTree/BlackboardValue.h>
28 AtomsPtr<AtomsCore::Metadata> value;
44 size_t addEntry(
const std::string& name, AtomsPtr<AtomsCore::Metadata>& metadata,
short flags = 0);
46 void updateEntry(
const std::string& name, AtomsPtr<AtomsCore::Metadata>& metadata);
50 inline size_t size()
const {
return m_entries.size(); }
52 inline void setParent(
Blackboard* parent) { m_parent = parent; }
55 const Blackboard* parent()
const {
return m_parent; }
59 unsigned int entryType(
const std::string& name)
const;
61 std::string entryTypeStr(
const std::string& name)
const;
69 std::vector<BlackboardEntry> m_entries;
82 inline size_t size()
const {
return values.size(); }
84 AtomsPtr<AtomsCore::Metadata>& entry(
size_t index) { assert(values.size() > index);
return values[index]; }
85 const AtomsPtr<AtomsCore::Metadata>& entry(
size_t index)
const { assert(values.size() > index);
return values[index]; }
88 std::vector<AtomsPtr<AtomsCore::Metadata>> values;
96 template <
typename T,
typename M>
99 blackboardValue.position.valueIndex = -1;
100 blackboardValue.position.parentIndex = 0;
104 blackboardValue.value = attrPtr->value();
108 if (properties && blackboard)
110 auto blackboardKey = properties->
getTypedEntry<AtomsCore::StringMetadata>(
"blackboard_key");
111 if (blackboardKey && !blackboardKey->get().empty())
113 auto bbPosition = blackboard->entryPosition(blackboardKey->get());
114 blackboardValue.position = bbPosition;
119 inline void getBlackboardKeyPositionFromAttributes(
const AtomsCore::MapMetadata* attributes, Blackboard* blackboard,
const std::string& attributeName, BlackboardValue<std::string>& blackboardValue)
121 blackboardValue.position.valueIndex = -1;
122 blackboardValue.position.parentIndex = 0;
123 auto attrPtr = attributes->
getTypedEntry<AtomsCore::StringMetadata>(attributeName);
126 auto bbPosition = blackboard->entryPosition(attrPtr->get());
127 blackboardValue.position = bbPosition;
131 if (properties && blackboard)
133 auto blackboardKey = properties->
getTypedEntry<AtomsCore::StringMetadata>(
"blackboard_key");
134 if (blackboardKey && !blackboardKey->get().empty())
136 auto bbPosition = blackboard->entryPosition(blackboardKey->get());
137 blackboardValue.position = bbPosition;
143 inline void getBlackboardValueFromAttributes<AtomsCore::Metadata, AtomsPtr<AtomsCore::Metadata>>(
const AtomsCore::MapMetadata* attributes, Blackboard* blackboard,
const std::string& attributeName, BlackboardMetadataValue& blackboardValue)
145 blackboardValue.position.valueIndex = -1;
146 blackboardValue.position.parentIndex = 0;
147 auto attrPtr = attributes->getEntry(attributeName);
150 blackboardValue.value = attrPtr->clone();
154 if (properties && blackboard)
156 auto blackboardKey = properties->
getTypedEntry<AtomsCore::StringMetadata>(
"blackboard_key");
157 if (blackboardKey && !blackboardKey->get().empty())
159 auto bbPosition = blackboard->entryPosition(blackboardKey->get());
160 blackboardValue.position = bbPosition;
Definition: Blackboard.h:35
Definition: Blackboard.h:76
Definition: BlackboardValue.h:28
Atoms namespace.
Definition: Agent.h:29
Definition: Blackboard.h:20
Definition: BlackboardValue.h:21