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

Function set_parent

include/behaviortree_cpp/contrib/json.hpp:20055–20091  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20053 }
20054
20055 reference set_parent(reference j, std::size_t old_capacity = static_cast<std::size_t>(-1))
20056 {
20057#if JSON_DIAGNOSTICS
20058 if (old_capacity != static_cast<std::size_t>(-1))
20059 {
20060 // see https://github.com/nlohmann/json/issues/2838
20061 JSON_ASSERT(type() == value_t::array);
20062 if (JSON_HEDLEY_UNLIKELY(m_data.m_value.array->capacity() != old_capacity))
20063 {
20064 // capacity has changed: update all parents
20065 set_parents();
20066 return j;
20067 }
20068 }
20069
20070 // ordered_json uses a vector internally, so pointers could have
20071 // been invalidated; see https://github.com/nlohmann/json/issues/2962
20072#ifdef JSON_HEDLEY_MSVC_VERSION
20073#pragma warning(push )
20074#pragma warning(disable : 4127) // ignore warning to replace if with if constexpr
20075#endif
20076 if (detail::is_ordered_map<object_t>::value)
20077 {
20078 set_parents();
20079 return j;
20080 }
20081#ifdef JSON_HEDLEY_MSVC_VERSION
20082#pragma warning( pop )
20083#endif
20084
20085 j.m_parent = this;
20086#else
20087 static_cast<void>(j);
20088 static_cast<void>(old_capacity);
20089#endif
20090 return j;
20091 }
20092
20093 public:
20094 //////////////////////////

Callers 5

atFunction · 0.85
operator[]Function · 0.85
push_backFunction · 0.85
emplace_backFunction · 0.85
emplaceFunction · 0.85

Calls 2

typeFunction · 0.85
set_parentsFunction · 0.85

Tested by

no test coverage detected