MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / ExportBlackboardToJSON

Function ExportBlackboardToJSON

src/blackboard.cpp:337–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

335}
336
337nlohmann::json ExportBlackboardToJSON(const Blackboard& blackboard)
338{
339 nlohmann::json dest;
340 for(auto entry_name : blackboard.getKeys())
341 {
342 const std::string name(entry_name);
343 if(auto any_ref = blackboard.getAnyLocked(name))
344 {
345 if(auto any_ptr = any_ref.get())
346 {
347 JsonExporter::get().toJson(*any_ptr, dest[name]);
348 }
349 }
350 }
351 return dest;
352}
353
354void ImportBlackboardFromJSON(const nlohmann::json& json, Blackboard& blackboard)
355{

Callers 5

ExportTreeToJSONFunction · 0.85
TEST_FFunction · 0.85
TESTFunction · 0.85
fuzzJsonOperationsMethod · 0.85

Calls 5

getKeysMethod · 0.80
getAnyLockedMethod · 0.80
toJsonMethod · 0.80
getFunction · 0.50
getMethod · 0.45

Tested by 2

TEST_FFunction · 0.68
TESTFunction · 0.68