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

Function ImportBlackboardFromJSON

src/blackboard.cpp:354–371  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

352}
353
354void ImportBlackboardFromJSON(const nlohmann::json& json, Blackboard& blackboard)
355{
356 for(auto it = json.begin(); it != json.end(); ++it)
357 {
358 if(auto res = JsonExporter::get().fromJson(it.value()))
359 {
360 auto entry = blackboard.getEntry(it.key());
361 if(!entry)
362 {
363 blackboard.createEntry(it.key(), res->second);
364 entry = blackboard.getEntry(it.key());
365 }
366 // Lock entry_mutex before writing to prevent data races (BUG-4 fix).
367 std::scoped_lock lk(entry->entry_mutex);
368 entry->value = res->first;
369 }
370 }
371}
372
373Blackboard* BT::Blackboard::rootBlackboard()
374{

Callers 4

ImportTreeFromJSONFunction · 0.85
TEST_FFunction · 0.85
TESTFunction · 0.85
fuzzJsonOperationsMethod · 0.85

Calls 8

getEntryMethod · 0.80
createEntryMethod · 0.80
getFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
fromJsonMethod · 0.45
valueMethod · 0.45
keyMethod · 0.45

Tested by 2

TEST_FFunction · 0.68
TESTFunction · 0.68